Commit Graph

1462 Commits

Author SHA1 Message Date
Steve Howell b35b3e584c Move some tests into test_unread.py
(imported from commit 64ed0aa6766462f0d56192ddbf68c09b283cee56)
2014-02-10 13:23:27 -05:00
Steve Howell 639a39aace Move some code into test_decorators.py
(imported from commit 7133c0fe1ae3028098b72ac4e14693e540aac4d7)
2014-02-10 13:23:27 -05:00
Tim Abbott 4891da83ad Fix autolinkification in Zephyr mirrored content.
Apparently the "inline" treeprocessor is what runs the inline
patterns.  Also re-enable the rewriting-to-https support.

(imported from commit 2fde2c1f15217a784f26b16db25ee745f424f2f0)
2014-02-10 13:23:27 -05:00
Steve Howell 72ee636571 Use stream_id as key for subscription removals.
Have the server send down the stream's id for removal
events, and have the client use that id to look up the
stream in its internal data structures.  This sets the
stage for eventually just sending the stream id (and not
the stream name) down to clients, once all our clients
are ready to use the stream id.

(imported from commit 922516c98fb79ffad8ae7da0396646663ca54fd0)
2014-02-10 13:23:27 -05:00
Steve Howell 2fb70eb38c Remove tuples safety net for narrow filters on staging.
We have shim code that makes our internal narrow operators
support both a tuple interface and an object interface.  We
are removing the shim on staging to help expose any dark
corners of the code that still rely on operators being
represented as tuples.

(imported from commit f9d101dbb7f49a4abec14806734b9c86bd93c4e1)
2014-02-10 13:23:27 -05:00
Luke Faraone fe55127eee Override realm of uploading user when invoked via the email mirror
Here, we don't want to check the uploading users' realm when determining
message privacy, because that'll prevent non-Zulip users from having
email-mirror-uploaded images. Instead, we just pass along the target
realm for the message explicitly to upload_message_image()

(imported from commit 6891261552135b1f41ff9da55ffe963ee5000556)
2014-02-07 09:45:57 -08:00
Luke Faraone 1e87e7c5c1 Switch authed_upload_enabled to check for a realm, instead of a UP
This is always a realm setting anyway, and it'll make reuse easier.

(imported from commit c64e1901b60051608cee3cf9a6b3aef8630ae237)
2014-02-07 09:45:57 -08:00
Leo Franchi 8ad2ca15cd bugdown: Match up to 8 groups of nested parens
(imported from commit e3d61ec644fdb293322cab0a4449d8e1a27a513a)
2014-02-06 17:26:01 -05:00
Leo Franchi 1c332f5d6a Standardize on 'subscription' as event type name for subscription changes
Our overall guideline is the type names for events are singular, and the list of
events of that type are plural. 'subscriptions' was not following this guideline
and (potentially as a result) had a bug where it was impossible for clients to explicitly
subscribe to subscription change events properly.

(imported from commit 7b3162141fd673746e0489199966c29ea32ee876)
2014-02-06 17:07:38 -05:00
Steve Howell fc78a2cc66 Stop using tuples in search_suggestions.js and Filter.unparse().
This is yet another change related to phasing out the
[operator, operand] tuple data structure for representing
terms in a narrow.

(imported from commit 508e58fc4eebae8a24a8ae59919ba5d94fc66850)
2014-02-06 16:42:38 -05:00
Steve Howell da858afacf Save on S3 bills by passing validate=False into conn.get_bucket().
(See the comments in the code for details.)

(imported from commit e518b9d89aca8a6358c826bf7e7f03381e0560f4)
2014-02-06 12:14:14 -05:00
Steve Howell 90f6eb0661 Keep track of subs by stream_id inside of stream_data.js.
The JS code can now call stream_data.get_sub_by_id() to get
a sub from a stream_id.  Subs have stream_id due to a prior commit,
and we keep track of the mapping in stream_data's subs_by_stream_id
variable.

(imported from commit 409e13d6d2e79d909441a66c85ee651529d15cd2)
2014-02-06 12:09:52 -05:00
Steve Howell 3a96686cbc Add stream_id to page_params.{subscriptions,unsubscribed}
This isn't used by the client yet, but it should be harmless.

(imported from commit e09ac65ca802f5cf16375b8a93d34e0dfbcb76b4)
2014-02-06 12:09:52 -05:00
Steve Howell 0366659bee Return stream_id in /json/get_public_streams.
(imported from commit 985d4e01bd3b589d10e57886d159cfdabe594dd4)
2014-02-06 12:09:52 -05:00
Steve Howell 583dae72a3 Change how the tutorial overrides the default stream color.
The tutorial introduces "engineering" messages that might not
be in the user's normal subscription, and they would get a gray
border if we did not override the stream color.  Before this change,
we accomplished this by overriding the core data structure in
stream_data.js.  Now we are a bit more future-proof; we only
override stream_color.default_color.

(imported from commit 0d0845b72f766912679f5aa7641ae9a60fdbb4ce)
2014-02-06 12:09:51 -05:00
Tim Abbott ca3430862c More correctly disable markdown processing for Zephyr mirrored messages.
(imported from commit 688eead11c329e93c649ea1633dbf56328b5587b)
2014-02-06 10:25:35 -05:00
Tim Abbott d595714a1c Send Zulip notifications when users fill out our interest form.
(imported from commit 2db4b29df8ac2c4cf1929a3df3015809f3faf895)
2014-02-06 10:25:35 -05:00
Luke Faraone e8834c2a9b Modify email mirror regular expression to match messages sent to any zulip.net server
(imported from commit 733a2ff2586c6c4bbe6536a3c42973726c8adb14)
2014-02-05 17:30:11 -05:00
Jessica McKellar 73fc65eb99 Make enter sends the default.
(imported from commit aa256772b381466f02210881214c9882b78b044d)
2014-02-05 13:35:41 -05:00
Jessica McKellar f3d33c1aa0 Add missing stream field to schema migration 0067.
(imported from commit 005743859f03a1a8a154099a72bfbf50d5db890e)
2014-02-05 13:35:41 -05:00
Leo Franchi c218fc98b1 Add one more bugdown test
(imported from commit 43b2ef02c05faf73e4607f76cd00c67e9ba38b8d)
2014-02-05 12:02:27 -05:00
Jason Michalski 556dfd2724 Convert function creation to lambdas for pylint
(imported from commit be22408c13736c17a38c50d08016d181f5dbc635)
2014-02-05 11:04:48 -05:00
Steve Howell 7449079191 Validate schema of events in EventsRegisterTest.
For EventsRegisterTest that test updates to streams and
subscriptions, we now validate the events generated by
the actions under test conform to predicted schemas.

We define the schemas with help from the validators code
that is also sometimes used to validate incoming request
parameters for our views.

(imported from commit b4222b920a588e15cccee4a2349c074ca9697448)
2014-02-04 16:25:32 -05:00
Jessica McKellar da757b7195 Update copyright to 2014.
(imported from commit 733baed61e26be0c07a7e7a605618087df6b0866)
2014-02-04 15:51:53 -05:00
Steve Howell 20c0afca1d Simplify custom matchers in EventsRegisterTest.
We now use the same custom matcher for all of our EventRegisterTest
tests.  The "state" that we're tracking has three lists that aren't
really order sensitive, so we turn them into dictionaries keyed
by the primary keys in their structs.  Here are the lists:

    realm_users
    subscriptions
    unsubscribed

(imported from commit 53787c56722b69640368c1b5d67d5d4757f84718)
2014-02-04 13:22:19 -05:00
Steve Howell 89ea079dce Allow Filter to accept non-tuple-based terms.
We make this happen inside of canonicalize_term.

(imported from commit 0571f6cac8ffdc806af56423cc98134c7493139e)
2014-02-04 13:16:25 -05:00
Steve Howell 112bc5ceda Rename canonicalize_tuple to canonicalize_term.
(imported from commit 07e0c4a6802b0d4b4fbb8ffd3965cab6457d4aeb)
2014-02-04 13:16:25 -05:00
Steve Howell eea8c0d1d5 Allow admins to change the realm's name in the UI.
(imported from commit 2873f872069a41c91beb87728f64fa526dd8a326)
2014-02-04 11:33:19 -05:00
Steve Howell bf85a3cebc Prevent noops in EventsRegisterTest.
We had a couple tests in EventsRegisterTest that weren't really
testing much, because they were going through codepaths with
authentication problems or actions that didn't affect our
user.  We now assert that the code under test generates
events.

(imported from commit c2f61180cb420d45fa95e137433e9456394bf0ff)
2014-02-03 17:38:23 -05:00
Steve Howell 662459b9e1 Fix do_rename_stream to update the stream's email address.
This change also makes it so that the test_rename_stream()
test exercises the code path.  We need to subscribe the user
to the stream in order to generate events.

(imported from commit 77f965efbf5a766eb8de23486e303fa135b2e638)
2014-02-03 17:38:22 -05:00
Steve Howell cfb2312cb6 Fix test_pointer_events by having it call do_update_pointer.
Before this change, the test_pointer_events test wasn't really
testing anything, because it wasn't getting to do_update_pointer
due to authentication issues and having an invalid message id.

Calling do_update_pointer() directly exercises the events code.

(imported from commit bfac27dcfe659689535f54e0c837427c4f9a8284)
2014-02-03 17:38:21 -05:00
Jason Michalski 0e1909f489 Prevent errors in get_updates_success from stopping the event loop
Add try/catch blocks to get_updates_success and send a blueslip error on
errors we catch. This will let get_updates_success return successfully
so that the next call to get_updates will start immediately.

(imported from commit 44d8b85d9d8e930a5552a5fbf4af1d0e5e8c07e8)
2014-02-03 15:28:27 -05:00
Jason Michalski 7b8acfea8e Add support for patching globals in the node tests
Add a helper to patch_global to change a global and then reset it to the
original value after a test file is complete.

(imported from commit 1b65ff6ea8693ad61b7f18f35dafa942429252a8)
2014-02-02 00:47:50 -05:00
Leo Franchi c504435bc3 Blacklist more paths, and fix paths with / to use . instead
(imported from commit 7e1840b7efb5d4f6e27307c3f7c95a9c822c8086)
2014-02-03 14:06:58 -05:00
Tim Abbott f26af47fb6 Center on-page-load narrows on first unread message.
This implementation is somewhat hackish in large part because I think
we're going to be wanting to redo the get_old_messages API somewhat
soon, and this may naturally become a lot cleaner as a result, but
this isn't a lot of code and fixes #2235 part (A) and substantially
mitigates #1510.

(imported from commit 47a2160a44befa9d83190c5cc95b90e92cc5b4cc)
2014-02-03 13:32:02 -05:00
Leo Franchi bb21400732 [localecho] Properly escape HTML in code blocks
(imported from commit 11f7e4f440cdd3a2ef6debb10c3d5a07f4fd1a1a)
2014-02-03 12:57:54 -05:00
Steve Howell 4b095cbad1 Make "assert" global in the node tests.
In the early days of the node tests we didn't have an index.js
driver, so each test set it up its own environment.  That ship
has long since sailed, so now we just require assert in index.js
as a global and make it so that the linter doesn't complain.

(imported from commit 1ded3d330ff40603cf4dd7c5578f6a47088d7cc8)
2014-02-03 10:54:38 -05:00
Steve Howell b52749d2ce Add admin_tab to template test output.
(imported from commit c364ea731f9833061b4fcc3551d5cc5a6a64e739)
2014-02-03 10:30:24 -05:00
Steve Howell 001d447e0f Add stream_member_list_entry to template test output.
(imported from commit cfd420f7337e315a5b3f1665fdc09faaadf0bfab)
2014-02-03 10:30:24 -05:00
Steve Howell ac57c3c16b Move stream_member_list_entry() code in templates.js
(imported from commit 8cca602597a3277d5e80bc1b314cd3fb16ea013c)
2014-02-03 10:30:24 -05:00
Steve Howell 2faf29408a Add scrolling to body of .test-js-with-node.html
(imported from commit 3836ecf6c73576bf9efc021dc091e685a7d0cdb2)
2014-02-03 10:30:23 -05:00
Steve Howell fa69047613 Add node test for people.js (just the basics for now).
(imported from commit 2f4714bedd54c731667160c65280f386061ce803)
2014-02-03 10:16:18 -05:00
Steve Howell d8eb8792ef Make node tests have _ and Dict automatically as global vars.
Having to explicitly call out the underscore/Dict dependencies
in nearly every test has proven to be more cumbersome than helpful.
We never monkeypatch those modules in the tests.

(imported from commit 49ef70c835edd4e22a5869eda9235ef3ffc3c59b)
2014-02-03 10:16:17 -05:00
Steve Howell 945df53280 Remove unneeded expectOne() stub in activity test.
(imported from commit c4d51a16c5dba65491729a648dd5c285f51061c3)
2014-02-03 10:16:17 -05:00
Steve Howell c8a573a0f2 Remove console.log call in echo.js test.
(imported from commit 67fc38b89b2c31974d2121555f6066b095d4279e)
2014-02-03 10:16:16 -05:00
Steve Howell b8b2551e60 Split out test_events.py from tests.py.
(imported from commit a6bfe7db506821fa4747d8bf2ae2af2f4280788d)
2014-02-01 08:14:50 -05:00
Steve Howell 3287169771 Split out test_bugdown.py from tests.py.
(imported from commit 56b67ac630aec42518b946032e594bc251259f38)
2014-01-31 17:47:21 -05:00
Steve Howell e2a6adc143 Verify Cordelia is no longer subscribed inside attempt_unsubscribe_of_principal().
Before this change, we were doing assertNotIn to verify that Cordelia
was not among our subscribers after calling /json/subscriptions/remove,
but we were then catching the AssertionError except for every case.  We
really only want to bypass the assertion when the server had reported
an error.

(imported from commit 0bdaf23047b795721372251724228daf18677df5)
2014-01-31 17:45:50 -05:00
Jessica McKellar ea934cf286 Add backend tests for group signups.
(imported from commit bbb415f40225e6fc16aa8d1edf0b95b37e09f751)
2014-01-31 17:12:10 -05:00
Jessica McKellar 1c5110dbad Send you a registration email if you try to sign up for an existing realm.
(imported from commit 9104096b424f31a22ee7c8b72378f05309bb978b)
2014-01-31 16:40:19 -05:00
Steve Howell f42b526749 Create test_signup.py.
(imported from commit 4dffbed84fbe60d5f5deaedfb614e4eb156b34c7)
2014-01-31 16:02:35 -05:00
acrefoot 171005a9de Make realm-specific lines in api_github_landing shorter
(imported from commit 0b205256de1b6ad30d42a0aa59bf1fe62ab88847)
2014-01-31 15:51:50 -05:00
acrefoot 425b2df4b4 Filter out synchronize messages on github pull requests for CUSTOMER23
(imported from commit 7032edd79738eba6119eedf15acdb77ef04a8a3c)
2014-01-31 15:35:06 -05:00
Luke Faraone 0f96d2229e email-mirror: Also accept original recipient via argv
(imported from commit 9a29fe6906713e75ee208c924b67211575c011f2)
2014-01-31 15:33:15 -05:00
Luke Faraone abc0be9c8c email-mirror: Catch ValueError returned by decode_email_address
This indicates that we didn't get the right sort of email address passed to us.

(imported from commit 26881d537296ea3d21ac29ff1b67ab260f838e13)
2014-01-31 15:33:15 -05:00
Luke Faraone 179be2051d email-mirror: Encode messages as utf-8 before parsing
(imported from commit 7b896b1e24d382f024ab0a487d448d20448f0cca)
2014-01-31 15:33:15 -05:00
Luke Faraone 9a1159fb09 Include email in response to API key retrieval
This helps our iOS app when authenticating via Google Apps, since we
don't get the users' email address when we get the ID token from Google.

(imported from commit 066639958c1e8f7845505ebdabc37282defca5c5)
2014-01-31 13:50:19 -05:00
Steve Howell c67ae498ff Extract test_external.py
(imported from commit 838dd34f101025ba161291992a56972cd374104b)
2014-01-31 13:14:19 -05:00
Jessica McKellar 9b1090506e Add tests for admins unsubscribing principals.
(imported from commit a2599ddc55ccddde3d39cb125bb1d5079772c652)
2014-01-31 11:23:14 -05:00
Jessica McKellar ec88b3abaf Give admins the ability to unsubscribe people from streams.
(imported from commit 7ec130a233a2976ad0be6f8a7b59c33ce0e0cf3f)
2014-01-31 11:23:14 -05:00
Jessica McKellar c4c5ac210e Convert stream member list to a handlebars template.
We had been concatenating strings.

(imported from commit 2d50d3f750a450029d39553ea9cd99ef824a149b)
2014-01-31 11:23:13 -05:00
Jessica McKellar db4cbcd438 Make /json/subscriptions/remove support principals.
Admins will use this to unsubscribe other people from streams.

(imported from commit 5b42d5852ddcfa2c8776482c45471828c4daf453)
2014-01-31 11:23:13 -05:00
Steve Howell 5acf8ac0b6 Split out zerver/test_messages.py.
(imported from commit 61c40418bad4628a8f98298587a0e0defa9302bd)
2014-01-31 11:22:49 -05:00
Jessica McKellar 00673534ba digest: log send failures and unsubscribe hard-bounce emails.
(imported from commit 3ffcc335d4d3ad3955da8981ff1129888fe681a4)
2014-01-31 10:57:31 -05:00
Tim Abbott e505583f52 Split out new module people.js for tracking people.
(imported from commit fb9b769819ade25d1d3d6e452e68c7ee8651cfdd)
2014-01-30 17:32:58 -05:00
Steve Howell de7708ed6e Handle id:<msg id> searches with multiple terms.
If you do a search like id:5 topic:foo and message #5
does not have the topic "foo", we now return zero results.

(imported from commit 8121fac1dbd79024c51af1f310d831dab9242e36)
2014-01-30 15:57:32 -05:00
Steve Howell b18307b667 Start using operator/operands internally in Filter class.
By having Filter.canonicalize_tuple() call filter_term(),
we make it so that Filter objects get operator/operand
fields in their terms when we initialize this.

This mostly caused test breakage for tests that were doing
assert.deepEqual; now we just check to make sure that the
field we need are there.

(imported from commit 63b2516dc72edeb11e76a1fa4442570b9c605baa)
2014-01-30 12:53:08 -05:00
Steve Howell 12626ead66 Populate terms with named fields in filter_term().
Consumers of Filter.parse() can now reference
search term parts like so: term.operand, term.operator

(Legacy code can still use term[0] and term[1].)

(imported from commit 06d0da65f13f1eb7e3ba8eac0e69448aab2735ab)
2014-01-30 12:53:08 -05:00
Steve Howell df19f4283d Split up test_parse_and_unparse() into two tests.
(imported from commit da0fd90de110b4789dbcc99d2ce7337169273bd3)
2014-01-30 12:53:07 -05:00
Tim Abbott 7ef68f19da Log operation and flag in update_message_flags.
(imported from commit c720224b0b3bf2f8ac1fd686acac143ea3f64994)
2014-01-30 12:48:36 -05:00
Jessica McKellar 82fc7a0a39 Show autoscroll forever option for all of CUSTOMER31.
(imported from commit 6c8826894daa2fc3777da0e9affe49d7a6d77296)
2014-01-30 11:15:56 -05:00
Steve Howell cbec4126c8 Order the sections of fetch_initial_state_data() alphabetically.
(imported from commit cef5471660df1bdacf7d5ea18c8c629aec3e4bf4)
2014-01-30 05:40:45 -05:00
Steve Howell 9a0aca6878 DRY event_types checks in fetch_initial_state_data().
(imported from commit 9eead1178fbcd95b61a5deb7b548485702a1056f)
2014-01-30 05:40:45 -05:00
Steve Howell 6a327a2a9c Reorganize imports to minimize vertical space.
After extracting test_subs.py, I went back and tried to put as may
imports on a single line as possible without going over 80 chars.
I did this for the zerver.lib.actions section in tests.py too, where
some imports had been removed.

(imported from commit 6ec5bad0a5314aed597f3c55aaf31611598b84ff)
2014-01-29 17:22:30 -05:00
Steve Howell 27aeebddb7 Extract test_subs.py
(imported from commit 9400eb56bce5b180c7c8ce3837906640ac80eef5)
2014-01-29 17:22:29 -05:00
Leo Franchi bea12cdadd Remove stray } from name of queue
(imported from commit 84a29db1c3cb3b3b1e2e180b9acfeff61c07d938)
2014-01-29 15:46:04 -05:00
Tim Abbott 7151af5119 Fix disabling of markdown for mit.edu.
(imported from commit 952456ddab8112bf62e6d17e29325c6d974be7a5)
2014-01-29 14:39:53 -05:00
Steve Howell 7dbebf4e05 Improve test-backend output (show module name).
We now show the module name (e.g. "tests or test_hooks") in the
test output.  This change also eliminates the intermediate use
of slashes in the test_name var, which was passed to
bounce_key_prefix_for_testing().

(imported from commit 58e73301037a0b07d7e437514c247f7cb559420e)
2014-01-29 14:28:55 -05:00
Steve Howell 233ce4360f Handle realm_name in fetch_initial_state_data/apply_events.
Instead of having home() set page_params.realm_name directly from
the user_profile object, have fetch_initial_state_data() set it.
This is more consistent with how we treat other data, and it protects
us against a race condition where realm name updates arrive during
the DB fetching.

(imported from commit 545e3bd73f150438126e3f941e9bebc7aa1d0614)
2014-01-29 13:37:58 -05:00
Jessica McKellar da3fc3fede Add tests for stream deletion.
(imported from commit bfe52c6c5be3fc36907071f9ff096cf74aa9fb22)
2014-01-29 13:09:50 -05:00
Jessica McKellar 7085dca1ce Fix the Admin page not working for newly-knighted users.
Previously, while you'd get the event saying you'd been knighted,
which would make the Administration tab visible, clicking on the tab
would error out because the admin page HTML was never sent over on
page load (since you weren't an admin at that point).

(imported from commit 90ad351533515bebece630d67baf4b142d320754)
2014-01-29 12:41:22 -05:00
Jessica McKellar ac3f93d760 Don't let deleting a non-existent stream 500.
(imported from commit f112cde743eb33608f30ae5448ce2db2a34b8e62)
2014-01-29 12:41:22 -05:00
Jessica McKellar c0bc7abbc5 Allow admins to delete private streams they are on.
(imported from commit fe27ba760abf7375242502bff694667bf34bccdf)
2014-01-29 12:41:21 -05:00
Jessica McKellar 20f2baa614 admin: Show a lock icon next to private streams.
(imported from commit 26829016cf219b55aef0ef45187667b0a9bd86fd)
2014-01-29 12:41:21 -05:00
Jessica McKellar eeb8464f4d Don't expose deactivated streams to users through clients or API.
(imported from commit c32715255b3286f52fb313d35659f9357082603a)
2014-01-29 12:41:21 -05:00
Jessica McKellar ac06d8870f Make a deleted stream actually appear deleted from the perspective of users.
In particular, make the stream history inaccessible and free up the
name to be re-used.

(imported from commit 6063b7a484ed0ba0279a17d2b3e9a92b5ef1f762)
2014-01-29 12:41:20 -05:00
Jessica McKellar 99d58fe8b5 [schema] at a `deactivated` field to Stream.
From a user's perpsective, the stream has been deleted. From the
database's perspective, the stream has been deactivated -- the stream
messages still exist.

(imported from commit b08b30b2a822663e17d64182af1fb160c2193344)
2014-01-29 12:41:20 -05:00
Jason Michalski de522029d5 Switch to DiscoverRunner from DjangoTestSuiteRunner
(imported from commit 77dd694b20509bfdc7327186e0524d686f0415f7)
2014-01-29 11:34:31 -05:00
Jason Michalski a028bda264 Allow up to three twitter previews per message
(imported from commit 566b786f9ac0582f15f8f77363f63932ee5ceec8)
2014-01-29 11:00:41 -05:00
Steve Howell 582f7eb24d Extract test_hooks.py.
These classes are in test_hooks.py now.  They still run as part of
the regular suite, so this is just to make it easier to navigate the
files.

  JiraHookTests
  BeanstalkHookTests
  GithubV1HookTests
  GithubV2HookTests
  PivotalV3HookTests
  PivotalV5HookTests
  NewRelicHookTests
  StashHookTests
  FreshdeskHookTests
  ZenDeskHookTests

(imported from commit 26a9572dd5170f9516e739d587a119bd1f87959a)
2014-01-29 10:56:00 -05:00
Steve Howell 58ca46530e Remove unused API_KEYS var.
(imported from commit cfffdd9ea4a2e4a54f9483f57cc87fa9857f098b)
2014-01-29 10:55:59 -05:00
Steve Howell 12c095fd4b Extract test_runner.py
The file test_runner.py has our subclass of DjangoTestSuiteRunner
and various methods that help it work.

(imported from commit 8eca39a7ed3f8312c986224a810d4951559e7a8b)
2014-01-29 10:55:59 -05:00
Steve Howell 5ba716cf42 Add test_admin_restrictions_for_changing_realm_name().
(imported from commit 3c6d9482fc6a0321d1584a653edd94475e92129e)
2014-01-29 10:16:58 -05:00
Steve Howell 1b987b0803 Add API for changing realm names.
(imported from commit 4bc117ae2ca4acb8896b45cd7058556317287ef8)
2014-01-29 10:16:57 -05:00
Steve Howell a8bf9dfaf2 Add event support to do_set_realm_name().
(imported from commit c0abac9867aa211bb03e20a5dc1378cf476619ce)
2014-01-29 10:16:56 -05:00
acrefoot 4562e43aee enable show_autoscroll_forever_option for Chris Aurelio
(imported from commit c0ae45fd5f6696d18383ea7451d25397a8102302)
2014-01-28 17:57:02 -05:00
Steve Howell 34f6c705e9 Rename update_realm_filter() to flush_realm_filter().
(imported from commit f52b45b627f73ece8c7348451cea48f32142e94e)
2014-01-28 17:40:01 -05:00
Steve Howell 75555ff16c Rename update_realm_emoji_cache() to flush_realm_emoji().
(imported from commit fc97377113a3c2701addcc6fb0c5d1bc6f52933d)
2014-01-28 17:40:01 -05:00
Steve Howell 912f96e7ec Rename update_stream_cache() to flush_stream().
(imported from commit c67844ef7feb1924ec495c4451e33b56b237c88a)
2014-01-28 17:40:01 -05:00
Steve Howell 1e948d2d51 Add do_set_realm_name/get_realm_name.
(imported from commit cf1cd9e1de1169f542e5f0690ef94a576dfd5663)
2014-01-28 17:40:01 -05:00
Steve Howell c5edb58cd4 Turn flush_realm() into a post-save hook for Realm.
(imported from commit 97e44b51e2b35b4b5b64b4008f6a8d3585a26e33)
2014-01-28 17:40:01 -05:00
Steve Howell 57030f53cc Use cache_set_many() in the flush_realm() code path.
The function update_user_profile_caches now operates on a list
of user_profiles, so callers like flush_realm() can benefit from
having a single cache_set_many() call.  This slightly complicates
the call from flush_user_profile().

(imported from commit e064871d849b873c6ca388f00d4f7afaba1bf222)
2014-01-28 17:40:01 -05:00
Steve Howell bbafd1dda8 Have flush_realm() make O(1) cache_delete() calls in a couple places.
For the realm-wide caches of active user dicts and alert words, just
make a single call to cache_delete() when you are deactivating a
realm.  Before this change, we were doing O(N) cache_deletes as
part of the code path through flush_user_profile().  Now we just
call update_user_profile_caches() directly to clear the user_profile
caches.

This change also sets us up to turn flush_realm() into a post-save hook.

(imported from commit 699b4ea226ae15fc8c402cb4bc64ff6bdc041fc2)
2014-01-28 17:40:01 -05:00
Steve Howell 0eed5d20d2 Create cache.flush_realm() and call it from do_deactivate_realm().
This is a slight behavior change, as we now flush user_profile
caches for bots as well as humans.

(imported from commit 24c72c44d851ee4c66a67a4728cd6c548faeedcd)
2014-01-28 17:40:00 -05:00
Steve Howell dbc1172a20 Extract update_user_profile_caches().
This function updates all the user_profile-related caches
that are keyed on a per-user basis.

(This had some test coverage already.)

(imported from commit 37979400514a7b46a6dcb7e36665b0fee2f3c525)
2014-01-28 17:40:00 -05:00
Steve Howell 3776d11c3a Rename update_user_profile_cache() to flush_user_profile().
(imported from commit 1fddb8b8dfe7943ace70c51d762eeae2ee1203a0)
2014-01-28 17:40:00 -05:00
Steve Howell aca5586cc0 Fix command line help for ./manage.py show_admins
(imported from commit d5de8832214db7b8a754f155b225e706b655260b)
2014-01-28 17:40:00 -05:00
Leo Franchi e716a75d22 Properly render at-all and at-everyone mentions locally
(imported from commit 9533b83dba6a61f6c09da755fca54e8a24ad61e6)
2014-01-28 17:37:10 -05:00
Jason Michalski 05e00575bb Only send stream update events to clients that need them
Stream name and descriptions updates were being sent to all of the
active users on a realm. They are now only send to users who would have
information about that stream.

(imported from commit 2621ee8029f7356bf44ec493d7b5361bd546a8f5)
2014-01-28 17:12:15 -05:00
Steve Howell 1dd674c7ae Make import statements take less vertical space.
(imported from commit 4d5901491d6c8c21fe045ac9751bc80613f94a59)
2014-01-28 17:04:51 -05:00
Steve Howell 80af0b8134 Move AuthedTestCase to test_helpers.py
(imported from commit bdaf63c5ed4e8d7c19e9c19f79151e8e7885c53e)
2014-01-28 17:04:51 -05:00
Steve Howell a8f2ecf48c Move context managers to zerver/lib/test_helpers.py
(imported from commit f57678fcb68aecdbb70ad86cd02cc5441695aaf5)
2014-01-28 17:04:50 -05:00
Leo Franchi ffb816391c Use our own fenced code preprocessor, fixing output mismatches
(imported from commit 3d4abb1043349e30adf265342ee7c946a99b3ce2)
2014-01-28 15:35:32 -05:00
Steve Howell 8aaf1cf8c2 Add API for removing default streams from a realm.
(imported from commit 06433126e31b372dff8a23eb8bbea14515138c85)
2014-01-28 14:30:37 -05:00
Steve Howell af9a1e967f Add API for adding default streams to a realm.
(imported from commit 0f48f722dd618c0d054aafdf3d931ef014a5c3ee)
2014-01-28 14:30:02 -05:00
Steve Howell 4cf677eb6d Add do_remove_default_stream().
(imported from commit 559dcd93ca43f4ffba58119fe429df3f6843fd63)
2014-01-28 14:28:51 -05:00
Steve Howell 38668adcec Extract DefaultStreamTest.get_default_stream_names().
(imported from commit e51ca97ca820778c161e24f4309517fc5f991dda)
2014-01-28 14:28:51 -05:00
Steve Howell 4ed661ca71 Add do_add_default_stream().
(imported from commit 34c96bdc3f5c2f7f119d2efe1606316878d34d03)
2014-01-28 14:28:51 -05:00
Steve Howell b5e0eb35be Add test_set_default_streams().
(imported from commit 359132c6c31c6de7524df3e9f34dff22273a61bc)
2014-01-28 14:28:50 -05:00
Steve Howell af00f4609a Extract get_default_streams_for_realm().
(imported from commit 6ef41615eb660fd161bfd53de09fea56266ddd2d)
2014-01-28 14:28:50 -05:00
acrefoot a126292431 Add github issues tracking to CMU's realm
(imported from commit 5f4f00888687d14ddf6977e6b2de188294e8e44f)
2014-01-28 13:56:14 -05:00
Tim Abbott 439959592f Rename build_offline_notification_event to build_offline_notification.
(imported from commit 88f4e35847faae999d72e804c9dc4d01ce51889f)
2014-01-28 13:42:50 -05:00
Tim Abbott 3fddc11cc2 Process message events more similarly to how other events are handled.
(imported from commit 5ebcd7a10fe54a8ecafb9550348a1e0418d4cbda)
2014-01-28 13:42:50 -05:00
Tim Abbott 934ac3fc88 Rename local variables inside process_new_message.
For greater clarity and in preparation for making message events be
processed more like how we process other events, we are changing:
  data => event_template (for the input event we're processing)
  event => user_event (for the event sent to a user's clients)
  event => notice (for the missedmessage notifications)

(imported from commit 30c76c3588ebe2ac44e27e17a39df4a1403979cb)
2014-01-28 13:42:44 -05:00
Tim Abbott 1a90d50a1f Clean up parsing in process_event and friends.
(imported from commit 408f9171fa481fa678dd6e27ea4cc610add232d5)
2014-01-28 11:01:30 -05:00
Tim Abbott 1cc3a6a903 Switch update_message to a generic event type.
(imported from commit db3c4d2326727ca05d25ab43ebc061d3e5cd0630)
2014-01-28 11:01:30 -05:00
Tim Abbott 167b883c38 Clean up the update_pointer tornado notification code path.
(imported from commit 94997dea54e6cc8e5b5a314a95d6114773462608)
2014-01-28 11:01:30 -05:00
Tim Abbott 0507b1bb06 Split out do_update_pointer from update_pointer_backend.
(imported from commit 25da1b324a9170677b0f6fc2e29841d6f2af9dec)
2014-01-28 11:01:29 -05:00
Tim Abbott 5ccb8b1bea Add tornado_callbacks.send_event with clean API for sending events.
(imported from commit 07209a1744ac9372273858a3e69e8a2fd9e06e06)
2014-01-28 11:01:29 -05:00
Tim Abbott 98e4d7aeb3 tests: Change tornado event capture code to a better hook.
(imported from commit b3ef0ba2108ea8d6d7df31cab72b43a10bdeab93)
2014-01-28 11:01:29 -05:00
Tim Abbott 01dedb67f4 tests: Add assert_length helper function for query count asserts.
This way, when one of these asserts fails, the relevant failure will
be printed so that we can look at it.

(imported from commit c0dfe602b987174d151981c083c66fdfdeb01253)
2014-01-28 11:01:29 -05:00
Tim Abbott bf0b0e24f2 Transition code for the Tornado message format changes.
(imported from commit 0f4a38db07517068d503f7a295c0c58ea4a02cdf)
2014-01-28 11:01:29 -05:00
Tim Abbott 3bcba79e77 Send message data to Tornado via rabbitmq instead of memcached.
This is a lot simpler and eliminates a possible failure mode in the
data transfer path.

(imported from commit 19308d2715bbd12dc9385234f1d9156f91bdfae0)
2014-01-28 11:01:29 -05:00
Jessica McKellar fd3fc095b5 freshdesk: allow subject field to be empty.
The field should still be present, but Freshdesk now lets it be empty.

(imported from commit a317043947ecb6e234efabaaf6967ebe35e154a8)
2014-01-27 21:50:00 -05:00
acrefoot 07344bb283 Fix github hook when receiving commit_comments
Apparently (according to our error logs) it's possible for there to be a "position" but no "line" [number]
on a commit comment. According to the docs, line numbers are deprecated, although they're probably
more useful than diff line number (aka 'position').

(imported from commit d48f9efbe42293c9585442bd521b1843042eca65)
2014-01-27 16:39:40 -05:00
Leo Franchi 0917a27b79 Document realm filter regexp oddities
(imported from commit 987d8ea679f40c31f2fe2280b6d585f82b20e606)
2014-01-27 13:43:55 -05:00
Leo Franchi b83be2cd32 Properly avoid realm filter work in non-local-echo case
(imported from commit 9c01109e6900509690841306fb4a23464321de61)
2014-01-27 12:30:42 -05:00
Leo Franchi a82bc689e8 Render /me message on the frontend
(imported from commit ce4a44624b7084464d5c6ce8e04eef03ee23c9e3)
2014-01-27 12:30:42 -05:00
Leo Franchi 883157893c Use a UserMessage flag to indicate /me messages
(imported from commit ea503b0d3eb6e90230c0859be96ede60faf5c2bd)
2014-01-27 12:07:48 -05:00
Leo Franchi 5441409044 Consolidate emoji tests and test on frontend as well
(imported from commit 3244a93209b56b655b80633713a3f58ae46d06ff)
2014-01-27 12:07:48 -05:00
Steve Howell 6fff91493c Fix bug in apply_events() for removing subscribers.
To mutate the state for removing subscribers, the previous
code was essentially adding in event['subscriptions'] to
state['unsubscribed'], but that was a naive approach, since
the event object only has the name of the subscriber, and not
the full subscription info.

We instead effectively copy records over from state['subscriptions']
to state['unsubscribed'], and we also do surgery on the subscribers
that made me need to add the user_profile parameter to apply_events().

With the code apparently working now, I was able to remove the
match_except() test helper and use a more thorough matcher in
the test on do_remove_subscription().

Part of fixing the "remove" case was cleaning up the "add" case,
since they aren't quite symmetric opposites of each other, although
under this refactoring they now share the new name() helper.

(imported from commit 0deab67d0c7b08b3ad962493efae3762a835fd29)
2014-01-27 10:41:29 -05:00
Tim Abbott 6d64427c46 Fix email mirror.
(imported from commit 73c109db6e821b139203f662023ed780fcee0f24)
2014-01-24 18:11:20 -05:00
Tim Abbott da90d63046 Split out zerver/lib/notifications.py from actions.py.
(imported from commit 784b82834ee4fcb4431e77f8fb1c526f8eec82ad)
2014-01-24 17:33:56 -05:00
Steve Howell cf16d95437 Move some imports in tests.py to the top of the file.
(imported from commit 588c38cb94161092b517848839977d45325633b4)
2014-01-24 16:47:20 -05:00
Steve Howell 1d95812770 Add is_admin to page_params.
Because full_name and is_admin changes go through many similar,
generic codepaths, it is almost more work at this point to keep
is_admin out of page_params as it is to just put it in.  So
I put it in.  This should pave the path for showing admins in
the GUI.

This commit actually starting by my adding a test
that calling apply_events() with the notification you get
when calling do_change_is_admin() updates
state['realm_users'] to be similar to what you would get
out of fetch_initial_state_data().  We didn't have test coverage
there before.  Making that test pass forced my hand to
either add is_admin to page_params or to special-case
apply_events() not to update page_params with is_admin.  I
chose the former approach.

(imported from commit 1e49d59c66540014284529c29d5007224be6a0c6)
2014-01-24 16:34:12 -05:00
Steve Howell 4ad8ad2b5a Extract get_realm_user_dicts() from fetch_initial_state_data().
(imported from commit 2f0f52d90eba22a4b72bd6173e60ab463482b7d6)
2014-01-24 16:34:12 -05:00
Leo Franchi 3b07c164fb Fix realm filters with multiple groups
(imported from commit 9652cf8acbe51e25bcf053980b6caa9565b57e45)
2014-01-24 16:09:44 -05:00
Leo Franchi 97fb3e74af Support subject links in local echo
(imported from commit 916fecccc834053ea0354936119c6591af273938)
2014-01-24 16:09:44 -05:00
Jason Michalski 1f98c4f4ce Add support for updating the stream description
The stream description can now be updated, but the UI is not yet updated
on success.

(imported from commit f45e0a9d5138d828ae98d6d49645ab3ddc966704)
2014-01-24 14:47:44 -05:00
Jason Michalski 4104f00229 [schema] Add description to streams and display it
A description was added to the streams and it is now displayed on the
subscriptions page. It can not be set in the UI yet.

(imported from commit 81d08b65eee42dba87cd99dd5bd30106c4eb6c6a)
2014-01-24 14:47:44 -05:00