Commit Graph

24953 Commits

Author SHA1 Message Date
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
YJDave 3280135a4c stream settings: Update subscription count on subscription event.
On subscription add or removal event, render subscription count
template in case of user can't access subscribers.
2018-03-09 18:00:49 -08:00
Tim Abbott c5904499db stream_data: Move calls to update_calculated_fields to events layer.
This migrates what were effectively data update functions to be called
from the main stream_events handlers, instead of being called from the
view-update code in subs.js.
2018-03-09 18:00:31 -08:00
YJDave cc2eb60ca5 stream settings: Fix error in rendering stream members in UI.
To re-render stream members on subscription add or remove event,
we are accessing undefined value "active_stream.stream_id" rather
than "active_stream.id", which resulted in falsey value and our
stream members were not updated unconditionally.
2018-03-09 18:00:20 -08:00
YJDave 777841781f stream settings: Hide stream membership part, if can't access subs.
Do not display stream membership section in stream settings,
if user not allowed to access stream subscribers.
2018-03-09 16:24:05 -08:00
YJDave c1f9b04435 stream settings: Don't show never subscribed private stream's preview-link.
For public stream, always show stream preview link.
For private stream, only show stream preview link if user is currently
subscribed or previously subscribed to private stream.
2018-03-09 16:24:05 -08:00
Umair Khan 54e56481e6 auth: Retain email value if login fails.
Fixes #7795
2018-03-09 14:51:24 -08:00
Abhigyan Khaund 0e8cadf980 compose: Move "Sending..." to appear to the right of "Drafts".
Fixes #8570.
2018-03-09 14:44:48 -08:00
Tim Abbott 51dc46bfb1 node: Fix test failures due to missing import.
I missed this when reviewing the last batch of changes.
2018-03-09 14:24:08 -08:00
Steve Howell 616a06e5b2 Use msg_list.fetch_status instead of load_enabled.
We now attach a fetch_status to message lists, so that they
can track their fetch status individually.  When you go
back in a narrow and get all the older messages, we turn
off future fetches.

The narrow.js code no longer needs to orchestrate anything
here.  The "home" message list won't have as many redundant
fetches after this commit, because we don't need to reset
flags every time we do `narrow.deactivate`.

And then actual narrows get a new message list every time
you narrow, so their fetch status gets reset implicitly
as part of constructing the MessageList object.
2018-03-09 14:20:58 -08:00