Commit Graph

41624 Commits

Author SHA1 Message Date
PIG208 c6dfe7bf40 api: Add bot name to outgoing webhook payload.
Fixes: #12282
2021-04-06 17:37:50 -07:00
Tim Abbott e51344ab2d run-dev.py: Fix incorrectly printed hostname for droplets.
Because the logic in print_listeners doesn't have access to computed
settings in dev_settings.py, we need to duplicate the special
IS_DEV_DROPLET logic for computing the default hostname.

There's still a secondary problem that this URL 404s.
2021-04-06 11:16:16 -07:00
Anders Kaseorg 3c41db7f1a dependencies: Upgrade to webpack-bundle-tracker 1.0.0-alpha.1.
This also seems unmaintained, but is, at least, released.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 09:31:35 -07:00
Anders Kaseorg 738532ba51 requirements: Remove django-webpack-loader.
It does not seem like an official version supporting Webpack 4 (to say
nothing of 5) will be released any time soon, and we can reimplement
it in very little code.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 09:31:35 -07:00
LoopThrough-i-j bdcbd53db7 docs: Allow passing additional params to `call_on_each_event`.
`call_on_each_event` now supports additional params other than
`event_type` and `narrow`; Ex: `all_public_streams` to fetch events
of all public streams.

Also add a bit of explanation of how this parameter works.

Fixes zulip/python-zulip-api#647
2021-04-06 08:40:32 -07:00
aryanshridhar 04797d8653 stream_popovers: Use page_params.is_admin while building popover.
Within 9c9d74fd6d, page_params.is_realm_admin was incorrectly
stated while building popover which lead to admin actions not
being populated within popover.
This is so beacuse `is_realm_admin` is not a valid object
of page_params.

Rectified by renaming `is_realm_admin` to `is_admin`.
2021-04-06 08:10:43 -07:00
Abhijeet Prasad Bodas 52a86d9604 linkifiers: Use dictionaries for internal structures.
This change does not affect the API in anyway.
All internal code now uses dictionaries to
denote a linkifier, instead of tuples.
2021-04-05 18:16:08 -07:00
Abhijeet Prasad Bodas 68fe912c63 refactor: Rename most of "filter" to "linkifier".
After this only the database table, events,
and API endpoints remain.
2021-04-05 18:14:07 -07:00
Abhijeet Prasad Bodas f896a7667f refactor: Update some uses of "filter" to "linkifier".
This updates some comments and local variables
which could be changed without breaking other
stuff.
2021-04-05 18:14:07 -07:00
Abhijeet Prasad Bodas a49dc67d8e refactor: Rename backend files to use "linkifier".
This is a prep change to eventually completely
replace the term "filter" with "linkifier" in
the codebase.

This only renames files. Code changes will be
done in further commits.
2021-04-05 18:14:07 -07:00
Abhijeet Prasad Bodas 2698acd738 management: Fix incorrect help text in compare_messages.
This was added, along with `render_messages`, in
93965a8e89.
2021-04-05 18:08:18 -07:00
Abhijeet Prasad Bodas 95663693df refactor: Extract time calculation logic for topic muting.
This is a prep change for implementing the mute users
feature, so that this code can be reused.
2021-04-05 18:04:31 -07:00
Abhijeet Prasad Bodas f4c3ad5818 refactor: Rename backend muting tests to be specific.
This renames the test file for muting to have
the term `topic` in it, along with an ambiguously
named helper.
This is a prep change for implementing the mute
users feature.
2021-04-05 18:04:31 -07:00
Abhijeet Prasad Bodas 586f8fe9e0 refactor: Rename settings/muted-topics code to be specific.
This is a prep change for implementing mute
users feature, which will add another settings
page with similar naming conventions.
2021-04-05 18:04:31 -07:00
Abhijeet Prasad Bodas 3a9dfc02e6 refactor: Rename MessageList.update_muting_and_rerender.
This is a prep commit for implementing mute users feature, which
renames this function to be more specific.  This function cannot be
used as-is for user mutes, because for user-muted messages, we always
want to rerender the message list, irrespective of what
`excludes_muted_users` is.

In muting_ui.js, we also remove an unnecessary conditional that is
already handled by update_topic_muting_and_rerender itself.
2021-04-05 18:03:58 -07:00
Abhijeet Prasad Bodas f725711ff2 recent topics: Fix live update on muted_topics events.
Previously, the recent-topics view did not update when the webapp
received `muted_topics` events.

The final state was correct **only** on the client which was used to
mute/unmute the topic, because we update the UI even before sending
the request to the server to mute/unmute the topic.

This commit fixes that by rerendering the recent-topics table when the
client receives `muted_topics` events.  While doing so can be
expensive, it is likely unavoidable, because we may want to even
remove the topic from the recent-topics table, and we don't know
exactly which topic was affected (we just get an updated list of all
muted topics from the event).

Even though rerendering is expensive, it should not affect the user
experience, because a rerender will be trriggered only in the clients
which did not do the (un)muting (and hence, the user was probably not
interacting with these clients when the event was received). The
`last_topic_update` variable makes sure that this is the case.
2021-04-05 18:02:00 -07:00
Abhijeet Prasad Bodas ace54f3c3b recent topics: Fix duplicate muting requests sent to server.
Previously, on clicking the "bell" icon from a recent
topics topic row, two click handlers were triggered-
1. The one for the bell in the recent-topics topic
   row.
2. The one for the bell in the floating recipient bar.
   This is intended to be triggered only when the user
   clicks on the bell icon in the floating recipient
   bar to mute a topic, but this was triggered on
   clicking the recent-topics topic row bell too,
   because it wasn't specific and we use the same
   HTML class for both the bells.

Because both these click handlers were triggered,
the webapp sent back-to-back duplicate requests to
the server to mute the topic, which caused the sever
to throw "HTTP 400: Topic already muted" error.

This commit fixes this by making the recipient bar
click handler more specific, so that it is triggered
only when the recipient bar bell icon is clicked.

There is also the issue that the recipient bar bell
icon only allows a user to mute the topic, not unmute.
So, when someone mutes a topic, and then clicks on
the recipient bar bell icon, the webapp sends a
request to mute the topic again (not to unmute),
leading to the same error as above.
This commit does not fix that. See #15223.
2021-04-05 17:58:38 -07:00
aryanshridhar c630b888e5 dropdown_list_widget: Add a `include_current_item` parameter.
Added a `include_current_item` parameter to dropdown_list_widget
which behaves as follows:

- Has a default value of `true`, which includes the current value
in the dropdown list items.
- If set to false, it excludes the current value from dropdown
list items.
2021-04-05 17:51:59 -07:00
Sushanth Reddy Manda ddbb0a5fbc help: Mention only owners can create reusable invite links.
Fixes #16951.
2021-04-05 17:44:15 -07:00
Tim Abbott 46c72fd17d stream_popover: Specify topic when opening compose.
This fixes a bug I introduced when merging
86eccfd20f, by not using the "new topic
button" trigger.

It would probably be wise to replace that "trigger" system with just
passing actual options, as it's pretty confusing.
2021-04-05 17:40:08 -07:00
Signior-X 86eccfd20f left-sidebar: Add the new topic button in stream popover.
This commit adds an option to create new topic in stream
popovers. Then adds a click listener on them which triggers
the compose start function with the stream specified.

Fixes #13480.
Fixes #2507.
2021-04-05 17:32:44 -07:00
Anders Kaseorg f81cc16a0f templates: Add {{#let}} block helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 17:24:09 -07:00
Kenny e83538167f message_edit: Add label for edit topic button.
Rewritten by tabbott to add the label in the right places, set ARIA
settings consistent with the title, etc.

Fixes #17309.
2021-04-05 17:20:57 -07:00
Tim Abbott a94b9cc9e2 docs: Temporarily remove Giphy help center link.
This will fix CI; we can restore the link after Giphy is on zulip.com.
2021-04-05 15:44:20 -07:00
Tim Abbott 0cb72d00ba docs: Fix broken link to new Giphy article on stable docs. 2021-04-05 15:43:30 -07:00
Anders Kaseorg d84727ce7f styles: Use Source Code Pro as our monospace font.
Fixes #15993.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 15:18:41 -07:00
Anders Kaseorg 236e114870 styles: Consistently use generic fallback font families.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 15:18:41 -07:00
Aman Agrawal 1a83112cf9 giphy: Register click events inside giphy module.
Primary reason for this is to allow us more control over
creation of giphy popover as will be evident in future commits.
2021-04-05 15:04:50 -07:00
Aman Agrawal 4593ca9ed7 click_handlers: Export convert_enter_to_click from ui_util.
This allows us to use this function in other places without
importing click_handlers which depends on a lot of other modules.
2021-04-05 15:04:50 -07:00
Aman Agrawal 5e83965e80 giphy: Use GIPHY web SDK to allow inserting GIFs in compose box.
We use GIPHY web SDK to create popover containing GIFs in a
grid format. Simply clicking on the GIFs will insert the GIF in the compose
box.

We add GIPHY logo to compose box action icons which opens the GIPHY
picker popover containing GIFs with "Powered by GIPHY"
attribution.
2021-04-05 15:04:49 -07:00
Vishnu KS f00c13d303 actions: Improve the secrets of one click release action. 2021-04-05 14:40:45 -07:00
LoopThrough-i-j ffd0d822fe actions: Send reaction events to subscribers with history access.
Previously, if a user subscribed to a stream with
history_public_to_subscribers, and then was looking at old messages in
the stream, they would not get live-updates for that stream, because
of the structure in how notify_reaction_update only looked at
UserMessage rows (we had a previous workaround involving the
`historical` field in `UserMessage` which had already made it work if
the user themselves added the reaction).

We fix this by including all subscribers with history access in the
set of recipients for update events.

Fixes a bug that was confused with #16942.
2021-04-05 13:43:39 -07:00
LoopThrough-i-j 277fbb3f02 stream_subscription: Add subscribe_ids_with_stream_history_access.
This new function returns the set of `user_ids` with access to the
stream's full history, for use in send_event calls.
2021-04-05 13:23:11 -07:00
Vishnu KS 9d96847d43 faq: Add instruction for requesting sponsorship when free trial is disabled.
The request sponsorship form(/upgrade page) is shown after the organization
creation only when the free trial is enabled.
2021-04-05 12:29:13 -07:00
Steve Howell d50462568b refactor: Avoid update_calculated_fields() calls.
This change should make live-update code less brittle,
or at least less cumbersome.

Instead of having to re-compute calculated fields for
every change to a stream message, we now just compute
the fields right before we render stream settings UI.
2021-04-05 09:52:19 -07:00
Steve Howell 36632637dc refactor: Remove foo_display fields on subs.
Also add a helpful comment explaining how these work.
2021-04-05 09:52:19 -07:00
Steve Howell 5624ed2afe refactor: Extract stream_data.clean_up_description().
We use this in the few places where update_calculated_fields()
could plausibly be dealing with a new rendered description.
2021-04-05 09:52:19 -07:00
Steve Howell 99b177dc7d minor: Avoid reliance on is_old_stream. 2021-04-05 09:52:19 -07:00
Steve Howell 430fadfb0b refactor: Extract stream_data.can_subscribe_others(). 2021-04-05 09:52:19 -07:00
Steve Howell 36fd76dc20 refactor: Extract can_view_subscribers().
We also remove some needless uses of the calculated
field in the node tests.
2021-04-05 09:52:19 -07:00
Steve Howell ea972569a3 refactor: Extract stream_data.can_change_permissions(). 2021-04-05 09:52:19 -07:00
Steve Howell b27ff978c7 minor: Extract can_preview() helper. 2021-04-05 09:52:19 -07:00
Steve Howell 93471ed3e4 refactor: Extract can_toggle_subscription(sub).
We don't want to rely so much on calculated fields,
and the `should_display_subscription_button` name
is a bit misleading in certain contexts.
2021-04-05 09:52:19 -07:00
Steve Howell 9c9d74fd6d minor: Use page_params.is_realm_admin.
We don't need to get this off the sub.
2021-04-05 09:52:19 -07:00
Steve Howell 4380fe4eaf refactor: Extract stream_settings_data.
This is mostly a pure code move.

In passing I remove an unneeded call to
update_calculated_fields in the dispatch code,
plus some tests that don't need them.
2021-04-05 09:52:19 -07:00
Siddharth Asthana e7f24ac8d4 docs: Improve documentation for changing a realm's subdomain.
The current documentation doesn't clearly explain the process of
changing the organization's subdomain.
This commit adds instructions for user to get the string_id of their
organization and then lists the commands to be executed in the
management shell to change the subdomain.

Part of #17857.
2021-04-05 08:43:34 -07:00
Steve Howell c75b7e851a minor: Add stream_id const for node test. 2021-04-05 10:58:54 -04:00
Ganesh Pawar 5262ca7621 hotkey: Map numpad navigation keys to close compose when empty.
This maps pageup/pagedown/home/end to close compose when used in empty
compose box, matching the existing behavior for the Up/Down arrow keys.

Currently, these keys do nothing when used in an empty compose box.
Typically, a user intends to navigate when pressing these keys (and
with empty compose, they can't be expecting to navigate within the
compose box), so it makes sense to map them to navigate the message
feed just to save users from needing to hit `Esc` in these contexts.

Fixes #17917
2021-04-05 07:21:57 -07:00
Tim Abbott e7e2340eda hotkeys: Move copy_with_c shortcut definition and improve comments.
The `copy_handler` function that this shortcut calls is not useful
unless the body of a Zulip message is selected, so we shouldn't try
running it in other situations.
2021-04-05 07:20:32 -07:00
Tim Abbott 4462df64da hotkey: Fix incorrect preventDefault for recent_topics hotkeys.
This logic correctly prevents the hotkeys implemented below it from
being active when "Recent topics" is open.  We expect to change some
parts of that soon (see #17685), but in any case, we should always
return false in the hotkey code when we don't process a key, so that
default browser behavior works.

This fixes browser shortcuts like Ctrl+C, Ctrl+V, etc. when recent
topics is loaded.

This bug was introduced in 1eafb1d8b3.

Thanks to ganpa3 for noticing this bug.
2021-04-05 07:20:32 -07:00