Commit Graph

24896 Commits

Author SHA1 Message Date
Nikhil Kumar Mishra f29a1918f3 hotspots: Add ALWAYS_SEND_ALL_HOTSPOTS in dev_settings.
Replace the local variable SEND_ALL from get_next_hotspots.
Add unit test for the same.
2018-03-19 10:39:43 -07:00
Nikhil Kumar Mishra a5472ddee7 initial_password: Add unit test for INITIAL_PASSWORD_SALT = None. 2018-03-19 10:36:26 -07:00
Nikhil Kumar Mishra 9e17692d94 markdown: Add unit test for render_tex.
Test for invalid path of Katex.
2018-03-19 10:36:26 -07:00
Nikhil Kumar Mishra 1579f8cb4b messages: Add unit test for get_raw_unread_data.
Add test with 2 messages to the same group PM thread.
2018-03-19 10:36:26 -07:00
Nikhil Kumar Mishra 3b4ff4f75c markdown: Clean render_markdown.
Remove Message is None and not None case as the
render_message_backend passes a fake Message object.
2018-03-19 10:36:26 -07:00
Tim Abbott 1e453981a3 stream settings: Fix exceptions when rerendering subscribers.
If another user subscribed to or unsubscribed from a stream while the
current user was not subscribed, we previously would attempt to
rerender the subscriber counts for that stream, even though they
weren't rendered at all in the first place; this would trigger
blueslip errors from the expectOne() check in this function.

Fixes #8720.
2018-03-19 10:28:24 -07:00
YJDave 2cbfcbb740 subscription: Fix unexpected blueslip warnings on add subscriber.
In stream settings, if user add subscriber to unsubscribed public
stream from `Add` input widget it gives lots of blueslip warnings,
cause user isn't subscribed to public stream.

Fix this by changing condition to `sub.can_access_subscriber` from
`sub.subscribed` in blueslip warning, cause user can access
subscribers in such cases even if not subscribed to stream.

Tweaked by tabbott to make the node tests pass.
2018-03-19 10:24:14 -07:00
gooca 64dac1bb2e Docs: Added "connect the zulip upstream repo" to more places. 2018-03-18 23:02:09 -07:00
Nikhil Kumar Mishra 70ccc30465 management command: Add unit test for MultipleObjectsReturned case.
Verify error on using get_user if server has multiple users with that email.
2018-03-18 22:50:03 -07:00
Cynthia Lin 333b8b095c subscriptions: Use tooltips for stream info hover content.
Fixes #8718.
2018-03-18 19:44:53 -07:00
Harshit Bansal 646700b144 emoji: Start using `get_active_emoji()` in `emoji_name_to_emoji_code()`. 2018-03-18 19:34:02 -07:00
Harshit Bansal 23c8da205c models: Extract 'get_realm_emoji_dicts()'. 2018-03-18 19:34:02 -07:00
neiljp (Neil Pilgrim) f2e8fff221 ifttt: Support topic as preferred alternative to subject.
Fixes #8698.
2018-03-18 19:19:44 -07:00
neiljp (Neil Pilgrim) 2a2549ce9d zapier: Support topic as preferred alternative to subject. 2018-03-18 19:18:34 -07:00
Aastha Gupta 7485461cc6 notifications: Check if localstorage is enabled.
This checks for whether local storage is enabled and if it
is not enabled, then it will skip checking the value of
"dontAskForNotifications" key in the local storage.

This should eliminate an occasional JavaScript traceback we were
seeing in production.

Fixes #8721.
2018-03-18 12:54:11 -07:00
Tim Abbott 500fa9d2c1 webhooks: Improve explanation of setting specific topics. 2018-03-18 10:53:45 -07:00
Eeshan Garg 8fbd8c68f4 webhooks: Update macros to specify custom topics and default PMs.
These changes are the result of migrating to
check_send_webhook_message.
2018-03-18 10:53:45 -07:00
Eeshan Garg 857569cbf7 webhooks/teamcity: Use check_send_webhook_message.
For a personal build, the teamcity webhook still sends a private
message using check_send_private_message since a personal build
should never trigger a public notification.

For a non-personal build, check_send_webhook_message is used,
which can either send a PM or a stream message based on whether
a stream is specified in the webhook URL or not.
2018-03-18 10:44:09 -07:00
Eeshan Garg 3dafbfa5f4 webhooks/beeminder: Use check_send_webhook_message and update docs.
We now only give users two options, to specify a stream and receive
public notifications for their goals, or to leave it out and receive
PMs and thus, keep their goals private. This simplifies the docs!
2018-03-18 10:44:09 -07:00
Eeshan Garg a4bdd5b98c tests: Add unit test for get_user_profile_by_email.
This lost test coverage once beeminder was migrated to use
check_send_webhook_message.
2018-03-18 10:44:09 -07:00
Cynthia Lin ae080287ad subscriptions: Prevent long stream names from overflowing header area. 2018-03-18 10:25:13 -07:00
Cynthia Lin 149cc01ccf dark-mode: Change grey color of .subscriber-count and .message-count.
The original code featured a broken selector for .message-count. Instead
of using the right selector, the color selectors are removed altogether
for better contrast in dark mode.
2018-03-18 10:25:13 -07:00
Cynthia Lin 41bfeef633 subscriptions: Fix broken color property for .mute-note.
Instead of changing the property to color, we use opacity for dark mode
compatibility.
2018-03-18 10:25:13 -07:00
Cynthia Lin 01a7e86ac6 subscriptions: Remove obsolete CSS class. 2018-03-18 10:25:13 -07:00
Shubham Dhama b34b8cdb97 hotspots: Fix real-time sync for dismissing hotspots.
This closes all the hotspots which aren't included in the event.hotspots.
This means we treat all the hotspots in event.hotspots as the hotspot
which need to be shown.

Fixes: #8690.
2018-03-18 10:22:09 -07:00
Shubham Dhama 120ebc8f13 hotspots: Move the code for closing hotspot icon to hotspots.js. 2018-03-18 10:22:09 -07:00
neiljp (Neil Pilgrim) e58534022e mypy: Re-annotate capture_and_throw in terms of ViewFuncT.
Requires addition of a type ignore.
2018-03-17 23:25:05 +00:00
neiljp (Neil Pilgrim) 2ed6da77c7 mypy: Rewrite some middleware annotations to use ViewFuncT. 2018-03-17 23:25:05 +00:00
Greg Price 22071a44a7 antispam: Add a sitewide ratelimit on invites by new realms.
This applies only on a server open for anyone to create a realm.
Moreover, if the server admins have granted any given realm a
max_invites greater than the default, that realm is exempt too.
2018-03-16 18:00:11 -07:00
Greg Price dc1eeef30a antispam: Make a setting for default Realm.max_invites.
This makes this value much easier for a server admin to change than it
was when embedded directly in the code.  (Note this entire mechanism
already only applies on a server open for anyone to create a realm.)

Doing this also means getting the default out of the database.
Instead, we make the column nullable, and when it's NULL in the
database, treat that as whatever the current default is.  This better
matches anyway the likely model where there are a few realms with
specially-set values, and everything else should be treated uniformly.

The migration contains a `RenameField` step, which sounds scary
operationally -- but it really does mean just the *field*, in
the model within the Python code.  The underlying column's name
doesn't change.
2018-03-16 18:00:11 -07:00
Tim Abbott 69a7069ac4 migrations: Fix text version to Custom Emoji.
The fact that we need to do this is basically a Django bug; these
strings aren't used in the database itself.
2018-03-16 17:16:18 -07:00
Tim Abbott 791953963b check-capitalization: Include banned words in overall output.
This locks down the ban on use of "Realm" in translated strings in the
codebase.
2018-03-16 16:59:02 -07:00
Tim Abbott 9dcc2781ac models: Rename realm emoji to custom emoji. 2018-03-16 16:59:02 -07:00
Tim Abbott c3f94fa388 stream_create: Fix use of "realm" in an error string. 2018-03-16 16:59:02 -07:00
Tim Abbott 209c813424 decorator: Improve error message for a deactivated organization. 2018-03-16 16:59:02 -07:00
Tim Abbott 0e5c954393 users: Fix error string for disposable email addresses.
This should not use the term "realm", and doesn't need to name the
organization, either.
2018-03-16 16:59:01 -07:00
Tim Abbott 149f3efe5a realm: Clean up use of "Realm" in more user-facing strings.
We should be talking about organization names.
2018-03-16 16:59:01 -07:00
Tim Abbott 8e334b0f64 check-capitalization: Exclude certain uses of the word "realm".
Uses that are actually a variable name don't make sense to exclude.
2018-03-16 16:58:49 -07:00
Tim Abbott c147d2e140 notifications: Fix missed-message emails for presence-idle users.
This fixes an unpleasant regression in
f5edeb01ae, where we stopped correctly
filtering users who have an open browser session that's idle.  These
users are tagged as "UserPresence.IDLE" with an current timestamp in
the database, and should be treated as idle for presence purposes.

As a result, if you had an open Zulip browser session, you incorrectly
wouldn't get missed-message emails for PMs and mentions before this fix.
2018-03-16 16:30:23 -07:00
Tim Abbott 34e165c100 webhooks: Fix passing client string to authenticated webhook API views.
This fixes a regression in 93678e89cd
and a4979410f9, where the webhooks using
authenticated_rest_api_view were migrated to a new model that didn't
include setting a custom Client string for the webhook.

When restoring these webhooks' client strings, we also fix places
where the client string was not capitalized the same was as the
product's name.
2018-03-16 15:43:19 -07:00
Eeshan Garg a4979410f9 webhooks: Migrate most integrations to use check_send_webhook_message.
This commit migrates all of our webhooks to use
check_send_webhook_message, except the following:

beeminder: Rishi wanted to wait on this one.
teamcity: This one is slightly more work.

yo: This one is PM-only. I am still trying to decide whether we
    should have a force_private argument or something in
    check_send_webhook_message.

facebook: No point in migrating this, will be removed as part of
          #8433.

slack: Slightly more work too with the `channel_to_topics` feature.
       Warrants a longer discussion.
2018-03-16 19:23:50 -02:30
Eeshan Garg a1e3c91213 webhooks: Delete duplicate statuspage.io fixtures from GCI.
These fixtures were submitted by a GCI student but then another
student wrote the webhook from scratch anyway.
2018-03-16 19:12:09 -02:30
Tim Abbott a3e60ed3b4 docs: Update setup docs for postgres extensions.
Fixes #8494.

Further work is required to properly support newer Ubuntu.
2018-03-16 13:45:13 -07:00
Shubham Dhama 610f2cbacf notification email: Send followup_day2 email two days later.
This changes the followup_day2 emails delay from one day later to two days
later if it is getting delivered on any working days(i.e. Mon - Fri).
For Thursday it is compromised to next day as it would be too late to
postponed to Monday and for Friday it should be Monday.
At last actually, emails should send one hour before the above calculated so
that user can catch them when they are dealing with these kinds of stuff.
Fixes: #7078.
2018-03-16 13:35:57 -07:00
neiljp (Neil Pilgrim) 5f7f2d6e76 mypy: Remove type: ignore from check_url test, as is now true Validator. 2018-03-16 13:30:32 -07:00
neiljp (Neil Pilgrim) 5726d26d50 mypy: Use centralized Validator in request.pyi & validator.py.
These changes are in one commit, since the previous typing of check_url
does not match the centralized strict definition (object/Any vs Text),
actually already used elsewhere in validator.py, and also had a different
API.

check_url is updated here to match the API of the other check_* functions,
ie. val is an object (not Text) & returns Optional[str]. It also now checks
the value is text explicitly at run-time, which was only type-checked
previously. Tests are updated accordingly.
2018-03-16 13:30:32 -07:00
Tim Abbott 8a53e83cf6 help: Use more consistent module name for perfectScrollbar.
The `Ps` alias that we were using previously was potentially confusing
and made this usage harder to grep for.
2018-03-16 12:50:33 -07:00
gooca 591624972e Refactor perfect-scrollbar: Call ui methods in stream_list.js. 2018-03-16 12:47:47 -07:00
gooca 26eb60b382 Refactor perfect-scrollbar: Call ui methods in topic_list.js. 2018-03-16 12:47:46 -07:00
gooca 336d81ca4a Refactor perfect-scrollbar: Call ui methods in resize.js. 2018-03-16 12:47:46 -07:00