Commit Graph

1728 Commits

Author SHA1 Message Date
Leo Franchi 0ae8e28635 Exit without exception if this APNS attempt has no connection
(imported from commit bbdd9f3e11946739459f34b2580e4a7371b158a0)
2015-02-11 07:20:51 +00:00
Leo Franchi d865732e0d Maintain two APNS connections and send correct notifications to each
Now we have 2 different Zulip apps out there, and they are signed with
two certs: Zulip and Dropbox. The Dropbox-signed apps are going to need
to be sent APNS notifications from the appropriate APNS connection

(imported from commit 6db50c5811847db4f08e5c997c7bbb4b46cfc462)
2015-02-11 06:57:25 +00:00
Leo Franchi 1c22b48bb1 Add an optional ios_app_id field to PushDeviceToken
(imported from commit 32d6efd1ecc58297b83e515350e6daac3bce8469)
2015-02-11 06:57:22 +00:00
Leo Franchi 64a0b86917 pagerdudy -> pagerduty
(imported from commit 7cd25db67a8b20875edceafe881c872061a48fab)
2015-02-10 07:25:46 +00:00
Jason Michalski 3ad140e5a7 Convert all template strings to unicode
(imported from commit ddf60d53d30a02e1bb87fac35bb45768d17e378c)
2015-02-08 22:12:33 -08:00
Jason Michalski 179bf06940 The subject is an optional field in the pagerduty API
Pages from MP are using the description field not the subject field.
Include both in the page if given and don't fail if the key is missing.

(imported from commit 4351e5656d4ea025a03c07c8bb3bb5d406ef2d3d)
2015-02-08 21:30:19 -08:00
Jason Michalski 2c1ef7d89e Remove failing missed message test
We disabled missed messages for the zulip realm and this test was
failing.

(imported from commit c37d301ac98c38495ff16e95d773f3d6d700772d)
2015-02-07 18:16:12 -08:00
Jason Michalski f4239d60ca Add pagerduty webhook
(imported from commit 06219066b423f53d08094f3f97a98016e145b2a7)
2015-02-07 18:16:11 -08:00
Jason Michalski 1eebcb472d Only allow users in the OG zuliper list to send cross realm PMs
Changes from allowing all of the zulip realms to a whitelist of users.

(imported from commit 5ad2db9a62b430ef2c9d867e4afdf661b11ae96a)
2015-01-30 23:39:47 -08:00
Zev Benjamin 2c760ae735 Remove mixpanel
(imported from commit 9b6cc58ee9be483db8bf2d2eaaaecabc14f821e4)
2015-02-06 13:59:30 -08:00
Luke Faraone a901677be1 Use a unicode string when grabbing SSO unames
(imported from commit 5742147003928e2207d9eac8704aa6090fb8cb8a)
2015-02-06 09:56:39 -08:00
Jason Michalski 6ba5271824 Fix the SSO path to support mirror dummies
The SSO flow which was never used on a realm with mirror dummies before.
Also change the redirect to stay on the same doain.

(imported from commit 0f1b8a8fcef82ae6eaa5a264686f98d62a683fac)
2015-01-30 20:07:13 -08:00
Jason Michalski bb9ced6e57 Redirect users on the dropbox realm from stage to prod
This commit should only be pushed to stage after c290b630e has been
pushed to prod otherwise it will create a redirect loop.

(imported from commit 408407b845ded596705b1abd8ad13c0aedf6d732)
2015-02-06 00:07:06 -05:00
Jason Michalski 7b82db214c Update the last SSO redirect to use the host header as well
(imported from commit 4392543d5ea4fd4c29c221338e8c5f7919e40b7c)
2015-02-05 23:49:33 -05:00
Jason Michalski 01d018ba31 Change the other use of EXTERNAL_HOST in the oauth2 flow
(imported from commit ff92fcbb43ee19bb2b1520e68c5f6768649246f5)
2015-02-05 23:32:59 -05:00
Jason Michalski 35d22949ed Build the oauth redirect url with the host from the request
(imported from commit 972fed686b556bc8845cf7ae5bca555dc9cbeb13)
2015-02-05 23:14:04 -05:00
Jason Michalski 7e9c121ad3 Use the full_name if available
We were trying to default the users first name when using google auth,
but it was getting lost when rendering the form.

(imported from commit 710e0c2ce591488920458dca74209c75e7031abd)
2015-02-05 21:54:28 -05:00
Jason Michalski 439b86fe3b Migrate the google SSO from openid to oauth2
(imported from commit 6938c1cc5d245cc5642043279470365ff04df903)
2015-02-05 21:54:28 -05:00
Jason Michalski b3461ac3b5 Skip a failing dropbox test
The url format changed so this dropbox bugdown test is now failing.

(imported from commit cdd770b05d16ce3cb47aa93ba134227a5f82349c)
2015-02-05 21:47:59 -05:00
Tim Abbott 4f1388706c Disable digests and Missed Message notifications for internal realm.
(imported from commit 24a25bcf6653c674ac8a34324a4674e438f0af38)
2015-02-05 18:40:13 -08:00
Tim Abbott 1dbe00f164 Clean up indentation in do_send_messagemessage_events.
(imported from commit 010f0087693b1cf56bff380737e0070f476ca61a)
2015-02-05 18:40:13 -08:00
Leo Franchi a5063cf046 Dropbox domain is zulip.com
(imported from commit 73e9196783eaba7c62f5668e373bb1b5d372663e)
2015-02-05 15:30:08 -08:00
Jason Michalski 693857a1f8 Flip the prod to stage redirect for the armooo@dropbox.com
This change will redirect armooo@dropbox.com from stage to prod. It also
removes the prod to stage redirect for all users. This will be rolled
out in two commits to prevent a redirect loop.

(imported from commit c290b630e746f757429b8bbdadbe7768367a5e33)
2015-02-05 17:19:14 -05:00
Tim Abbott eb1631f78d Set session cookie domain for *.e.zulip.com hostnames.
(imported from commit 42b15de3b4576341304041588ffaceac6f40baaf)
2015-01-15 21:09:52 -08:00
Tim Abbott 7e786d5426 Import default session middleware as start for custom session middleware.
(imported from commit 76aae367ab6ea5c2a7b0d98368482a3cb312b217)
2015-01-15 21:09:52 -08:00
Luke Faraone f2e7f4cb67 Revert "Exclude dormant users from the buddy list."
Resolves a AmbiguousTimeError.

Approved by Leo.

This reverts commit ebfaeb97ffda22b618be7a9206877f9d2ec53404.

(imported from commit 42b29c6c57eb954952a740bc89611031cef1834a)
2014-12-16 22:56:45 -08:00
Zev Benjamin f63ee86730 Fix login popup on cross-realm authenticated content previews
We were serving 401s on /user_uploads when the user wasn't authenticated (due to
it being a REST endpoint).  This was causing a login popup to display instead of
just a broken image preview.

(imported from commit 62640f5bd59eb3b86ab5aae5923ccfa742459805)
2014-10-29 17:53:05 -07:00
Steve Howell 187469ea86 Exclude dormant users from the buddy list.
You must have accessed Zulip in the last 45 days to show up
on the list.

(imported from commit ebfaeb97ffda22b618be7a9206877f9d2ec53404)
2014-10-06 15:27:56 -07:00
Steve Howell 6b1adf11f7 Disable stream desktop notifications for new Dropbox users.
(imported from commit 42deed48a2d475912041829a700fea4217868e9e)
2014-10-06 15:27:55 -07:00
Jason Michalski 718a6ea697 Fix the message count in missed message email
Missed message email were including the context messages in the number
of messages you were mentioned in.

(imported from commit 1749c5d272d2e17d6e28456ace932f80715103a3)
2014-10-06 15:27:54 -07:00
Jason Michalski a2c1fca488 Fix a dropbox preview test
Dropbox changed the format of the preview image URLs

(imported from commit a4f5690155e98c526142462ad80f8b5cb4ee21a4)
2014-10-06 15:27:54 -07:00
Jason Michalski 23ef278d29 Allow replying to missed PM emails on the zulip.com realm
* Fixes a few bugs with missed message address for PMs and huddles.
* Uses missed message address for all missed message reply-to headers on
  the zulip.com realm.

(imported from commit 61dd09386e1bbdf9a5096e2400984d31e73a5b74)
2014-10-06 15:27:54 -07:00
Jason Michalski 0726ec5931 Fix a bug when uses_left starts out larger than 1
(imported from commit cc08b63912c3188eeddbeee7ae73ae73143ec6ab)
2014-10-06 15:27:54 -07:00
Jason Michalski 2a5ec20295 Add support for one time use email address
The one time use address are a unique token which maps to stored stated
in redis. We store the user_id, recipient_id, and subject. When an email
is received at this address it is sent to the stored recipient by the
stored user. Anyone with this address can send a single message as this
user.

(imported from commit 4219417bdc30c033a6cf7a0c7c0939f7d0308144)
2014-10-06 15:27:54 -07:00
Jason Michalski 52944622f8 Split missed message emails by recipient
Send a different missed message email for each recipient. This allows us
to set a different reply to address for each one. PMs and huddles use
the existing logic, replies will be sent to all parties via email.
Missed @-mention emails will have the reply to address set to the
stream's email address.

(imported from commit bfb7cf7c1382adbf3720caa74cbb927c10dea267)
2014-10-06 15:27:53 -07:00
Zev Benjamin 7411ce9092 Fix Github webhook exclude_* options.
We were expecting Github to send us the string "true" when the exclude_* options
were set.  However, we were actually getting "1" when an option was set and the
empty string when unset.  So we were always setting the options to False.

(imported from commit 067ba60b0b0404aebc6eda9487b1201fc2764243)
2014-10-06 15:27:53 -07:00
Waseem Daher 569abda653 Host "preview failed" image locally.
Who knows when this Cloudfront URL will stop working!

(imported from commit 39f2908a32c0276b1d87ecedc876c71dd35a9b2f)
2014-07-29 21:46:35 -07:00
Paul Ruan 12cb8ceae0 Time out when waiting for OpenGraph links that take too long.
One common place that this happens (for us) is on a local
Dropbox .dev.corp.dropbox.com instance, which can't be reached
by the Zulip servers.

This commit also:
* Fixes the test suite
* Properly previews /photos/ links

(imported from commit b4788b6236e7a9d390e1efc4673be34d9ba5e091)
2014-07-29 21:46:35 -07:00
Jason Michalski 748fb9afe5 Add avatar_url to v1/users
(imported from commit c89b85e1826dc3fbfdd65ec0529dd364b5e463d5)
2014-07-29 21:46:35 -07:00
Jason Michalski 94ec1f3741 Better previews for dropbox shmodel.
Getting previews for docs using open-graph protocol images.

(imported from commit 11a9b446eeb5786fdbf536681a100f43ad6db978)
2014-07-29 21:46:34 -07:00
Waseem Daher 6ff3070c8e Fix test related to bots form.
After I reverted the change to the bot stetings page, this
broke a test. This commit fixes that.

(imported from commit 394b29fea4f75096f7cb8d819145a9adc386276b)
2014-07-29 21:46:34 -07:00
Jason Michalski 6b13f4a3c9 Update message events to include is_mirror_dummy
This can be used by mirroring scripts to only forward messages to users
who do not zulip accounts.

(imported from commit 200d6bcaaf39238bfb01480a9e906d567d4d9e11)
2014-07-29 21:46:34 -07:00
Luke Faraone 5147b52267 Return correct OPTIONS in rest_dispatch
(imported from commit 095175cad4df982d2bf5603f3b927a3aa6d7f41f)
2014-07-29 21:46:34 -07:00
Waseem Daher a54d50ab2d Initial steps towards whitelabeling new realms.
Truthfully, the actual way to do this is going to be a bit
more involved and also involves changing Realm.NOTIFICATION_STREAM_NAME,
probably on a realm-by-realm basis.

(imported from commit b6a05849d215e07ee6716d116ff5e2c819d5b4be)
2014-07-29 21:46:34 -07:00
Waseem Daher 307d367346 Initial support for white-labeling Zulip as "Dropbox Chat" or otherwise.
Known issues:
* No support for whitelabeling in the email
* No whitelabeling for any externally-visible branding

(imported from commit 9eab7b0744e56a87007b8621a8bb18bbb1080256)
2014-07-29 21:46:33 -07:00
Jason Michalski 710a802f49 Add context to at mention missed messages
When you are at mentioned in a stream we will now send you up to the
last five messages which were sent in the past 5 minutes on the same
topic and stream.

(imported from commit 6df6c1cf868722a7bf76e54710e38741a7ac8f31)
2014-07-15 20:21:28 -07:00
Jason Michalski 0ea54a043e Use settings.EXTERNAL_HOST when sending activation emails
Activation emails were using django's sites framework which always has
the domain set to zulip.com.

(imported from commit b81eae96e1a75b64dd93970760b869f3271ce88c)
2014-07-03 12:28:29 -04:00
Tim Abbott 6ac6fd5e56 Remove requirement that local_id by a float in local echo.
(imported from commit c3de78760c1c7e11c6791719420b59df604d5319)
2014-06-25 11:44:16 -07:00
acrefoot 0b9884ce5b add issues traffic to the CUSTOMER17 stream
The default today is to not have issues traffic except on a whitelist. This is despite the fact that we have
an exclude_issues boolean on Github's Zulip-integration page, since if we changed the default, all realms
currently using this default would have to go make this change on every repo. That's something that would require
some work, in terms of communicating with them about this, and logging integrations settings for all realms, to
see which are correctly setting exclude issues. Unfortunately this probably isn't high priority today, but let's
try to get this whitelist change out to prod ASAP.

(imported from commit 256fe32bb6aaf7de18ff02d8d7e204a13bc02b7a)
2014-06-09 08:30:10 -07:00
Jason Michalski 8c72eddb72 Add a warning when in the zulip.com realm on production
Display a red warning box to get users to direct users to staging for
the zulip.com (dropbox) realm.

(imported from commit 01ad4209d9247406bc82f5dedaf21371101a1d84)
2014-05-21 13:13:27 -07:00
Zev Benjamin 298e008cc2 [manual] Turn off GIN fast update for zephyr_message_search_tsvector
Apply this commit after hours!

To apply this commit, first run the migration and then run the following as the
zulip user on staging:

$ echo 'VACUUM zerver_message' | python manage.py dbshell

The above VACUUM is needed to clean out the existing fast update pending list.
It might take a long time and block new message inserts!

See discussion near Zulip message 18377486 for why we're turning off the fast
update mechanism for zephyr_message_search_tsvector.

The high level overview is:
As a consequence of the high work_mem setting on our postgres server, the
fastupdate pending list for zephyr_message_search_tsvector can grow very large.
This leads to the occasional INSERT or UPDATE taking inordinately long (many
minutes) as the pending list is flushed, blocking other inserts.

One other possible solution for preventing the list from growing too large is to
set the autovacuum storage parameters on the table such that the autovacuum
process will run after a reasonable number of INSERTs or UPDATEs.  However, the
table is mostly INSERT-only.  Therefore, only the autovacuum_analyze_*
parameters will actually do anything to affect when the autovacuumer will run,
but when it does, it will do a VACUUM ANALYZE instead of a plain VACUUM.  We
don't particularly need the table to be re-analyzed that often.

Turning off fast update will eventually cause the index to become less
efficient, but we can always rebuild it later if we notice it starting to get
too slow.

(imported from commit f280c193c3bc0a3f312960510c5a7dcf97f30c3d)
2014-05-20 22:38:48 -07:00
Tolga Tezel 410e557bad fix old messages tests to use dynamic sql queries - ids were hardcoded.
(imported from commit 533872f5bebc1068925591c9381463a7c9317482)
2014-05-07 14:06:59 -07:00
Tolga Tezel 8b1199ee35 Add support for creating users with a specific ID.
(imported from commit 9a3438924cab8477a9c2494af1b5c2d32783e71c)
2014-05-07 14:06:59 -07:00
Luke Faraone 8f8b2519ea Redirect legacy URLs to their new secure location.
URLs with a realm of "unk" will be queried against the new bucket to
determine the relevant realm of the uploading user.

(imported from commit 5d39801951face3cc33c46a61246ba434862a808)
2014-05-05 20:26:29 -07:00
Tim Abbott 8b74a3e052 Remove unauthenticated file upload support from Zulip.
(imported from commit 97262590ac5ad56c18f415fa1c777510aed2baeb)
2014-05-05 16:14:09 -07:00
Tim Abbott f7535a0a1b Fix traceback sending bot messages to invite-only stream.
(imported from commit b9af67e87d8b7d52bddb8fa576af8fe9326ba13c)
2014-05-02 15:49:50 -07:00
Tim Abbott 0494e40c39 Merge zerver/tornado_callbacks.py into zerver/lib/event_queue.py.
It had stopped being a coherently distinct component a while ago.

(imported from commit 0617957bcfe8dcaf69143c88a96ddd51ecb31a98)
2014-04-23 17:22:31 -07:00
Zev Benjamin 3498a04613 Call authenticate() when logging users in via JWT
Otherwise the user_profile.backend attribute doesn't get set.  I didn't notice
this previously because on first register authenticate() gets called, and then
the UserProfile object gets cached.  This means that subsequent logins work just
fine as long as the UserProfile object is in memcached.

(imported from commit 834d95c46aa07724ea84802f09b7249de99b5ca8)
2014-04-07 11:01:38 -07:00
Zev Benjamin 5b080bd0cf Fix one name_changes_disabled check
(imported from commit f1bf125949bd282c8a9054d3e3b2e92c7bd5ab4e)
2014-04-06 17:00:28 -07:00
Zev Benjamin 2f7af69091 Add customizations for CUSTOMER16 employees' realm
CUSTOMER16 wants their employee realm to:
* only use JWT logins
* have name changes be disabled (they want users' full names to be the
  their CUSTOMER16 user name).
* not show the suggestion that users download the desktop app

(imported from commit cb5f72c993ddc26132ce50165bb68c3000276de0)
2014-04-04 16:51:32 -07:00
Zev Benjamin bd3f1c6a9e Add JSON web token (JWT) authentication
We currently expect the use of HMAC SHA-256, although there shouldn't be
anything preventing us from using other algorithms.

(imported from commit 354510a0b7e9e273d062a1ab5b2b03d4a749d6a3)
2014-04-04 16:51:32 -07:00
Zev Benjamin 04f211bbff Refactor some of the remote user handling
(imported from commit 13facd7afddfb018af39b39ee48c644d355d8ec3)
2014-04-04 16:51:32 -07:00
Zev Benjamin 2e1d5ffd1c Make password_auth_enabled() take a realm object
This will actually be used in an upcoming commit.

(imported from commit 5d3db685a245899b2523440398f2ed2f0cfec4f4)
2014-04-04 16:51:32 -07:00
Zev Benjamin 6759a78d07 Remove extraneous (and incorrect) realm lookup
(imported from commit 9c618c50b0f27795c91da172d5bc63dd5d5f2e61)
2014-04-04 16:51:31 -07:00
Zev Benjamin 3fc779278b Use EXTERNAL_URI_SCHEME instead of hard-coding 'https'
(imported from commit 3a4d2e0591debd7d5e4b5650b050a1eb1d86aa55)
2014-04-04 16:51:31 -07:00
Zev Benjamin 9114715030 Factor out the check for whether name changes are disabled
(imported from commit 56ddd9cf53ec49e2e096abe82ed44f758912272e)
2014-04-04 16:51:31 -07:00
Jason Michalski 80db1b9feb Fix test to not depend on timezones
Use UTC milliseconds from epoch not string formated time in tests.

(imported from commit c1f23367fd9e4d9b11a8fd58efb8b4b4b6980552)
2014-04-01 20:57:06 -07:00
Jason Michalski 55e762b069 Fix bug with date separators when prepending messages
When the date changes between an existing group and a new group the
existing date separator needs to be updated. This is done by rerendering
the existing group.

(imported from commit a3775815e33872b0ec07704dc7ccf5fd2671fa21)
2014-03-29 22:00:00 -04:00
Jason Michalski 94279c0522 is_me_message is an attribute of the message not the message_container
(imported from commit db36e529de92a82bb9c5df97030833ca2e3e0f80)
2014-03-19 11:43:32 -04:00
Luke Faraone 0a1d142d69 Refer to correct settings variable in email_mirror.py
(imported from commit c4e8b9ef417d8ba3c4db9692f4720b1cc1dc17a0)
2014-03-18 23:37:19 -04:00
Jason Michalski 3158075405 Use the match data on the message not the message_container
(imported from commit 1289108c767732c76efc7369206ef065f2395e0d)
2014-03-18 18:24:23 -04:00
Jason Michalski e60f76487f Rename message to message_container
Now that we are not directly using message in the message list view
rename the uses of message that are message_containers.

(imported from commit 5c355703a8934a74864f5de6ecb1e2fd851e5d41)
2014-03-18 15:05:39 -04:00
Jason Michalski 1613cad6f6 Separate the global message data from the list display data
The messages being passed to the handlebars templates were global
messages which we were adding per list details to, show name bar etc.
This causes rendering bugs when you try to rerender a message, because a
different list may have changed it. This commit moves the global message
data to a msg attribute on the message_container which will contain the
per list attributes.

(imported from commit 26b1f0d2c72d6288a6d3e7ed5f8692426f2a97ad)
2014-03-18 15:02:31 -04:00
Luke Faraone e6bb683922 Suppress presence changes to IDLE until timeout
This way if two browsers are disagreeing about your active status, the
active one wins. The active browser continues to update your timestamp,
and the idle browser's changes are discarded until the timestamp on your
active status expires.

(imported from commit dc29e013d045c4b72793097f611ba6802c58e57a)
2014-03-17 14:27:20 -04:00
Jason Michalski c38c9cf894 Me messages should always display the sender
(imported from commit af42ed8dcb9f4bc44e66d4973b9e613302647e12)
2014-03-16 15:14:57 -04:00
Jason Michalski a9235a74f4 Split the group merging logic form the DOM update logic
The goal is to have a more data centric piece that can be unit tested.
We also try to minimise the number of one off jQuery DOM updates and
rerender handlebars fragments instead. This will prevent the
message_group and DOM from drifting apart and not being able to rerender
correctly.

(imported from commit 03f09803f2bc0c3b8187f76f2cfe90be9f7512a3)
2014-03-14 20:48:59 -04:00
Luke Faraone bba2eb7622 Send missedmessage notifications as soon as you're idle or offline
Previously, you'd have to be offline to recieve missedmessage
notifications, or maybe idle for an hour. However, I'm pretty sure the
latter code didn't actually work, so we scrap that and just nofity you
via email or push as soon as you're idle.

Closes trac #2350

(imported from commit 899966e0514db575b9640a96865639201824b579)
2014-03-14 20:48:57 -04:00
Tim Abbott 5bb4a74ec0 Don't log warnings about various known-unsupported Pivotal event types.
(imported from commit e2044e06c02bc745608fe637ce44d683c5badcd8)
2014-03-14 20:48:57 -04:00
Tim Abbott 6850835273 Improve handling of unknown JIRA event types.
(imported from commit d9f823dc80b26a71f7b3a891559d2360d76a258f)
2014-03-14 20:48:56 -04:00
Tim Abbott 9aa3de0664 Fix GitHub tracebacks from issue['pull_request'] not existing.
(imported from commit f124a8e30e25d9321e9abe2fe04a5bd35ce24445)
2014-03-14 20:48:56 -04:00
Tim Abbott 400e355a2f Fix passing string as user_profile to upload_message_image.
(imported from commit b4841ef30527da6856482899d2e709cd528ff181)
2014-03-14 20:48:56 -04:00
Steve Howell 77e7947f61 Add test_random_int()
(imported from commit 67ab9436463b3b4ff63f657fd8cd60cdd25f6047)
2014-03-14 20:48:55 -04:00
Steve Howell 23e791a3b9 Enhance test_array_compare().
(imported from commit c6d44acd2804005a41afe6b283e11905b7e4c7c0)
2014-03-14 20:48:54 -04:00
Steve Howell a8d61fa930 Add test_normalize_recipients.
(imported from commit 9645cb471f8db01e810c9b6c396313ee4c1cf97f)
2014-03-14 20:48:54 -04:00
Steve Howell 84fc8f16dd Add test coverage for util.same_major_recipient.
(imported from commit 0b345679d2bf40c82167ded9968dd653823011bf)
2014-03-14 20:48:54 -04:00
Steve Howell b12b44579c Set up $.fn.expectOne in setup.js
(imported from commit 77922cf8f506d4eb811498d418215eabf74b76ae)
2014-03-14 20:48:53 -04:00
Steve Howell 0e129614cf Remove unused util.recipient_key() function.
(imported from commit cee6a58344971ee1439e6b66ec301f1bd0f80502)
2014-03-14 20:48:53 -04:00
Steve Howell 3dc9ee182f Add test for people.reify()
(imported from commit 3ad061ba52c1fd7fa2c2a053e91de87117370dd6)
2014-03-14 20:48:48 -04:00
Steve Howell cbb5878477 Test people.remove() only removes one person.
(imported from commit 7cd21cd9e4b99d0542bf81737a1c16a346ecc37e)
2014-03-14 20:48:47 -04:00
Leo Franchi 065fcf1a1b Handle out-of-order local ids in message_list
(imported from commit e805837d7d2790be90490cc9ec9415882ff9b549)
2014-03-14 20:48:47 -04:00
Steve Howell 44bb9d58d1 Test startup logic in bot_data.js
(imported from commit 6410c584c2e1d8027a276902c67f34ee6a284e6f)
2014-03-14 20:48:46 -04:00
Steve Howell 72964a2194 Recognize humbug-user-uploads-test for images/attachements.
(imported from commit 8596a5c4bad6e1adbfe97cbe057d1bd6d8e7f530)
2014-03-14 20:48:45 -04:00
Steve Howell d2f773a99d Handle empty Message table in act_on_message_ranges.
(imported from commit 609b0f531c4af23ddb6f3e5760dc9d251f1a4d3d)
2014-03-14 20:48:44 -04:00
Steve Howell fa37ac1d73 Add act_on_message_ranges() migration helper.
(imported from commit 9e6567c1a12a7d8e447ed80ee08723376eaee6fe)
2014-03-12 21:15:23 -04:00
Steve Howell d4fa917c49 Add has_topic() helper to filter.js
(imported from commit 8d8d9c2b6638968b18c7603e070c001d6b16cf21)
2014-03-12 21:15:22 -04:00
Steve Howell 0376d26c79 Add filter_with_new_topic() method.
(imported from commit 2ed9261ec70edf0a4ee1a25989cabfa9ab7907fd)
2014-03-12 21:15:22 -04:00
Steve Howell da66220524 Add propagate_mode to event for topic updates.
(imported from commit c5bd140a46db5b6bc4164c21bcb698776fb0d786)
2014-03-12 21:15:21 -04:00
Steve Howell 9648fd1f9a Add stream_id to event for topic updates.
(imported from commit 2c0ff291672a2576e5812d8c3abdb71256ada61f)
2014-03-12 21:15:21 -04:00
Steve Howell 7a509af38b Add testing for update_message events.
(imported from commit 014cc8f3ed4c56108105e69f17d4894a0bf56c37)
2014-03-12 21:15:20 -04:00
Steve Howell dfc34eb074 Allow negated has:* searches.
Before this change, we were incorrectly trying to do local
filtering on negated has searches.

(imported from commit d1a6f1feef6b3cc1c984eb91a73cd16c4e66874e)
2014-03-12 21:15:20 -04:00
Steve Howell 24c23c2290 Remove unused json_to_bool().
(imported from commit 72f0db5f623ae9a06ffad2882bcad0e74ceaf884)
2014-03-12 21:15:17 -04:00
Luke Faraone f4196ed6ef Don't allow sending messages to deactivated users or realms
We still don't show this in the frontend, aside from our usual "Not
delivered" message that we also show when you send to a non-existent
user.

Addresses #2349

(imported from commit 2f348b15a4d539987ddbcccbbf40e2be87c1f92d)
2014-03-11 15:11:53 -04:00
Luke Faraone 9ea3198ddf Reject API key usage by users from deactivated realms
(imported from commit f1c791943f62bdde841ebb6975daef60e5a19174)
2014-03-11 15:11:52 -04:00
Luke Faraone bd20a756f9 Show a mobile icon in the presence list when relevant
We show a user as "on mobile" if:
 * They are only active on mobile
 * They are inactive on all devices and can receive push notifications

(imported from commit 0510b9371727cd19c72f6990df7112921c36ad48)
2014-03-11 13:06:23 -04:00
Zev Benjamin bdee9721ec tests: Delay loading old messages and starting get_updates until phantomjs thinks the page has loaded
This doesn't affect code when not in testing.  It shaves 7 seconds off of casper
test time on my machine.

(imported from commit 7e27fa781bcf16f36d9c8f058427ba57c41068bd)
2014-03-11 13:06:22 -04:00
Zev Benjamin dfa45a3689 tests: Wait until we've actually logged in to try to log out
(imported from commit f1a29520fdb868a91cf5145be49542c8db9b4316)
2014-03-11 13:06:22 -04:00
Zev Benjamin d6f01ed7b9 tests: Clear phantomjs local storage before starting tests
(imported from commit 83ee6f1c95a6f1e4005b36af6be2d60f70c81a1d)
2014-03-11 13:06:22 -04:00
Zev Benjamin 917a4363e7 tests: Only initialize casper once
(imported from commit 849b8cfc0545fb0ff51dbfc32d2bc6081c0a5215)
2014-03-11 13:06:22 -04:00
Zev Benjamin 0fbfbf488b tests: Remove dead test
(imported from commit a85a0877c21b0eba5cdf708fc8d264b11f7a3fd9)
2014-03-11 13:06:22 -04:00
Zev Benjamin e9acdd147f tests: Don't try to edit locally echoed messages
(imported from commit 04760e67b1c18766dc23072b4a735d8cb28a658b)
2014-03-11 13:06:21 -04:00
Zev Benjamin 2f01e9c51d tests: Use then_send_many
(imported from commit 228ee697a54643912eb3846d48c78e4464193632)
2014-03-11 13:06:21 -04:00
Zev Benjamin 719d551de6 tests: Always wait before sending messages
(imported from commit 1860f994b5698ba39ec9b45564c283f932d7502e)
2014-03-11 13:06:21 -04:00
Zev Benjamin 5fd58cf249 casperjs: Immediately check the condition in waitFor and don't wait after the condition is true
Normally, casper delays checking the waitFor condition for 100 milliseconds and
further does not act on that check for another 100 milliseconds.  This is just
silly.

(imported from commit ad046ceda81abda5c609ce25ef0d4fb27d3da716)
2014-03-11 13:06:21 -04:00
Zev Benjamin 39f632134d tests: Rename casper helpers for clarity
send_message -> then_send_message
send_many -> then_send_many
wait_and_send -> then_wait_and_send

Hopefully this makes it clearer that they should not be called inside of steps.

(imported from commit 4fcc971817b25056100311ba55303da2c5527f0f)
2014-03-11 13:06:21 -04:00
Zev Benjamin 0ccb794007 tests: Don't add new steps during execution
Casper can technically handle it, but it's cleaner to create all steps ahead of
time.

(imported from commit 37cda128818d663f57b6e2282a781e8d099fa77d)
2014-03-11 13:06:20 -04:00
Zev Benjamin 80ca037747 tests: Correctly wait for a message to be visible
I'm not sure how it worked at all before.

(imported from commit 608b0574d1a80cd631d9ea8198990d97d72ba64d)
2014-03-11 13:06:20 -04:00
Zev Benjamin c7586a7135 casperjs: Correctly call the `then` callback in Casper.waitFor
Casper was calling casper.then(then) instead of calling the callback directly.
This meant that the callback was being added as a step, which worked, but was
not consistent with the rest of the casper model.

(imported from commit b3bf916f7c56dd3d4e7be3569ebdf9d3045cd085)
2014-03-11 13:06:20 -04:00
Waseem Daher ef23a4efe4 Disable authed uploads for zulip.com.
(imported from commit 3c432e730005e4c8404245c974b53c5a49fd4c9d)
2014-03-11 13:06:19 -04:00
Luke Faraone 2d3a7e5418 Use a different status code and include seconds remaining header in ratelimits
This will make it slightly easier to consume the data from our clients.

Ref:
    RFC 6585 §4

(imported from commit 6d323dc25db78a6d84a163add950f039e03e73d3)
2014-03-11 13:06:19 -04:00
Steve Howell 105c742e92 Correctly identify images/attachments on humbug-user-uploads.
(imported from commit 081d00d99672e6b938c60d9e13665e21d935d8ef)
2014-03-11 13:06:18 -04:00
acrefoot c3543b06f0 Honor exclude_commits for github integration
We weren't before :(

(imported from commit 3691066a50f1b67c227dbfc056dc8cdf2c06eea8)
2014-03-11 13:06:18 -04:00
Steve Howell 0eda5cbfec Add event schema checks to misc event tests.
(imported from commit 1c17f972cdd91b8da2169e1cb1cef817f683dd29)
2014-03-11 13:06:17 -04:00
Steve Howell 52478d684c Rename build_update_checker to realm_bot_schema.
(imported from commit ed75e9228a85c5e15290fdd31a0dbbd84327aae9)
2014-03-11 13:06:17 -04:00
Steve Howell 97511067df Sort imports in test_events.py.
(imported from commit 85443b002a3e9231a98d0d1cc85a56e949748ea3)
2014-03-11 13:06:17 -04:00
Leo Franchi 9d8758557b Use global match in alert word regex to match all matches
(imported from commit aaec296ad6b18b20c1c2d1cb017cffef8e3e0512)
2014-03-11 13:06:16 -04:00
Leo Franchi 65b6c80f07 Don't highlight alert words that are in URLs, breaking them
(imported from commit e20ee33a1687f935482f48f829c19a1606ce6db1)
2014-03-11 13:06:16 -04:00
Zev Benjamin eda05d23bf Optimize get_occupied_streams
In a test run with a hand-constructed query, this sped up the query time from
280ms to 50ms.

(imported from commit 8cbe199ca50a487491d13d6d6ef940ea668c1038)
2014-03-11 13:06:15 -04:00
Zev Benjamin 27aaa3b1bf Rename mit_to_mit -> same_realm_zephyr_user for uniformity and clarity
(imported from commit 74063d6c8bb9e9fbf62c24dcd8a18294b8f7b51f)
2014-03-06 21:59:55 -05:00
Zev Benjamin cc9fe19a9f Special case Jabber mirroring same-realm check for ist.mit.edu
We can't just check that the realms are the same because ist.mit.edu is an open
realm and uses @mit.edu email addresses.

(imported from commit 7dbaa81cea6e4f82563dfc0cfe67a61fe9378911)
2014-03-06 21:59:55 -05:00
Steve Howell 8f37c3f5fd Tolerate spaces after language in markdown fences.
See #2357.  We now support `~~~ .py ` with that trailing space.

Note that the test coverage is Python-side only due to
bugdown_matches_marked being set to false, since we don't yet
support language syntax on the client side.

(imported from commit ccd5fcb0eee01478d349161400103480678d7486)
2014-03-06 10:15:20 -05:00
Waseem Daher a9f01e382a Switch streams page over to use consistent buttons.
(imported from commit c4d7f658f361a759a38951349e027ac3e279fe9b)
2014-03-05 17:23:23 -05:00
Leo Franchi 05d911b913 Allow auto-linked URLs to end with a !, without including the ! in the url
(imported from commit 26fbf8d8318dc32f31f94f366750521afab94ac5)
2014-03-05 15:22:05 -05:00
Steve Howell 957486cc95 Fix support for searches like "in:home search:foo".
Previously, if you searched for "in:home search:foo", we
weren't making "in:home" a public operator, so the back end
wouldn't know to exclude muted messages, but the front end
also wouldn't exclude muted messages, because it assumed
that queries with "search:" in them were fully narrowed by
the back end.

Prior commits made it so that the back end is now capable
of doing "in:home" narrowing, so to get the properly narrowed
results, we simply needed to make in:home be a public operator
in this commit.  We also made in:all be public for convenience,
although it's essentially a no-op.

(imported from commit e4a8b10813b50163c431b1721bd316b676be1b83)
2014-03-05 14:56:35 -05:00
Steve Howell e7769d9004 Add back end support for in-home/in-all narrows.
(imported from commit bfa54fbb8c7eaced19e354514536d75c30a24b15)
2014-03-05 14:56:34 -05:00
Jason Michalski fa37e91e5c Add admin status to bot_data
(imported from commit 47b84b3ef1e97e355dee84f0595e94a4612bf4df)
2014-03-05 14:16:20 -05:00
Jason Michalski 3f6e53db6e Add bot_data module that updated with events
(imported from commit b0bd714258132fc81db763d316a15f5a81b1f4ff)
2014-03-05 14:16:20 -05:00
Jason Michalski 86175e8627 Add events for bots disabling bots
(imported from commit 9de3410555a45038c31341b3857782ffc8246cf7)
2014-03-05 14:16:20 -05:00
Jason Michalski 0165da405f Add events for bot default_events_register_stream changes
(imported from commit 143ed5b110a7f3b37f145dcd3fbe9133a183c7ec)
2014-03-05 14:16:20 -05:00
Jason Michalski f66d864f45 Add event for bot default_sending_stream changes
(imported from commit 7a859cf9f51b6ec1bacb1e3b3cfa9da2c6fbf32f)
2014-03-05 14:16:20 -05:00
Jason Michalski b5ca2631e6 Add event for bot default_all_public_streams changes
(imported from commit f189fb6692cb8c833cc2a1951ad8a4695cc4c27f)
2014-03-05 14:16:20 -05:00
Jason Michalski 3772344e2d Add events for bot avatar_url changes
(imported from commit c058386ce5ef9d89165c44fd853808cfe1f625f4)
2014-03-05 14:16:20 -05:00
Jason Michalski 280575aff0 Refactor json_set_avatar and patch_bot_backend to use do_change_avatar_source
(imported from commit eba0ff8a5c4409ac01c710455fe200b28f953b56)
2014-03-05 14:16:20 -05:00
Jason Michalski c0d104c110 Add events for bot api_key changes
(imported from commit 44e4e374ee4951c4d984c009ef7af825985fabbf)
2014-03-05 14:16:20 -05:00
Jason Michalski 64ba85aa19 Refactor regenerate_api_key and regenerate_bot_api_key to use do_regenerate_api_key
(imported from commit 5c54e4771b6730a8ebe304f6b6e86722d28eca8d)
2014-03-05 14:16:20 -05:00
Jason Michalski b161f4cff9 Add events for bot full_name changes
(imported from commit 7a8945982a060b208c5459a2b3d130eb84a72922)
2014-03-05 14:16:19 -05:00
Jason Michalski c17ed8dc8c Add bots to page_params and send events on bot creation
(imported from commit ce418b4f056576d57f82d26af621473c730c12d8)
2014-03-05 14:16:19 -05:00
Jason Michalski eebbf0d4ee Show the new bot's default stream settings in the edit view
(imported from commit d6f1872e0dedd57ebde31da2caf075804195dfb0)
2014-03-05 14:16:19 -05:00
Jason Michalski 846dfd5105 Update patch bot API to support setting stream defaults
Adds APIs edit a bot's default_to_stream, default_events_register_stream
and default_all_public_streams.

(imported from commit c848a94b7932311143dad770c901d6688c936b6d)
2014-03-05 14:16:18 -05:00
Jason Michalski 50db83508b Add API support for setting defaults in the add bot API
Support setting default_to_stream, default_events_register_stream, and
default_all_public_streams during in the bot creation API.

(imported from commit bef484dd8be9f8aacd65a959594075aea8bdf271)
2014-03-05 14:16:18 -05:00
Jason Michalski f3180b774b [schema] Add default user_profile options for register events
Allow bot owners to set which streams their will receive events for
without needing to change a configuration file.

(imported from commit 2b69e519dbc12ffbdba072031a7f7196c9e50e33)
2014-03-05 14:16:18 -05:00