Commit Graph

584 Commits

Author SHA1 Message Date
Jessica McKellar ab21823c19 Fix bug allowing people to subscribe themselves to others' invite-only streams.
(imported from commit db7634d81677217032c180d8bab297cc766228f1)
2013-02-05 10:01:45 -05:00
Jessica McKellar dc66d6290b views: be more strict about the value of invite_only in add_subscriptions_backend.
(imported from commit 565375b06bb38382100923554e52a16549a18e00)
2013-02-05 10:01:45 -05:00
Jessica McKellar 6d880c2147 subscriptions: make invite-only checkbox have an effect.
(imported from commit 7ee5c5c88efa4ab21395c03012c2921fd3c5192e)
2013-02-05 10:01:45 -05:00
Jessica McKellar 7e6a9136f5 views: make add_subscriptions_backend able to subscribe many people to streams.
Before, it let you subscribe only yourself or one other person to
possibly many streams.

This is used by the subscriptions page to specify the subscribers when
you create a stream.

(imported from commit c1055e98b0bb27799ac9e6dad80b9c9fd87deca2)
2013-02-05 10:01:45 -05:00
Zev Benjamin d5fdfd7be2 Make searching for multiple words be treated as the boolean AND of those words
(imported from commit d9e47dd25553cc31eeda615e3a5709436e883ab3)
2013-01-31 18:10:54 -05:00
Zev Benjamin 97851a93c4 Use full text search when using Postgres
On my laptop, this cuts search time from several seconds down to
a few hundred milliseconds.

If we want even more speed, we could store the ts_vector as a column
on the message database.  The Postgres documentation says this will
make "searches [...] faster, since it will not be necessary to redo
the to_tsvector calls to verify index matches."  Going this route
requires creating a trigger to automatically insert the appropriate
column when new rows are inserted.

Note that the full text index must be fully created before this
commit is deployed.  Full text search without an index is actually
significantly slower than using the LIKE operator.

(imported from commit ae74083da20d33aa2425d3e44fcdc19b160002ba)
2013-01-31 15:57:45 -05:00
Zev Benjamin 1f4e27cf52 Pass the query object to NarrowBuilder
This is for allowing us to do things more complex than returning a Q
expression, needed for doing Postgres full text search.

(imported from commit 669ec71417c04baaf8ed1774bee147079b05b03d)
2013-01-31 15:57:45 -05:00
Leo Franchi 7e567f527f Move gather_subscriptions to actions.py as it's not a view
(imported from commit cdf94ded51e441fe3515641458023be44c1ba40c)
2013-01-28 17:32:58 -05:00
Leo Franchi b2505bfc22 Add backend support for invite-only streams
Trying to add a user to an invite-only stream that already
exists will result in in error

(imported from commit 910750580a122cee92096d7e83457cb0b8cce616)
2013-01-24 17:34:21 -05:00
Luke O'Malley cde69d5bf8 activity: Add iPhone and Android tabs to /activity
(imported from commit 225ac7a718e5545296137c6703fe13c89d0dbbf5)
2013-01-23 10:25:48 -05:00
Waseem Daher dfadc79dc9 activity: Display the user portion of the email address rather than short_name.
Apparently short_name is not consistently the person's username
in our system -- for many MIT people, it's their full name.

(imported from commit d975300a59c7afe5ee20b4a0db1bd51110c3df33)
2013-01-18 13:47:43 -05:00
Waseem Daher 068c702883 activity: Display short name instead of full email address.
As of this writing, short_name is the part before the @-sign,
and we already display the realm, so no need to display it
twice.

(imported from commit f5f9b29bff99b36b0c23176348c2869193467c38)
2013-01-18 13:34:39 -05:00
Waseem Daher 764047e113 activity: Add names to the table.
(imported from commit d4554690a9381dd0b72c7c03116dc01145960a5b)
2013-01-18 13:29:53 -05:00
Tim Abbott 8cb8c0065c Move get_stream to models.py and accept an id for the realm argument.
(imported from commit 7ce09b7ed450cfa3ddf1de22bbb0b19abfc4a2a2)
2013-01-17 16:20:18 -05:00
Reid Barton b8d56433f0 Send customer29.invalid signups to customer29.invalid too
Eventually there should be a database table or something where we can
configure this for each realm.

(imported from commit 5f3e6823f420e113da8ff8c521cc706175299fa4)
2013-01-17 14:37:52 -05:00
Luke Faraone 63d43aa152 Notify us when a Hunt user signs up.
(imported from commit 10d4eea99427c16f8936f7fc2e2a821e7fbf73c6)
2013-01-17 13:54:52 -05:00
Luke Faraone a3f412b193 Add functions for CUSTOMER30 registration.
(imported from commit c4b6f744ffa5b41df4170735f081bbe5655a54fe)
2013-01-17 10:49:10 -05:00
Reid Barton 9e23907259 Add "Lurk" mode
/?lurk=foo will show all messages to the stream "foo", regardless of
whether you're subscribed.

(imported from commit 049d98b3ee8df19ef0a9dc392ae941dd463f8dd5)
2013-01-16 14:19:06 -05:00
Reid Barton ed29f22069 Implement single-stream get_old_messages/get_updates
(imported from commit 22a5c4985f36c38cf2490ecf26da294b502f8e46)
2013-01-16 14:19:05 -05:00
Zev Benjamin d3dd0a805a Inlucde the current user in the people list
(imported from commit a596b61a68453126726bd6f56a6c421022e1e395)
2013-01-15 17:40:30 -05:00
Zev Benjamin 28a2832415 Use get_stream in more places to avoid case-sensitivity errors
(imported from commit 9b7109d4e23db4359751b0283025b7ff60e06836)
2013-01-15 17:02:39 -05:00
Zev Benjamin 4ffc6a2de1 When subscribing to streams, send back the canonical stream name
(imported from commit 7803409878cca4627447bc64735ad71f56701a5c)
2013-01-15 17:02:39 -05:00
Zev Benjamin 044fc61be2 Restrict the get_public_streams query to non-MIT or superusers
(imported from commit ede1dff6176e6a39da126948ce307941e6dffaec)
2013-01-15 17:02:39 -05:00
Zev Benjamin 76b1e4778d Expose get_public_streams to the JSON API
(imported from commit 2ef9e000e4cd9fcc075e66d3da9c4bce63d68a4d)
2013-01-15 17:02:39 -05:00
Zev Benjamin 2544cef6bb Add the ability for users to subscribe others in their realm to streams
Right now we mitigate abuse by sending the principal user a Humbug
informing them that they've been subscribed.  Longer term, we want
some sort of stream invitation system, instead.

(imported from commit bf1f1ee0c5d3803cead1ddd9a766ff02043b629e)
2013-01-15 17:02:39 -05:00
Zev Benjamin 45de8fd25b Add a query to fetch the subscribers of a stream
(imported from commit 286bb42980619a3f8e575a4e2984ad1c4b3fe099)
2013-01-15 17:02:38 -05:00
Luke Faraone f62c97706a Don't assume that PreregistrationUser.email is unique in accounts_home
The schema change made this no longer a guarantee, and creating duplicate
PUs is not harmful.

(imported from commit ca05b4dad7d3cc12a35548817f98c0a072c14c8f)
2013-01-14 10:25:27 -05:00
Luke Faraone 99abad2447 Use custom copy for invites.
(imported from commit 15b306777fd40e7c3feeaaaa871a8936ffc0f651)
2013-01-14 10:25:27 -05:00
Luke Faraone 974c220625 Convert invitee_emails to a set to eliminate duplicate users.
(imported from commit 09e6f7251c4d8d13ce2b4a2808f53e3c9fb97708)
2013-01-14 10:25:26 -05:00
Luke Faraone 75004c65f2 Prevent MIT users from sending invites and hide the button.
(imported from commit 0388c4a2253514e0aba15605bd75a87543479312)
2013-01-14 10:25:26 -05:00
Luke Faraone 22a4b76290 [manual] [schema] Add backend function to invite users to the app.
(imported from commit 17ae27b22bdca33e63b96fa8c819759e4f4315fa)
2013-01-14 10:25:25 -05:00
Tim Abbott 1a82741650 Move action functions from models.py to zephyr/lib/actions.py.
(imported from commit 9d577dd53ce7d4c9faf6cc8a56129d684a50811b)
2013-01-11 16:11:03 -05:00
Tim Abbott 761b7cd5fa Rename zephyr.lib.time to zephyr.lib.timestamp.
Otherwise one gets:

AttributeError: 'module' object has no attribute 'time'

when trying to use the time module from inside zephyr.lib.

(imported from commit 645368672a3eff68320278dd480edeed56721fcc)
2013-01-11 15:58:19 -05:00
Keegan McAllister 4a9d65c758 Disable desktop notifications in automated testing
CasperJS can't handle them; window.webkitNotifications.requestPermission()
throws a type error.  We can revisit this when we want to write tests for the
notification code.

(imported from commit 90f4d6ac3ddb387e74051b9af2c230698fa94479)
2013-01-09 14:03:40 -05:00
Luke Faraone c327446537 Add alternative terms acceptance workflow.
This view lives at /accounts/accept_terms, and (after getting an acceptance
from the user) sends an email to all@ documenting the acceptance.

(imported from commit 8f64286ab02887fd6544fa274b2967f6499b6dbc)
2013-01-08 17:48:42 -05:00
Tim Abbott 83abc08315 Move tornado views to their own file.
(imported from commit e0d9182cbc89a16eedd2846fa17cfba482510565)
2013-01-08 16:53:53 -05:00
Tim Abbott 2d94e4c780 Improve database queries for narrowing to personals with another user.
Inspection of the postgres slow queries log showed that the "narrow to
personals with a particular user" database queries were taking a long
time to run (0.5s+).  Further investigation determined that the OR
gate construction used here was causing the entire zephyr_message
table to be scanned; primarily I think because we were using the
implicit constraint that the logged in user had received messages.

This change makes that query explicit (improving performance), while
cleaning up the code to avoid an unnecessary query and read a little
more clearly.

After this change, the relevant database query takes 10s of milliseconds.

(imported from commit 020f5af5846c958386615e37ea9318383bf99ca0)
2013-01-08 13:42:37 -05:00
Keegan McAllister 50d229fe11 Accept '{}' to mean 'no narrowing', for old mobile clients
(imported from commit 879f6ef846f2a8980a0574372324d8dc8d22c8ed)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3af2bf345a Reinstate server-side narrow filtering
(imported from commit 40f63324a8dff404b504b06bddf303b8c1ad5780)
2013-01-08 12:18:31 -05:00
Tim Abbott dd843b3916 Fix buggy check for zmirror huddle sending to multiple recipients.
(imported from commit 2abc88338225a8a07c50aaf6eb54862885edcb9e)
2013-01-07 15:06:28 -05:00
Tyler Hallada 3763dca4a6 Return error if confirm_password is filled but not new_password
(imported from commit c58ca8d2f5592c4cf062b963f3cca6673242419e)
2013-01-02 18:46:09 -05:00
Tim Abbott 384e64aaf5 Fix notify_pointer_update notifying on the wrong user's pointer.
(imported from commit 4b50fa7da7d1de4e478f222f284ab6ba35db9899)
2012-12-31 17:19:59 -05:00
Tim Abbott dd99f0ceb8 Temporarily reintroduce #174 pending better performance.
This essentially reverts d900957e468815bcb99de67d570dfd7ce4413220.

This code was consuming up to 50-100ms per client recipient of a
message, so for any messages that would go to 50+ browser windows /
mobile devices, it would take several seconds to run, during which
time Tornado would be completely blocked.

In the future, we can re-fix #174 using a cache of recently delivered
messages, so that this code block doesn't go to the database and thus
can run instantaneously.

(imported from commit bdfa1664210429411737f70cde54ab5a56525341)
2012-12-31 13:06:03 -05:00
Zev Benjamin 4a28359092 Use to_non_negative_int in an additional place
(imported from commit 2e44cdc927499b0f0fd655ebfe00a864a55ae20a)
2012-12-20 14:26:36 -05:00
Jeff Arnold db6f03d46d Make the back button work when narrowed
(imported from commit be922b06e7b53ec21751e67a490bb518333c3e6c)
2012-12-19 14:46:31 -05:00
Keegan McAllister 44b9925bfc Configure get_updates timeout in settings.py
(imported from commit 2a647bdd73c43ca5fed704925808efafc70da044)
2012-12-14 16:22:42 -05:00
Tim Abbott 9811050a4f views: Add json_to_list and use it and json_to_dict more.
(imported from commit a6fdc85edb8066eab7ca7cfa5f6f5fdf53b10a8c)
2012-12-13 16:39:58 -05:00
Tim Abbott 2280e4a58a Rename from_json_to_dict to json_to_dict.
(imported from commit a96d29c5e9a700c54a29a8777d7a1e5a4ccbd77d)
2012-12-13 16:39:58 -05:00
Tim Abbott e6fef7d7ba Fix confusion of user / user_profile objects in MIT signup codepaths.
(imported from commit f39943bf31f705365ed9743c6d2e9239fed8c9e2)
2012-12-13 13:32:34 -05:00
Waseem Daher 4108f2f817 Add a 'realm' column to the activity page.
This makes it easier for me to, e.g. check on all of CUSTOMER1.

(imported from commit 1970df29b08b299cd1d00013abecefd7efbffb48)
2012-12-12 18:05:54 -05:00
Jessica McKellar 41e688d913 Add exception handling around database lookups based on user data.
(imported from commit 4ddab2ed130ef57c967cc9364f8890a4c5b5e347)
2012-12-11 16:07:09 -05:00
Jessica McKellar 435c98b35c Be more picky about the type of get_old_messages's narrow POST parameter.
This addresses 500s observed on prod due to bad narrow values.

(imported from commit 5a865ce41e8a90d3990332d906cba4336eb53ada)
2012-12-11 16:07:09 -05:00
Tim Abbott 100df7e349 Add a maximum message length of 10000 characters.
(imported from commit a07c872d612521c9792be8dc704a9cfd6c752c75)
2012-12-11 11:33:40 -05:00
Zev Benjamin 19108929a7 github: only describe the first several commits in push notifications
(imported from commit aa26d2ae1d2d30350ec6e30729fb5652f385bd19)
2012-12-11 11:04:37 -05:00
Luke Faraone ced8062509 Use MAX_SUBJECT_LENGTH instead of hardcoded constant.
(imported from commit cc885f7ca196ec1de0279a6a6192044ff7c8420f)
2012-12-07 17:32:16 -05:00
Luke Faraone c65d6113ed Factor out notifying of a new user into a separate function, notify on manage.py create_user.
(imported from commit 1a6aa0536dbfea8035b6bbd76528e70d90aa8b60)
2012-12-07 17:32:16 -05:00
Luke Faraone 7fbee21584 Factor out Message() creation for internal use into separate function.
(imported from commit 0352010da4255fc74cd67835e04dbdb1f8bbf4e9)
2012-12-07 17:32:15 -05:00
Zev Benjamin f09ddbf80a Raise a ValueError instead of using an assert to enforce constraints
(imported from commit d4b0a9b13df3e2ffd33ae330f2301118c2e75343)
2012-12-07 13:16:31 -05:00
Zev Benjamin d31c33e505 github: fix missing argument to format string
(imported from commit 423cb4cb62976c5689db255120db5061a8b7be11)
2012-12-06 17:18:57 -05:00
Keegan McAllister 273c71e094 get_stream_colors: Use gather_subscriptions
(imported from commit fd870d889335860b14ad7a279160495e84bb303f)
2012-12-06 11:04:32 -05:00
Keegan McAllister 6776fd389f gather_subscriptions: Fetch colors along with subscriptions
Fixes #533.

(imported from commit 100b69569f61910a79a911fe82d7c8d14cac1e88)
2012-12-06 11:04:31 -05:00
Zev Benjamin 04063548fe Fix response for unsubscribe requests
The response was being populated with the same stream name over and over again

(imported from commit e205ce6019c1c7980b87ef33fd49497fe9c8691c)
2012-12-06 10:38:07 -05:00
Tim Abbott 28aa976be3 Fix desktop notifications being enabled on every settings change.
(imported from commit 09375c78125987de3223a17239fdef9273ccabe6)
2012-12-06 10:32:45 -05:00
Tim Abbott 41ec4d44a0 Don't let users change their fullname to be whitespace.
(imported from commit 015fc7cbc06acd5057952a3f09a9b6d3fe68d9fd)
2012-12-06 10:32:45 -05:00
Zev Benjamin 037aebd487 Improve Github push messages
This addresses Greg Price's feedback in #527.  We now distinguish
between normal pushes, force pushes, and branch deletions.

(imported from commit 0fab6055f63ffc7e6df283b8bb8ed9971000e6d5)
2012-12-05 16:57:33 -05:00
Tim Abbott 970969fc44 Add new timestamp_to_datetime helper function.
(imported from commit 6791d009ae2e8371abe2c929e87c816a1981f5fe)
2012-12-05 15:34:19 -05:00
Tim Abbott 8e3bcdaa19 Add user_created event type and appropriate replay code.
This is necessary for correctly replaying new user signups on non-MIT
domains.

(imported from commit e5a9d37b8772bd9794579ef16e7039196ac06f62)
2012-12-05 15:34:18 -05:00
Keegan McAllister ec3bef300b activity: Provide a link from the app
For humbughq.com users only.  Opens in a new tab.

(imported from commit 509905ebfacb45a454e863e8309896ffd3c538be)
2012-12-05 14:32:41 -05:00
Zev Benjamin 817baa72e3 Avoid sending messages to clients more than once due to out-of-order processing
This resolves #535

(imported from commit 9a7bf7443d17523e9ba14797a0215ee11262c7de)
2012-12-05 13:51:28 -05:00
Tim Abbott e816604c6e Fix bug where personals might be lost in mirroring.
(imported from commit ed78ca442677f3ee8b3149d61e351f624f437d24)
2012-12-05 12:39:56 -05:00
Keegan McAllister 97bcfbdbb8 activity: Put the three tables into Bootstrap tabs
(imported from commit 508c4b15a82df969b08b430ad892c4b13ed68092)
2012-12-05 12:35:05 -05:00
Keegan McAllister 23eef06ed0 activity: Initially sort rows by time of last activity
Doing this on the server is somewhat easier than making sorttable do it on page load.

(imported from commit 3ed7b127ba874d674d5cfe5b102c62a74be572f8)
2012-12-05 11:42:09 -05:00
Keegan McAllister 3f5d9902ab activity: Color rows for recently active or long inactive users
(imported from commit 5acc9317085acd7b4433b24b96bdf7fdebee5380)
2012-12-05 11:42:09 -05:00
Keegan McAllister 83d86f33ca activity: Clean up table computation a bit
(imported from commit c599d7ca572010c07b457ec15a305eef7dff78dd)
2012-12-05 11:42:08 -05:00
Zev Benjamin 7e4776322d [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00
Zev Benjamin bc67d9d1d7 Prevent race during get_updates that can cause clients to miss messages
This fixes #174

(imported from commit d900957e468815bcb99de67d570dfd7ce4413220)
2012-12-04 12:44:44 -05:00
Zev Benjamin f4898ea490 do_send_message: use JSON for the user list instead of joining/splitting with commas
(imported from commit 85d94ca647d0e6707f4f96e2b7a7b330f76db9d9)
2012-12-04 12:44:44 -05:00
Tim Abbott 2ad1b14f23 Set zephyr_mirror_active to False for new MIT users.
(imported from commit ffa0513561c994da1b561c0ad50728b8351e22e8)
2012-12-04 10:55:31 -05:00
Jeff Arnold 5ea4e30caf Proprely handle get_old_messages when narrowed to personals with yourself
(imported from commit 3ace5655d093f4568b4dea512a6e1bbbd6245f10)
2012-12-03 15:58:26 -05:00
Jessica McKellar dbcd6684a2 Add error handling to subscription color requests.
(imported from commit b2f65feeb44abe37397de88c616fa1aa01cf8277)
2012-12-03 12:46:27 -05:00
Jessica McKellar 55e68fc89a Log subscription color changes so they can be replayed by populate_db.
(imported from commit 5c7f46ed0d727926e9819cb2d71eb31f241e2e34)
2012-12-03 12:46:27 -05:00
Jessica McKellar 2fd3eb521c Refactor colorizing requests into a subscription properties model.
(imported from commit da4bfee4a12e941d4ec4c9f140973bb138c82c93)
2012-12-03 12:46:27 -05:00
Jessica McKellar 1dbb2c6ed5 decorators: split authenticated_json_view into POST and non-POST versions.
(imported from commit cdcfdb51c379c07e94ebc763cf925e6a73747fc0)
2012-12-03 12:46:27 -05:00
Jessica McKellar 505d35ac9b Add backend support for colorizing streams.
This includes JSON requests to fetch and set stream colors.

(imported from commit 92e19c9a3b72e9012df0178348068ea033b5f060)
2012-12-03 12:46:26 -05:00
Tim Abbott 79f8e2a6a3 get_public_streams: Return only streams someone is subscribed to.
This makes subscribing to zephyr classes for the zephyr class
mirroring bot a lot faster, since we don't need to subscribe to the
third of our streams on which no users will actually receive messages.

(imported from commit 029b7fb260b480db5599e3c9f9effc502f6d8b59)
2012-12-01 09:36:36 -05:00
Zev Benjamin ec0fd19249 Always send back the server generation number when the client requests it
During long-polling mode, we were not passing the server generation
number back to the client even when they requested it.  This was
causing the web client to initiate reloads every time it got a
non-immediate return from a long-polling request.

(imported from commit 66c16bf5a1c18bdd975b09d672ebdb4db8d4755d)
2012-11-29 13:45:31 -05:00
Tim Abbott 4024306613 Convert server_generation to an int when parsed.
(imported from commit 5a6f7454c62b98569a474881e8d2e5965336324e)
2012-11-28 17:41:39 -05:00
Tim Abbott 8a3c4f7d89 get_updates: Only return server_generation is the client sent it.
(imported from commit 185bbc8c422d62f45dfb8f4cb8464adc7f1e4078)
2012-11-28 17:41:39 -05:00
Tim Abbott a44c3ff247 get_updates: Eliminate the reload_pending parameter.
(imported from commit c7b57c4ef7fc4d6f0028f174f33ff7ff063d4b9d)
2012-11-28 17:41:38 -05:00
Tim Abbott d23a83ee81 get_updates: Replace "failures" with the new dont_block option.
(imported from commit 2b4ecb35c4f14b6c408323662ef6f39c6485c62d)
2012-11-28 17:41:38 -05:00
Tim Abbott a1d8e9d30f get_updates: Replace the "mirror" argument with checking "client".
(imported from commit bd84c2c7a456de8ea7ec35eaf76b5bf8647ca61a)
2012-11-28 17:41:38 -05:00
Tim Abbott a6841c7f12 decorators: Pass the parsed client to view functions as request._client.
(imported from commit e297cfc9c2c1c4d07f083a28ab3d85d32a8bc85b)
2012-11-28 17:41:38 -05:00
Tim Abbott d908b7299c get_updates: Fix client_reload_pending parameter.
(imported from commit f14ea8a6e35d9aac3ac568785d9dd0962c773937)
2012-11-28 17:41:38 -05:00
Tim Abbott 87eabc5159 api_get_messages: Use POST() for apply_markdown.
(imported from commit 4e0e57d6b93cd9410cf946069ea987c26e0f4f5d)
2012-11-28 17:41:38 -05:00
Zev Benjamin f568ff20c2 Remove format_delayed_updates_response
(imported from commit d1aa1a1f36fc5ec36f1658aec489db84ae469f7c)
2012-11-28 16:36:43 -05:00
Zev Benjamin 3cc353fc7e Only add a pointer update callback if the client is interested in pointer updates
Previously, if the client was not interested in pointer updates, they
would still return early from get_updates() when the pointer was
updated.

(imported from commit ef9d8b5678b7e72f799840148577651ee10d47ad)
2012-11-28 16:36:43 -05:00
Zev Benjamin 99cf78e1aa Send pointer updates to everyone
Realistically, if there is a pointer update, no other client is going
to have the same pointer.  If they do, the client can ignore the
update.

(imported from commit ca2db60ed7a7c5e4b50a9fa8d350985460922a50)
2012-11-28 16:36:43 -05:00
Zev Benjamin 249b7a527f Switch to high-watermark pointer model
(imported from commit c05d074a404e823eaa0808b6938a3c80e457175b)
2012-11-28 16:36:41 -05:00
Zev Benjamin fbe41c95d5 Re-enable pointer sync
(imported from commit 9f765bbc32e6a3fd91e83aa4016c8e8f8c47bfc1)
2012-11-28 16:36:24 -05:00
Keegan McAllister b5dccbfa87 Return a special value to initiate longpolling
Fixes #261.

(imported from commit dd0312c3574c9ca924ab76edcb2fb6c03085be32)
2012-11-28 15:28:14 -05:00
Keegan McAllister 30933a9639 Explain a bit more how longpolling works
(imported from commit 26c4792f097d748edc725b4528c4d5904efd03c7)
2012-11-28 15:28:14 -05:00
Keegan McAllister cb7e726d77 Create and use @internal_notify_view
Resolves #288.

(imported from commit 982bf5651a34fa66cd81c882ed0351829eaadf86)
2012-11-28 15:28:14 -05:00
Zev Benjamin 81fe519b24 github hooks: Display different actions for pull requests sanely
(imported from commit c6d43ccff2d72f61a1cc4d8d320db56edd074832)
2012-11-28 14:49:21 -05:00
Zev Benjamin fb0b4b23c3 Preliminary GitHub integration for pull requests and pushes
(imported from commit 5f91cfd39552294e2c1f1412044d5c8e738d68e3)
2012-11-27 13:55:57 -05:00
Zev Benjamin a117bd4cdc Use @has_request_variables a little more
(imported from commit ea6422ea3cdbce134bb40181b7889bf5c6442eb7)
2012-11-27 13:55:57 -05:00
Luke Faraone d270ff348f Save newly created users in the log so they aren't forgotten by populatedb.
(imported from commit a43aaf73576dcacf85c4ad662cbcf04b3fe2bbd7)
2012-11-27 11:16:38 -05:00
Tim Abbott 688525668e Correctly display the user count in registration process.
(imported from commit 24c8479c0730d1756c4e1bd0b818772914c20bd5)
2012-11-27 10:55:00 -05:00
Jessica McKellar cca39ca5e8 Add default subscriptions upon non-MIT user creation.
We'll probably eventually get fancier with this, suggesting various
default sets depending on the company or making it easy for one person
to create default subs for several people at once.

Until we know what we want, keep it simple.

(imported from commit 14319dd50c67fe33ac6f15288dba4916ce0a89ac)
2012-11-26 21:02:29 -05:00
Jeff Arnold a6ec875268 [schema] Add enable_desktop_notifications to user profile
(imported from commit f5b543e8446263ce8855561441a6d4c1a8d41f4d)
2012-11-26 14:43:55 -05:00
Tim Abbott fac24df233 Show a user-visible error message when mirroring is not working.
The main problem with this code is that the error message doesn't go
away until you reload.  To fix this, we need to add a noblock option
on get_updates.

(imported from commit dc45af397bcf06a218bda5dd224ebd5fdf3462db)
2012-11-26 11:49:29 -05:00
Tim Abbott eefa5b2d7b API: Add support for nonblocking get_updates requests.
(imported from commit bf2ab19a83765c177fbb93abc1a61dccf5b4b2b7)
2012-11-26 11:49:29 -05:00
Luke Faraone 724dce78e4 Always allow registration if attempting to register for a non-MIT realm.
(imported from commit 00489ab74c376a4ffb23ad661699ef31c6c06818)
2012-11-21 16:42:15 -05:00
Keegan McAllister 161af7838f Prevent session expiry as long as the user has reloaded in the past two weeks
Fixes (?) #416.

(imported from commit 9d56fe4125f742e2cdccc41ebd385daacccf461f)
2012-11-20 21:49:11 -05:00
Luke Faraone ed691f0b6e Linewrap long line in views.py
(imported from commit 923ce6d87755e4827995d10f62b574d416246147)
2012-11-20 17:40:40 -05:00
Luke Faraone 48806b5548 Fix incorrect Recipient access, use create_stream_if_needed.
This solves 500s that were occurring when subbing to "signups" and related
actions.

(imported from commit 91a59cc23d144133565b2465896e0c5ba868a9bb)
2012-11-20 17:38:00 -05:00
Waseem Daher 12f1a29e07 Specify the stream in a way that includes the realm.
(imported from commit 4de319fe3600f7d434be5198fef214f059f4b668)
2012-11-20 17:18:32 -05:00
Luke Faraone b1ba5bf1b2 [manual] Send a message when a new user creates an account.
(imported from commit 2c69be9bfbbe947db41188cbdfc05cf887dc858f)
2012-11-20 16:41:55 -05:00
Jeff Arnold 9ce4c103c0 Implement full history search by creating a narrow for a search term
(imported from commit 3f2df6a6e590458ff774bbd658bbd1d95076a4db)
2012-11-19 17:12:59 -05:00
Tim Abbott 6026c80de6 API: Add unsubscribe function.
(imported from commit 6dc55e9030770500770ce3921a4e77499d64f2d6)
2012-11-16 17:06:01 -05:00
Tim Abbott d1239278c7 Rewrite remove_subscriptions to work like add_subscriptions.
In particular:
* Taking a list of streams as arguments.
* Using the _backend model so that we can have an API version.
* Considering "not subscribed" to be a non-fatal error.

And of course the corresponding changes to subs.js.

(imported from commit fdb300c6aa6921c2c6b09c22bd1e64405c368809)
2012-11-16 17:06:01 -05:00
Tim Abbott ff2b5c19de add_subscriptons_backend: Some minor code cleanup.
(imported from commit 14a8352b65859b5a8688a6823404f4a7982403ae)
2012-11-16 17:06:01 -05:00
Tim Abbott f1ccf44c99 add_subscriptions_backend: Check that the argument is a list.
(imported from commit c514dab9fb28dcdaa12b38e7ef028e177f4377fb)
2012-11-16 17:06:01 -05:00
Tim Abbott f5ccde78e3 [manual] Use "subscriptions" for {add,list}_subscriptions consistently.
This change requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit a31d6efd2db4d4617c7c6b00326be3f07c7263da)
2012-11-16 17:06:01 -05:00
Tim Abbott afc62a8e16 [manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
2012-11-16 17:06:01 -05:00
Waseem Daher 162c708bde Add the ability to get more messages by stream name.
(imported from commit 38a2847a9820585a458c651436e3a7ec9256c590)
2012-11-16 15:58:21 -05:00
Tim Abbott 50995dc6b7 Fix showing the subscribe-and-send dialogue when you're subscribed.
This doesn't fully fix the problems related to not syncing
subscriptions to browser clients, but it does fix the instance that
everyone experiences.

(imported from commit be2bc31a7c4443c1678321f1a938496e2632c0d3)
2012-11-15 17:15:59 -05:00
Jeff Arnold a68efd9ce2 Handle loading of older messages in narrowed view
(imported from commit 2fe1377736322a44e8682c69dd5e4312d5f46ca4)
2012-11-15 16:32:00 -05:00
Tim Abbott 2ed1917a10 api_get_old_messages: Use @has_request_variables.
(imported from commit 98862197e7b2f57e64ac4d906251cb81f582f5d1)
2012-11-15 15:39:14 -05:00
Tim Abbott 00cd30ff97 Use @has_request_variables in json_remove_subscription.
(imported from commit b08b7672959f8773db1ff7e40b53648926b47a09)
2012-11-15 15:39:14 -05:00
Tim Abbott 1c0832583c send_message_backend: Use POST() for the forged variable.
(imported from commit f2ca2a1adf1c71aa2e92e13a5f9396dfb091a8ef)
2012-11-15 15:39:14 -05:00
Tim Abbott 5467678a2e send_message_backend: Return error on messages with no recipients.
(imported from commit 4cf9bac8eb6e35dde0510afe4efb8ba70c86b566)
2012-11-15 15:39:14 -05:00
Tim Abbott 17f55441b5 Filter out empty string recipients in extract_recipients.
(imported from commit 0a4168e36ea2fe40bde281d2690adcf40bb15abe)
2012-11-15 15:39:08 -05:00
Tim Abbott 1ea1cdcdfd Call extract_recipients using a POST() decorator.
(imported from commit 135c465251a7af688b4354d0bd57763fd8ce282e)
2012-11-15 15:38:18 -05:00
Tim Abbott 03e52767ff Don't lower-case recipient email addresses in extract_recipients.
(imported from commit 7dd150dae659cc68aa6c8f1bad39f7be32384a95)
2012-11-15 15:36:23 -05:00
Tim Abbott 5230382e4d mirror: Check whether the user is a recipient by id.
(imported from commit e50f0b00d8e3cb00fdc7af3872b5adc38c432dcc)
2012-11-15 15:36:23 -05:00
Tim Abbott 4fe089e1ce Refactor arguments to create_mirrored_message_users.
(imported from commit 1a0954018585514c391dd0a6d5d2d382cb8e37ab)
2012-11-15 15:31:48 -05:00
Tim Abbott eddc516d5f send_message: Allow list-form "to" for sending to streams.
(imported from commit f1d8c694b5d89d09222d4f303f68841aede64385)
2012-11-15 15:31:48 -05:00
Tim Abbott 5faf18754e Decrease code duplication in create_mirrored_message_users.
(imported from commit d299124aa1eaa9afac62278c6b98208a14d2cdb1)
2012-11-15 15:30:09 -05:00
Tim Abbott 411a7f6b4f [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00
Tim Abbott 6f10d27f3b send_message_backend: Eliminate unnecessary sender argument.
(imported from commit 64c1b9e2973e47a1d6af355cef0617c9abbff946)
2012-11-15 15:20:52 -05:00
Tim Abbott b219be06d3 Use @has_request_variables for client_name extraction.
(imported from commit b2ba8edaa680c69c82258bfc3f93a9e8028f2cfa)
2012-11-15 15:20:52 -05:00
Tim Abbott 2ab8af0b91 Clean up now-unnecessary extract_sender.
(imported from commit c504838bec7ec14be8fb660015445c9bc20a2a88)
2012-11-14 15:03:49 -05:00
Tim Abbott 7227cb32f8 zephyr_mirror: Compute zephyr mirror fullnames server-side.
(imported from commit 9e6f6f9fe49d60ed30753582480e592613feb3c8)
2012-11-14 15:03:46 -05:00
Tim Abbott 979560d2fe mirror: Make check for duplicate messages more exact.
This should fix the problem where only one of pairs of identical
messages sent to two different zephyr classes by bots will make it
over.

(imported from commit 37005417e2e1f737501c9524b95b044eefbfe235)
2012-11-14 14:33:31 -05:00
Zev Benjamin 150a800b95 Don't reject mirrored stream messages because they don't have a recipient field
(imported from commit 1677ad91dc2e470c02a01a553d9d07789199a8d9)
2012-11-13 20:22:37 -05:00
Keegan McAllister 42a5ea9d2e Specify requests.post data as a dict
These were lists of pairs because we were going to repeat keys, but that didn't
work anyway.

(imported from commit 687b3f7b8a2821d057719c725f1f39db3992ae5c)
2012-11-13 17:33:41 -05:00
Keegan McAllister f82e8fc4d1 Move Markdown rendering out of the Tornado server
(imported from commit fc726939aa1061c40b292899dbbc9ade3b29ea01)
2012-11-13 17:33:41 -05:00
Zev Benjamin 9c99e00228 Normalize the sender email while we're at it
(imported from commit 1c245156809da77b4bef7a4396e8c0bee5724490)
2012-11-13 17:25:13 -05:00
Zev Benjamin 57bc0e0b8d Normalize recipient list on the server-side send path
This was causing Zephyr mirroring to break because
create_mirrored_message_users was returning False due to the
same_realm_email check failing.

(imported from commit e6a63160f34ec056461038650b5f8027718e6c63)
2012-11-13 17:25:13 -05:00
Zev Benjamin f851d9437d Turn 2-person huddles between the sender and other user into a personal on the backend
(imported from commit 959e7ea8101dc1d469d62ea2c7c7a65854679833)
2012-11-13 15:40:53 -05:00