Commit Graph

8040 Commits

Author SHA1 Message Date
akshatdalton 13421a1969 minor: Refactor `userMentionHandler` to avoid duplicating escaping logic.
We avoid duplicating escaping logic for the same variable, which
helps to reduce the risk of any future bugs.
2021-05-20 11:25:38 -07:00
Anders Kaseorg 69f454195f gear_menu: Fix obsolete comment about window.onhashchange.
Commit 0c80fc6aba (#12737) stopped using
the old-style window.onhashchange property.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:43:06 -07:00
Anders Kaseorg c09da2abdf panels: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:42:36 -07:00
Anders Kaseorg 7c38a0c1f0 recent_topics: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:42:36 -07:00
sahil839 bd957bb5a2 giphy: Add a '?' icon besides the "GIPHY integration" label.
We add a '?' icon besides the "GIPHY integration" label of
giphy settings dropdown.

The icon links to readthedocs page for setting up giphy API
key when api key is not set, and it points to help center
article of GIFs when the api key is added.
2021-05-19 13:20:52 -07:00
Steve Howell 62eca19b86 node tests: Eliminate sloppy_$ for compose tests. 2021-05-19 15:55:03 -04:00
akshatdalton 769cd06ab6 refactor: Extract linkifier non-settings logic from `markdown.js`.
The extracted logic is in linkifier.js.
We have decided to name it linkifier.js instead of realm_linkifier.js
because in future when we will add stream-level linkifiers, we'll
likely want them to be managed by this same file.
2021-05-19 11:59:28 -07:00
sahil839 cf23a09532 giphy: Fix live update of giphy icon when API key is empty.
We fix the code to show giphy icon live update only if the
updated setting is not disabled and API key has been added.
Though the dropdown is disabled,the setting can still be
changed using API, so this change is necessary.

Previously, we were not checking whether API key is there or
not and icon was shown on live update even if API key was
not there and then it went off on reload.
2021-05-19 11:04:32 -07:00
sahil839 cf6fc3456f giphy: Disable giphy settings dropdown if API key is not present. 2021-05-19 11:04:32 -07:00
rht aa3cdfa2e9 Fix typos using codespell.
The command:
codespell --skip='./locale,*.svg,./docs/translating,postgresql.conf.template.erb,.*fixtures,./yarn.lock,./docs/THIRDPARTY,./tools/setup/emoji/emoji_names.py,./tools/setup/emoji/emoji_map.json,./zerver/management/data/unified_reactions.json' --ignore-words=codespell_ignore_words.txt .

The content of codespell_ignore_words:
```
te
ans
pullrequest
ist
cros
wit
nwe
circularly
ned
ba
ressemble
ser
sur
hel
fpr
alls
nd
ot
```
2021-05-18 17:33:51 -07:00
akshatdalton 9e5f2f841f rendered_markdown: Add support for rendering of user group silent mention.
Earlier, the text in silently mentioned user group was rendered
as: `@user-group`

which is fixed by this commit and now it rendered as: `user-group`.
2021-05-18 17:31:25 -07:00
Steve Howell eb46ac408d node tests: Add activity.clear_for_testing(). 2021-05-18 18:34:17 -04:00
Steve Howell 7a9d0a505d node tests: Avoid rewiring client_is_active. 2021-05-18 18:34:17 -04:00
Vishnu KS 323ad83d98 billing: Allow updating licenses of plans on manual license management. 2021-05-14 15:10:02 -07:00
Vishnu KS 51ef5d62ad billing: Add ignored_inputs paramater to create_ajax_request. 2021-05-14 15:10:02 -07:00
Vishnu KS d9baa681b2 billing: Use PATCH request for changing plan status.
I think it's much more cleaner to use PATCH request on
/json/billing/plan than using a POST request on
/json/billing/plan/change to update the plan.
2021-05-14 15:10:02 -07:00
Anders Kaseorg e015f3ed7d docs: Correct “webapp” to “web app”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-14 13:15:38 -07:00
Tim Abbott 3edb9b8ed6 tooltips: Use TippyJS for all message_control_button tooltips.
The inconsistent style between these three buttons looked bad.

We have to take some care with the "Starred messages" and "Edit" ones,
to make sure they live-update properly.
2021-05-13 12:56:38 -07:00
aryanshridhar 352acdcc36 dropdown_list_widget: Properly bind focus to dropdown elements.
Previously, the focus event tends to skip the first
element within the dropdown list when the user presses
the down arrow.
Added a stopPropogation event for keydown handler within
dropdown_list_widget which propoerly binds the focus
event to the dropdown list items.
2021-05-13 12:51:49 -07:00
Tim Abbott 014e8c9f6c emoji_picker: Remove title attribute hackery. 2021-05-13 10:05:11 -07:00
Tim Abbott 889e98f467 popovers: Display move topic option to all users with permission.
Previously, the "Move topic" option was only displayed to organization
administrators, despite the new setting making who can move topics
between streams configurable.

Making this migration requires us to remove the text on the previous
"Admin actions" divider, and just make it an hrule, to avoid confusing
normal users, while still providing a hint that moving topics is a
non-personal operation.

We also change the ordering for consistency.
2021-05-13 09:22:14 -07:00
sahil839 c7d4640af5 setting: Add dropdown for managing who can move messages between streams.
This commit adds the dropdown in 'Stream settings' section of organization
permissions page to control who can move messages between streams and
also hides the stream-edit UI in message-edit form accordingly.

Fixes #14499.
2021-05-13 08:42:24 -07:00
Abhijeet Prasad Bodas a377a2df8b pm_list: Use "Muted user" placeholder for muted usernames.
This also handles a few other places missed earlier like
narrow headings, beacuse they use the same function.

We already rerender the PM list for events, so there's no
need to do anything special when someone is muted/unmuted.

`people.get_full_names` is now only used in the settings pages
while creating ListWidgets etc, so we add a new test for
it to ensure coverage.
2021-05-13 07:51:21 -07:00
akshatdalton 3015837e6e linkifier: Remove unnecessary on-success update on deleting linkifier. 2021-05-12 20:32:35 -07:00
akshatdalton a3930d8804 edit_linkifier: Improve UI for error message display on modal. 2021-05-12 20:32:35 -07:00
akshatdalton 7632541afb edit_linkifier: Remove unnecessary error message display.
We want the error message that we get on editing the
linkifier to be displayed only on the edit linkifier modal.
2021-05-12 20:32:35 -07:00
Aman Agrawal 3cb7ffd61a hotkey: Render default_view via changing hash.
Directly rendering the default view on pressing `escape` key will lead
to default_view being rendered on the current window hash.  So, we set
empty hash to load default view and let hashchange handle it.

This fixes a bug introduced in
59a45d3521.
2021-05-12 15:24:10 -07:00
Tim Abbott 3d6af7a3c8 typeahead: Fetch stream topic history from server.
Long ago, we changed Zulip to inspect server-provided topic history in
our compose and search typeahead modules, but did not trigger a query
to the server to fetch data.

This could result in confusing experiences where someone thought that
a topic doesn't exist that just isn't present in recent history.

Once we merge this, we may want to adjust the messaging in typeahead
to advertise that the first option will create a new topic, since this
change may make it feel more like creating topics is a heavyweight
operation.

Fixes #9857.
2021-05-12 15:21:25 -07:00
Anders Kaseorg 879ca4543b favicon: Catch exceptions in update_favicon.
We’re getting unexplained exceptions from URL.createObjectURL in
Firefox 88 (#18374); contain them to this function.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-12 15:06:59 -07:00
Tim Abbott b67b9912c4 drafts: Fix hook for saving drafts.
Previously, the hook to save drafts when closing the compose box was a
focusout on #compose-textarea. This mostly worked, and was essentially
invisible to users (because the animation to notify you about saved
drafts was in the close_compose_ui widget that is hidden), but you'd
end up seeing the tooltip appear (in the wrong place) if you closed
the compose box immediately after sending a message with Tab+Enter.

The correct fix is for the drafts hook to be just before we start
clearing compose box state, inside hide_box.

This was difficult to catch in a development environment, since one
doesn't use that flow with "Enter sends" enabled.
2021-05-12 12:53:58 -07:00
Tim Abbott 06f1ea657e navbar: Adjust label for usage statistics. 2021-05-12 10:34:12 -07:00
Tim Abbott b0f8bbfbd4 recent_topics: Fix annoying flicker on rerendering.
We were apparently not using the ListWidget API for replacing the
content of a widget without removing the whole thing from the DOM and
replacing it.

Unless ListWidget has unexpected bugs, this should have the exact same
result as the previous logic, with much a nicer user experience.
2021-05-12 10:02:48 -07:00
Abhijeet Prasad Bodas e5a339df25 recent topics: Handle muted user avatars in participants.
We use styling same as that of the number shown for overflow
(e.g "+3") which has a gray background.
To keep these avatars up-to-date, we need to rerender the
recent topics view after receiving a `muted_users` event.

Also update the user documentation to mention this detail.
We deliberately avoid mentioning "recent topics" because
this applies to mobile too.
2021-05-12 09:30:24 -07:00
Abhijeet Prasad Bodas e4cbfcaf1d recent senders: Rename sender_info getter function for brevity.
We will also later use this function for attaching other
information to it like whether the sender has been muted
or not.
2021-05-12 09:30:24 -07:00
Tim Abbott cf69ce166c recent_topics: Avoid unnecessary rerenders via repeated Esc.
This also prevents unnecessary rerenders when changing the URL between
"#recent_topics" and "#" when it's the default view.
2021-05-12 08:42:29 -07:00
Tim Abbott 9e812c5683 hashchange: Show default view behind overlays on load.
This seems more consistent with what users would expect; Recent topics
may be a better default view in general, but if a user has picked
another default view, we should use that where the default view is
desired.
2021-05-12 08:42:24 -07:00
Tim Abbott c690fa1174 compose_closed_ui: Avoid duplicate button in recent topics. 2021-05-11 23:57:57 -07:00
Tim Abbott 8e7761e15b compose: Move closed-compose functions to closed_compose_ui.js.
This improves the organization of our codebase a bit.
2021-05-11 23:57:57 -07:00
Tim Abbott 9239de408a compose: Remove now unused nonexistent_stream_reply_error.
This was a holdover from the legacy "reply" button behavior; with the
new wide button model, it just becomes a normal "compose" button.
2021-05-11 23:57:57 -07:00
Aman Agrawal 0d8a7efa09 compose_closed_ui: Show default label for empty narrows.
The default label for empty narrows depends on whether it's a
stream/topic narrow or a PMs narrow.

We leave some default text in compose.hbs for reply label
because it take some time for the js to display the
correct label.
2021-05-11 23:57:57 -07:00
Aman Agrawal 98b9c7284e recent_topics: Update reply button on topic row click.
Use can stay in recent_topics after clicking on mute and
read button, so we need to update reply button text here.
2021-05-11 23:51:01 -07:00
Aman Agrawal d8f554eb52 recent_topics: Set default text for reply btn when not focused in table.
When user is focused in search or filters, show "Compose Message"
as label which is more appropriate.
2021-05-11 23:51:00 -07:00
Aman Agrawal 7ab562d138 compose_closed_ui: Set text directly to compose_reply_button_label.
This will allow us set other text to it without making us restore
this html fragment when we replace it.
2021-05-11 23:51:00 -07:00
Sumanth V Rao 72ead6e097 playgrounds: Rename `name` field to `playground_name`.
The browser seems to autofill the `Name` field of the add-playground
form. Most likely this behavior is a result of  value of the `name`
input field being `name`, causing the browser do to something weird
here. This name is now changed to `playground_name`.
2021-05-11 20:47:41 -07:00
Tim Abbott 6a374d6d28 drafts: Replace notification when saving a draft.
The old logic, inline in the compose area, has produced a very weird
effect where the buttons would move to fit the notification, ever
since design changes to use the full bottom row space.

We address this by just using a Tippy tooltip instead.
2021-05-11 15:01:25 -07:00
Abhijeet Prasad Bodas 421cf05176 people: Deduplicate get_full_names logic.
Share code between `safe_full_names` and `get_display_full_names`
functions, and rename `safe_full_names` to `get_full_names_for_poll`,
because that was the only place where this was used earlier.

This also has the nice side effect of showing "Muted user" instead
of the muted username in poll results.
2021-05-11 13:21:38 -07:00
Aman Agrawal 96565ee1d1 hashchange: Rename activate_home_tab for clarity. 2021-05-11 11:26:57 -07:00
Aman Agrawal 59a45d3521 hashchange: Render default view on empty hash.
Instead of changing the hash to the default_view hash, we render
the default_view directly in case of recent topics and all messages.

This also fixes the bug that user is unable to go back in
browser window history.
2021-05-11 11:26:57 -07:00
Aman Agrawal f95443ac8f recent_topics: Use is_visible for testing if RT is rendered.
We don't want to rely on browser hash to check if RT is visible
because soon we want to display default_view without any hash
and RT may or may not be visible in that hash.
2021-05-11 11:26:57 -07:00
Anders Kaseorg 5ca763fc24 eslint: Fix unicorn/prefer-switch.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 19:26:41 -07:00