Commit Graph

24962 Commits

Author SHA1 Message Date
neiljp (Neil Pilgrim) 21033669a8 mypy: Migrate lib/bugdown/__init__.py to python3.5 annotations. 2018-03-12 11:23:30 -07:00
neiljp (Neil Pilgrim) bb1585b2c2 mypy: Migrate lib/debug.py to python3.5 annotations. 2018-03-12 11:23:30 -07:00
neiljp (Neil Pilgrim) 6b9671c95c mypy: Migrate views/storage.py to python3.5 type annotations. 2018-03-12 11:23:30 -07:00
neiljp (Neil Pilgrim) 6bda59f3d7 mypy: Almost migrate views/streams.py to python3.5 annotations.
One remaining issue with FuncKwargPair use.
2018-03-12 11:23:30 -07:00
Rohitt Vashishtha 3710252eba portico: Prevent Firefox from bfcaching the page.
Firefox stores the last state of the page in its back/forward cache
in memory and uses that for quickly rendering the page. Since our page's
last state was 'faded-out', the content wasn't visible when the browser
rendered the page from it's bfcache.

Fixes #7907.
2018-03-11 22:17:18 -07:00
Vishnu Ks 3da2a1e18d admin: Add a realm setting to disallow signups using disposable emails.
Fixes #2955
2018-03-11 22:05:58 -07:00
Vishnu Ks a44255eedb emails: Add backend for disallowing disposable email addresses. 2018-03-11 22:05:58 -07:00
Vishnu Ks 41f8618c04 email: Use PyPi module for disposable email providers list. 2018-03-11 21:48:56 -07:00
Aastha Gupta dc60b3a44b compose: Don't clear compose box on narrow if it matches compose.
If we're entering a topic narrow, and the compose topic is the same as
narrowed topic, then leave the compose box open.

This is important if you open compose in a topic narrow, click on a
narrow, and then use the back button to return to that original
narrow.  Before this change, we'd close the compose box for no reason.

Fixes #6510.
2018-03-11 21:25:23 -07:00
Tim Abbott 25d9731a3c custom profiles: Fix totally broken events.py logic.
Apparently, my manual testing here was in error; the new version
actaully works for delivering custom profile data to the frontend.
2018-03-11 21:25:23 -07:00
Tim Abbott ef92fcbe2b topic history: Fix fetching topic history of public streams.
Apparently, we did essentially all the work to support showing full
topic history to newly subscribed users from a data flow perspective,
but didn't actually enable this feature by having the topic history
endpoint grant access to historical topics.  This fixes that gap.

I'm not altogether happy with how the code and tests read for this
feature; the code itself has more duplication than I'd like, and the
tests do too, but it works.
2018-03-11 20:59:20 -07:00
Ricky 9e52a9f879 webhooks/flock: Add flock integration. 2018-03-11 20:31:13 -07:00
Tim Abbott 6d8b6bda1a custom profiles: Fix missing mypy annotations. 2018-03-11 19:30:30 -07:00
Tim Abbott 56b1239ad5 populate_db: Include some initial data for custom profile fields.
This is currently only for manual testing; creating these would break
the existing custom profile test suite.
2018-03-11 18:08:17 -07:00
Tim Abbott 02b8453367 custom profiles: Send custom profile data to frontend.
This will fetch the data of custom fields for all users.
2018-03-11 18:08:17 -07:00
Tim Abbott 6d64fd6e08 custom profile data: Provide a clear print statement. 2018-03-11 18:00:29 -07:00
Harshit Bansal e41067a833 emoji: Refactor bugdown to use only active realm emojis.
This commit refactors the bugdown to perform a lookup only on active
realm emojis. This was needed because once we migrate realm emojis
to be addressed by `id` rather than name, it will be costly to
perform a lookup on all the realm emojis.
2018-03-11 16:24:44 -07:00
Harshit Bansal 089fede9b0 commands: Delete 'realm_emoji' management command.
We no longer accept URLs while creating emoji; so this management
command was probably left out while migrating realm emoji
infrastructure to upload backend.

We could fix this to work properly today, but the command was
originally written in a context when Zulip didn't have a UI for
managing realm emoji at all.  Now that we do have such a UI, it
doesn't have a compelling use case, and work on migrating the realm
emoji schema demonstrates that this does have a maintenance cost.

So, we simply remove this command.
2018-03-11 16:23:20 -07:00
Harshit Bansal 52e5b78613 models: Change text representation for realm emoji.
This commit changes the textual representation for realm emoji to
give more info.
2018-03-11 16:17:47 -07:00
Harshit Bansal e3c09e0308 settings: Prevent multiple requests while adding custom emoji.
This commit fixes a hard to reproduce issue which was causing
multiple requests while creating a realm emoji.

Fixes: #8475.
2018-03-11 16:17:47 -07:00
YJDave 158f0f3297 stream settings: Fix display of stream subscribers count. 2018-03-11 15:58:18 -07:00
YJDave b6408a0383 stream settings: Fix sub-unsub btn not showing on private stream creation. 2018-03-11 15:58:18 -07:00
YJDave ff6d83b2f2 stream settings: Fix subscribers not showing on private stream creation.
Previously, stream subscribers were not rendering correctly. Due to
following reasons:
- Subscribers list didn't get initialized
- Subscriber members template add subscriber-list-table DOM element
  conditionally, which doesn't handle case if user have access to
  subscribers later.

Fix this by cleaning subscriber member template to hide the
elements, instead of conditionally adding DOM elements and
initialize subscribers list even if user can't access subscribers.
2018-03-11 15:58:18 -07:00
Umair Khan 728cd04c4d check-capitalization: Check for banned words.
Fixes #8619
2018-03-11 15:34:47 -07:00
neiljp (Neil Pilgrim) e322c2161c mypy: Remove need for cast by using ConcreteQueueWorker TypeVar. 2018-03-11 15:34:11 -07:00
neiljp (Neil Pilgrim) cb8d574648 mypy: Replace Any by Type[QueueProcessingWorker] in queue_processors.py. 2018-03-11 15:34:11 -07:00
neiljp (Neil Pilgrim) fed51666d6 mypy: Migrate queue_processors.py to python3 syntax.
Forward-declarations of QueueProcessingWorker allow code order to remain
unchanged.

Note added re use of Dict vs Mapping.
2018-03-11 15:34:11 -07:00
Tim Abbott 6e048c5d3f copy_and_paste: Enable copy-paste handler in production.
Now that we've fixed the issues we encountered when first testing
this, we can try it out in production again.
2018-03-11 15:26:27 -07:00
Archana BS f876fd1423 streams page: Show weekly stream traffic. 2018-03-11 15:26:06 -07:00
neiljp (Neil Pilgrim) 8d188f50eb bugdown: Clarify walk_tree_with_family via ElementPair NamedTuple. 2018-03-11 08:30:56 +00:00
neiljp (Neil Pilgrim) aa465a6710 requirements: Upgrade mypy to 0.570.
Fixes #8582.
2018-03-10 10:04:14 -08:00
neiljp (Neil Pilgrim) d4cfab4823 mypy: Use cast in walk_tree_with_family to access inside opaque Element. 2018-03-10 10:04:14 -08:00
neiljp (Neil Pilgrim) 6fc4d5bf40 mypy: Correct annotations in queue_processors.py. 2018-03-10 10:04:14 -08:00
Tim Abbott 87f1516f5d subs: Harden subscriber count code path against bugs.
This expectOne() should catch some classes of bugs here.
2018-03-10 10:00:14 -08:00
Tim Abbott 12db219305 stream settings: Fix subscriber counts when creating invite-only streams.
Previously, when creating an invite-only stream, the subscriber counts
were not being rendered properly, in that the "create" event for the
stream had the user not yet subscribed (so can_add_subscribers was
false), and then the rerendering we did when the user susbcribed just
tried to update the number, not actually rerender the thing.
2018-03-10 10:00:14 -08:00
Tim Abbott ddef39832f subs: Reverse conditional for rerender_subscribers_count.
This is for more consistency with rerender_subscribers_list.
2018-03-10 10:00:14 -08:00
Tim Abbott a0d33fa1cf subs: Use sub_for_stream_row helper more consistently.
This cleans up a bunch of hard-to-read duplicated jQuery code.
2018-03-10 09:41:24 -08:00
YJDave e50cedfcb8 stream settings: Remove stream from subscribed list immediately on unsub.
When user click on unsubscribe button, to unsubscribe from private stream
immediately remove unsubscribed stream from all subscribed stream list.
We don't remove public stream immediately on unsubscription, cause
user may want to undo/subscribe back to stream.
2018-03-10 09:35:47 -08:00
YJDave 32407b4dc0 stream settings: Hide stream members immediately on unsub, if can't access.
If user unsubscribe from private stream, then user can't
access unsubscribed stream members.
After subscription removal, immediately render subscription members
template in case of user can't access stream subscriber.
2018-03-10 09:32:45 -08:00
Tim Abbott 920afb9447 notifications: Fix missing mypy annotations. 2018-03-09 23:34:14 -08:00
YJDave ee87c146ff settings: If message content disabled, flush all missed emails informations.
If user has disabled message content in missed email notifications,
we shouldn't send any informations about missed messages i.e. sender,
stream, message text, etc. to email servers.
We are already hiding this informations in email templates, but we
shoudln't expose any information about message content if user
has disabled this setting.
2018-03-09 21:16:02 -08:00
Tim Abbott dfbe1e4914 notifications: Improve "why you were away" content lines.
We now include whether the message was a private or group private
message; this is particularly important with the new setting to
disable including any message content in these emails (since in that
case, one doesn't know anything about the message types).
2018-03-09 21:16:02 -08:00
YJDave c94b21e9ac settings: Add setting to disable message content in missed message emails.
Fixes #6938.
2018-03-09 21:16:02 -08:00
YJDave 382ac24151 create stream: Fix real time sync bug in private stream creation.
If new private stream is created by realm admin without realm admin
subscribed to it, then it doesn't automatically add created stream to
realm admin's stream list. We have to reload the browser to get newly
created stream in stream list. Cause private stream creation event is
only sent to the subscribed users to private stream, so even if realm
admin is acting user, they don't get creation event.

We should send private stream creation event to realm admin users along
with subscribed user to stream, as realm admins can access unsubscribed
private streams.

Tweaked by tabbott to fix various typos and clean up the code.
2018-03-09 18:35:12 -08:00
YJDave 7cc675cfc1 create stream: On stream create event, add sub to stream lists.
Currently, our stream creation do not add stream list to all
stream list. Only subscription-add event add stream list to
stream list. If public stream is created without acting user
subscribed to stream, then newly created stream is not listed
to all stream list.

On stream creation add sub to all stream list table.
2018-03-09 18:29:16 -08:00
Tim Abbott 2a7e365b6f tests: Fix mock setup for update_calculated_fields.
This fixes a test failure introduced in
c5904499db.  It's not clear to me that
this mocking approach is a good idea; it's pretty messy.
2018-03-09 18:23:18 -08:00
YJDave 9183d59426 create stream: Restrict non-admin to create stream without subscribing.
Only allow realm admins to create stream without subscribing
themselves, restrict non realm admin users.

This new restriction is only for the UI; we don't actually block it at
the backend/API level (one could always create and then remove oneself
anyway).
2018-03-09 18:20:14 -08:00
Tim Abbott b8fd24b13d stream_create: Clear errors when re-submitting form.
Previously, if you fixed the errors and then tried to re-create a
stream, you'd see an error.
2018-03-09 18:15:46 -08:00
YJDave e9e6b126ec create stream: Don't allow creating stream with zero subscribers.
Restrict users(even realm admins) from creating stream with zero
subscribers only in UI.
In backend, if subscribers are zero, we automatically subscribe
current user to stream.
2018-03-09 18:09:38 -08:00
YJDave c3a289b473 create stream: Add div element indicating stream creation result.
Add div element to inform user whether stream is successfully
created or not. This will help to inform user in case if current
user is not subscribed to created stream.
2018-03-09 18:09:38 -08:00