Commit Graph

28061 Commits

Author SHA1 Message Date
Steve Howell a6bc3886e6 refactor: Extract send_peer_remove_event().
This prevents leaking some variables into an already
cluttered function.

We also add test coverage for what's now an
early-exit condition in the new function--we exempt
public MIT streams from these events.
2018-08-21 11:23:40 -07:00
Steve Howell 092bb6a728 tests: Refactor test_bulk_subscribe_MIT().
We extract a couple local vars to avoid
repeating ourself.

We also explictly set the stream as a zephyr stream.
2018-08-21 11:23:40 -07:00
Steve Howell e7062b77c8 tests: Test superuser can also mirror to private streams.
This extends a test that proved only what Cordelia
could do with/without super_user privileges when she
was trying to send to an unsubscribed stream as herself.

Now the test shows the same powers extend to Cordelia
when she's sending messages on behalf of a mirrored
user.
2018-08-21 11:23:40 -07:00
Steve Howell aee46bb1e9 tests: Test forging timestamps for mirrored messages. 2018-08-21 11:23:40 -07:00
Steve Howell 79fb36c599 refactor: Extract maybe_add_event() function.
This change was partially driven by a quirk in Python
where peephole optimizations make `continue` lines
appear not to be covered.

I also think it's generally a good idiom to extract
functions for loop bodies when they don't actually
accumulate values or maintain other state.  With this
commit we now prevent potential bugs for vars like
`is_stream` leaking between loop iterations.
2018-08-21 11:23:40 -07:00
Steve Howell e99c0929f0 tests: Test race handling for creating mirror users.
We simulate a race condition by mocking create_user
to actually create a user, but then raise an
IntegrityError (as if another process had actually
created the user, not our test).

I also changed the real code to use explicitly
named parameters.
2018-08-21 11:23:40 -07:00
Tim Abbott 0068a5ccd6 events: Fix can_subscribe_other_users not being set properly.
I don't understand why this didn't cause test failures in CI; this
change was clearly required and test_change_realm_property was failing
consistently for me locally.
2018-08-21 11:20:59 -07:00
Yago González 6949ce1bad templates: Replace   with normal spaces.
This line full of non-breaking spaces dates back to before Zulip being
open sourced (ca4e6a0ff), so we can assume it was a fix that we don't
need anymore.
2018-08-21 11:13:47 -07:00
Rishi Gupta 99b55b712b user docs: Shorten instructions when using relative settings links. 2018-08-20 21:26:01 -07:00
Rishi Gupta 36d495736a user docs: Rename display-emoji-as-text. 2018-08-20 19:24:36 -07:00
Rishi Gupta 33c586d3ec user docs: Update enable-emoticon-translations. 2018-08-20 19:24:36 -07:00
Rishi Gupta 2df6662d8c docs: Add clarification for help wanted and good first issue labels. 2018-08-20 19:17:47 -07:00
Rishi Gupta 9a759060cd user docs: Remove outdated app guides. 2018-08-20 18:52:04 -07:00
Rishi Gupta 1f2ed31791 user docs: Add related articles to desktop install guide. 2018-08-20 18:22:30 -07:00
Rishi Gupta 0f44d380ca user docs: Update save-changes.md. 2018-08-20 17:11:53 -07:00
Lyla Fischer 43f2a99f2a user docs: Trim change-a-users-name. 2018-08-20 17:11:53 -07:00
Lyla Fischer f3324f9748 user docs: Trim make-a-user-an-administrator. 2018-08-20 17:11:53 -07:00
Tim Abbott 6827c42e02 migrations: Fix accounting in is_private migration.
The previous logic didn't correctly handle the case of total being 0.

Fixes #10378.
2018-08-20 16:49:08 -07:00
Lyla Fischer f4d1283b6c user docs: Update deactivate-or-reactivate-a-bot. 2018-08-20 15:50:16 -07:00
Lyla Fischer 172cde6af6 user docs: Add restrict-bot-creation. 2018-08-20 15:50:16 -07:00
Lyla Fischer 603dedbfec user docs: Update set-default-streams-for-new-users. 2018-08-20 15:02:39 -07:00
Lyla Fischer 614da57f8a user docs: Update add-or-remove-users-from-a-stream. 2018-08-20 15:02:39 -07:00
Lyla Fischer c183c5059e user docs: Update change-the-privacy-of-a-stream. 2018-08-20 15:02:39 -07:00
Lyla Fischer f79614a7dd user docs: Update change-stream-description. 2018-08-20 15:02:39 -07:00
Lyla Fischer f1462d096e user docs: Update rename-a-stream. 2018-08-20 15:02:39 -07:00
Lyla Fischer 6fc214929c user docs: Update delete-a-stream. 2018-08-20 15:02:39 -07:00
Abhilash Verma 0e2322a322 logging: Show timestamp in UTC in non-django production scripts.
Done in pair programming with @aero31aero.

Fixes #9678.
2018-08-20 12:52:40 -07:00
Rohitt Vashishtha 920ef2b7f7 bugdown: Add mention_data.get_user_by_id().
This will allow us to do the lookups required to support the upcoming
`@**name|id**` syntax.
2018-08-20 12:46:46 -07:00
Rohitt Vashishtha 8a61ac3500 typeahead: Move displaced comment to correct location. 2018-08-20 12:44:24 -07:00
Tim Abbott 972e1d2d8b ldap: Improve exception handling in user data sync tool.
At some point, the most likely exception here stopped being
IntegrityError.

Fixes #9218.
2018-08-20 10:40:53 -07:00
Tim Abbott 3cfb2000cc ldap: Improve error message for username/LDAP domain mismatches. 2018-08-20 10:39:34 -07:00
Rhea Parekh f70b9a3eba import: Move 'build_message' to import_util. 2018-08-19 22:27:13 -07:00
Rhea Parekh 53e9da8e1f import: Build CustomProfileField, CustomProfileFieldValue and RealmEmoji with model class. 2018-08-19 22:27:13 -07:00
Rhea Parekh d98a5925cb import: Build Reaction with the model class. 2018-08-19 22:27:13 -07:00
Rhea Parekh a5bc701181 import: Move 'build_stream' to import_util. 2018-08-19 22:27:13 -07:00
Rhea Parekh c4f8abbd30 import: Build Message with the model class. 2018-08-19 22:27:13 -07:00
Rhea Parekh 4ea7302e14 import: Add missing fields in UserProfile object.
The missing fields are checked by `full_clean()` method.
The datetime field errors are ignored as they are fixed
in the `import_realm` script. The field that are
allowed to be null are not included while building
this object.
2018-08-19 22:27:13 -07:00
Rhea Parekh 66d34b23ef import: Build Attachment with the model class. 2018-08-19 22:27:13 -07:00
Rhea Parekh 9617b1fbc5 import: Build Recipient and Subscription with model class. 2018-08-19 22:27:13 -07:00
Rhea Parekh c77763bd8e import: Move 'build_realm' to import_util. 2018-08-19 22:27:13 -07:00
Joshua Pan 793ec9e266 tests: Test all update_display_settings events. 2018-08-19 14:51:31 -04:00
Joshua Pan e0426e42cd tests: Test all realm update dispatch events. 2018-08-19 14:51:31 -04:00
Joshua Pan ccd438a7ee tests: Test minor dispatch events.
These events just call another function. This covers
attachments, invites_changed, and submessage.
2018-08-19 14:51:31 -04:00
Joshua Pan 212db4d155 tests: Use zjquery for server_events_dispatch tests. 2018-08-19 14:51:31 -04:00
Joshua Pan e3504e88a7 tests: Test update realm bot owner event. 2018-08-19 14:51:31 -04:00
Joshua Pan 402e34be3b tests: Test blueslip for subscription events. 2018-08-19 14:51:31 -04:00
Joshua Pan 76ffd967c5 tests: Test typing notifs event from oneself. 2018-08-19 14:51:31 -04:00
Joshua Pan 875383e7c3 tests: Test delete stream event. 2018-08-19 14:51:31 -04:00
Joshua Pan e4a34c3512 tests: Test dispatching stream create event. 2018-08-19 14:51:31 -04:00
Joshua Pan 6b61e54c08 tests: Rename stream test to stream__update test. 2018-08-19 14:51:31 -04:00