If the selection copied, is entirely within a single element, like text
within a heading (like `h1`) we discard this outermost element and only
convert the inner HTML to markdown.
However, we retain `pre` so a code block within it stays as is and does
not change into inline code, losing all its linebreaks.
Turned off and tested escaping with `/` (for now).
Added support + tests for:
- headings.
- strikethrough.
- nested lists.
- code blocks.
Improved handling of:
- links (custom and raw, ignored when wrapping a single image).
- images (now pasted in Zulip's link like syntax).
- custom emojis.
- LaTeX (no garbage symbols, unformatted plain text is pasted)
Added tests for emojis.
Known concerns:
- External images aren't handled anymore by upload.js -- is this a bug?
- Tables lose their formatting on paste.
We now send "realm_user/update" (and "realm_bot/update" for bots)
events with "is_active" field when deactivating and reactivating
users, including bots.
We would want to use "remove" event for a user losing access
to another user for #10970, so it is better to use "update"
event for deactivation as we only update "is_active" field
in the user objects and the clients still have the data for
deactivated users.
Previously, we used to send "add" event for reactivation along
with complete user objects, but clients should have the data
for deactivated users as well, so an "update" event is enough
like we do when deactivating users.
This switches to our preferred dash-separated classnames
instead of underscore-separated, and also updates the
classname to be differentiable from users that aren't
part of the current narrow.
Until the next commit that splits the buddy list, the
name is a bit inaccurate since it still contains all
the users.
This was pvreviously covered by tests for the buddy list.
We shouldn't rely on other code to complete code coverage
for this module. In the future it would be good to add
more tests to the lazy set tests to directly cover lazy
set functionality.
We should remove this overly defensive code and remove the `undefined`
type from the return type of this function to avoid handling unexpected
`undefined` values in the downstream code.
This commit renames default_view and escape_navigates_to_default_view
settings to web_home_view and web_escape_navigates_to_home_view in
database and API to match with our recent renaming of user facing
strings related to this.
We also rename the variables, functions, comments in code and class
names and IDs for elements related to this.
This commit removes the 'development' guard and makes
the UI changes related to the 'Follow Topics' project visible
outside the development environment.
Cleans up the older UI elements related to mute and unmute topics.
This commit adds the pronouns custom profile field to the typeaheads in
the composebox along with the necessary node tests.
Details of the implementation:
- Added logic to display pronouns in ( ) next to the user's name when
the user has a non-empty pronoun-type custom profile field.
- If multiple pronoun fields exist in the organization, the
implementation selects the one earlier in the list of custom profile
fields.
- No pronouns are displayed if the selected pronoun field is empty.
Fixes#26924.
When we send a message and that causes a topic to be automatically
followed or unmuted due to the automatic visibility policy settings,
we tell the user via a post-send-message compose banner.
The "notify_unmute" banner is not shown when the topic has already
been unmuted or followed due to these policies.
Fixes part of #26900.
We did not show the streams to subscribe in dropdown in user
profile modal when user is not allowed to subscribe others
even in the user's own profile modal which is not correct.
This commit fixes it to show the streams in dropdown for
user's own profile irrespective of whether user is allowed
to subscribe others or not.
Add a personal menu dropdown that opens on clicking user avatar icon
in navbar added in previous commit.
The args passed to render_personal_menu() in onShow() are returned by
get_personal_menu_content_context() in popover_menus_data.js so that
they can be unit tested.
Additionally, added CSS to get a custom arrow for dropdown menu.
Added a `?` hotkey in keyboard shortcuts option in personal_menu
dropdown in a style similar to our tooltip's hotkey by adding
? in a span with class .tooltip-hotkey-hint and adding some CSS.
Fixes part of #22802.
With the autocomplete dropdown, some users face trouble or uncertainty
while selecting topics. These changes adds a new indicator to the topic
typeahead dropdown while typing to the topic box. This ensures users
that they are on track and they are doing the right things. We also
suggest the current query even if it doesn't match a topic to continue
providing the new indicator.
Fixes: #23296.
This commit adds support to allow bot-owners to delete messages
sent by their bots if they are allowed to delete their own messages
as per "delete_own_message_policy" setting and the message delete
time limit has not passed.
This commit adds "(guest)" indicator to guest user names in
compose box placeholder if enable_guest_user_indicator setting
is enabled in the organization.
This commit adds code to get_display_full_name function
to add "(guest)" indicator to guest user names if
enable_guest_user_indicator setting is enabled in the
organization.
The get_display_full_name function is used in many parts
of the code and thus this commit adds the indicator in
following places -
- Message recipient row for DMs including the messages
shown in scheduled messages overlay.
- DMs list in left sidebar and its tooltips.
- DMs info recent conversations view.
- "other senders" tooltip in recent conversations view.
- Compose button text.
- User names shown on reaction element and its tooltip.
- Desktop notifications and the browser title.
- Results for a poll.
This commit adds "(guest)" to user names in the narrow title when
enable_guest_user_indicator setting is enabled in the organization.
The indicator, based on the setting, is added for DM narrows and
for "sender:" narrows.
This commit adds "(guest)" indicator to user names of guests
in mention pill if the enable_guest_user_indicator setting is
enabled for the organization. Note that the actual message
content does not include the indicator.
This commit adds code to add "(guest)" to user names of guest
users in the following places -
- right sidebar
- user pills, including the pills in search suggestion typehaead
- typeaheads for user
- sender names in message feed
- user profile popover and modals.
- user name in not subscribed warning banner.
Note that the indicator is shown only if enable_guest_user_indicator
setting is set to true.
As a result of this change, we now translate "deactivated" text
shown in user pills for deactivated users.
Fixes part of #26700.
This commit also limits `stream_bar.decorate` to only
be able to be called for stream messages, since it's
an undefined string_id is no longer a sign that
you're dealing with a DM.
In order to eliminate the usage of `::after` pseudo-element for
rendering the empty list message, this commit introduces a new function
for displaying the empty user list message on the right sidebar.
This commit introduces a function in list_widget.js that allows
displaying a message when the list is empty using the `data-empty`
dataset. The function checks the container type to determine the
appropriate wrapper for the message and appends it to the container
body.
Fixes a part of #23072.
These changes adds a new scheduled message indicator in conversation views
which informs the user of the number of messages that are scheduled to be
sent to the current view.
Fixes: #25584.
These existing typing related functions are re-usable in the
case of stream typing, except that the key differs. So, to make
it possible to re-use the code in these functions, this commit
removes the `get_key` call in those functions and instead passes
the key directly.
Also, renamed `get_key` to `get_direct_message_conversation_key`
to differentiate it from the `get_topic_key` that we'll add later
for stream typing.
We use this function to show who's typing in the
direct messages narrow.
Renamed it because, with the addition of stream typists to
`typist_dct` in the next commit, this might be confusing.
This commit addresses the discussed issue by renaming
'get_all_typists()' to 'get_all_direct_message_typists'.
For the timing part of sending requests, it will be the same
as DMs, as the code in 'typing_status.ts' is being reused
for that purpose.
As a note, 'state.current_recipient_ids' and 'new_recipient_ids'
of update() in 'typing_status.ts' used to be an array of recipient ids.
Renamed them to 'state.current_recipient' and 'new_recipient' as they
can now be either of:
1) An object of format {stream_id: 2, topic:'hello'}
2) an array of recipient user IDs like previously
Also, made required changes in 'typing_status.ts' and
'typing_status.js.flow', i.e., documenting the new format of
new_recipient.
Co-authored-by: Prakhar Pratyush <prakhar841301@gmail.com>
This commit replaces the value `private` with `direct` in the
`message_type` field for the `typing` events sent when a user
starts or stops typing a message.
The logic for formatting code is generalised to make it reusable for
multiple styles of formatting (added in the next commits).
Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
This commit updates the 'get_server_history' function to return
early if a request is already in progress for a given stream_id,
thus preventing concurrent requests for a single stream_id.
We maintain a set 'request_pending_stream_ids', which contains all
the stream IDs for whom requests are in progress.
Using this set, we return early.
Fixes#26915.
This fixes the bug where on pressing enter after the last line in a
textarea, the cursor would go to the new line but the textarea would
not scroll it into view unless more was typed. This was observed on
chromium browsers.
A new function `insert_and_scroll_into_view` is added to `compose_ui.js`
which blurs and refocuses the textarea after inserting the content, then
autosizes the textarea.
The function considers @**all**, @**everyone**, @**stream**,
and @**topic** as wildcard mentions.
Earlier, the function didn't have a check to match @**topic**
in the message_content.
Since is_visible was refactored to use a variable, these mocks
are not required.
Also, since is_visible return `false` by default, mocking it
to return false is not required.
It did the same thing as handle_narrow_activated when passed the
home_msg_list filter.
We still leave a renamed version for use by the inbox/recent views.
It did the same thing as handle_narrow_activated when passed the
home_msg_list filter.
We still leave a renamed version for use by the inbox/recent views.
We now use micromodal in the license update modal on billing page
to make it consistent with other modals in the app and this is
preparatory work for moving away from bootstrap as well.
This commit adds two drop-down settings in 'SETTINGS / NOTIFICATIONS'
and 'SETTINGS / DEFAULT USER SETTINGS'.
The new settings lie in a new section named "Topic notifications",
just below the "Noification triggers" section.
Label: "Automatically follow topics"
Options: "Topics I participate in", "Topics I send a message to",
"Topics I start", and "Never".
Label: "Automatically unmute topics in muted streams"
Options: "Topics I participate in", "Topics I send a message to",
"Topics I start", and "Never".
Fixes#25914.
Updates the testing for scheduled message event schemas to be fully
checked by `zerver/tests/test_events.py` and `tools/check-schema`.
Adds the missing 'failed' field to the scheduled message events
in `web/tests/lib/events.js` as well.
Since we only have tippy popovers now, functions calling
not_hide_tippy_instances have been removed.
Also, all of emoji_picker, stream_popover, user_card etc popovers
are tippy popovers so calling hideAll is enough to hide them all.
We should search for what the user asked us to search for.
CZO conversation:
https://chat.zulip.org/#narrow/stream/101-design/topic/search.20buddy.20list.20for.20self/near/1630454
This commit also stops the user from being at the top of
the search list, so that the search list is fully
alphabetical (though still sorted by online status).
We switch to not having the user at the top of the list
only when there's search text in the search bar, otherwise
there'd be a visual jump that would happen just by opening
the search bar. There's almost always visual change when
entering text into the search input field, so that seems
like the time to change the sorting.
Earlier, followed topics in muted streams were not listed in
the 'Recent conversations' table when 'Include muted' filter is
unchecked.
They should be listed as we currently list unmuted topics.
The "test_filter_all" includes tests for muted and not muted topics,
but the 'is_spectator' field is set to 'true'.
Logically, it is incorrect because a topic can't have a
visibility policy set in spectator view.
This commit fixes the incorrect behavior and adds a separate test
for the case 'is_spectator=true'.
The issue was introduced in d0a697f.
When the user is typing a numbered / bulleted list in the compose box,
on pressing Enter the list syntax will be inserted automatically on
a new line, and removed if Enter is pressed after an empty line.
Fixes: #20305.
A formatting button below the compose box can format the selected text
by numbering or unnumbering the selected (partially or completely)
lines. The behaviour is inspired by GitHub's bulleted list formatting.
Fixes part of: #20305.
A formatting button below the compose box can format the selected text
by bulleting or unbulleting the selected (partially or completely)
lines. The behaviour is inspired by how GitHub's bullet list format
button works.
Also adds a new breakpoint for showing vdots for formatting buttons.
Fixes part of: #20305.
Wildcard mentions in direct messages were not being count as mentions
due to incorrect calculation of `is_unmuted_mention` variable in
`update_message_for_mention()` function in `unread.js`. Fixed this by
correcting the calculation of `is_unmuted_mention`.
This test did extensive mocking and didn't feel like it either fully
tested the module or did a good job of testing the logic; and will
break with the migration to tippy. I think it's better to remove the
test and plan to write a new one testing just
get_user_card_popover_data, the actual interesting part for node tests
of this module.