Commit Graph

3637 Commits

Author SHA1 Message Date
Sahil Batra e0bcf72521 stream_popover: Fix message topic edit without permission to edit channel.
There was a bug when stream_id field was being passed as NaN when user
tried to edit topic of a message if the user did not had permission
to edit the channel.

This commit fixes it to not pass stream_id field in such cases because
channel cannot be changed.

Fixes #30992.
2024-07-22 10:24:37 -07:00
Shubham Padia 3631ebf3bf user_events: Update email in people_dict before updating compose state.
When a user changed an email, we updated the compose and narrow state
before updating that person's email in `people_dict`. This raised a
warning in `get_direct_message_permission_hints` when using
`emails_strings_to_user_ids_string` since that person's email wasn't
updated in `people_dict` by then.
We just changed the order of update so that the email is updated in
`people_dict` before we update compose and narrow state.
2024-07-22 10:23:24 -07:00
Aman Agrawal 1e42d60850 message_view: Ignore fetched messages if user changed view.
If user is no longer in the current message list, then the
messages fetched for it are relevant to the current narrow and can
be safely ignored.
2024-07-21 23:42:07 -07:00
Aman Agrawal e6df844865 message_view: Select message without rerender if possible.
After navigating to a `near` narrow, user is likely to press back
to go back to previous selected message. To support this, we have
to select `then_select_id` without rerender, if we can.

Tested by using breakpoints with `near` links to check if the
correct code is being executed.
2024-07-21 21:03:39 -07:00
Alex Vandiver 14880b2b59 lightbox: Update caching to work with thumbnails.
This moves the cache key for parse_media_data to being the "canonical"
image URL, not the displayed `img src`.  We may not even have the `img
src`, if the thumbnail has not yet been generated.
2024-07-21 18:41:59 -07:00
Alex Vandiver 60fc9eae2f thumbnail: Swap in our preferred thumbnail format. 2024-07-21 18:41:59 -07:00
Alex Vandiver b42863be4b markdown: Show thumbnails for uploaded images.
Fixes: #16210.
2024-07-21 18:41:59 -07:00
Aman Agrawal 025fba0a11 views_util: Extract common calls. 2024-07-21 12:39:23 -07:00
Aman Agrawal 2a998e98a6 inbox: Don't capture key input when navbar search is in focus. 2024-07-21 12:39:23 -07:00
Kislay Verma de430f541c search: Improve text about searching public channels.
We use different text for guest users, specifying that they can
only search in channels they can view.
The issue description suggests the same for spectators, but
we already use different text for them.

The search-operators help overlay is also updated with the same.

Fixes #30902
2024-07-20 15:42:41 -07:00
evykassirer d5883cfbb2 search: Empty input on open, and show current narrow search suggestions.
Fixes #30911
2024-07-19 16:55:09 -07:00
evykassirer 26429a81e0 search: Remove freshly-opened logic.
Reverts 991c8451cd, to be
replaced with other logic in an upcoming commit.
2024-07-19 16:55:09 -07:00
evykassirer 962667f81c search: Add function to calculate search query text. 2024-07-19 16:55:09 -07:00
Vector73 2cf06f34a0 dropdown: Fix partial highlight of list-item on hover. 2024-07-19 11:52:40 -07:00
Sahil Batra 6bc03ad996 stream_ui_updates: Pass missing parameter.
This bug was introduced in 08f35e08a4.
2024-07-19 11:26:44 -07:00
afeefuddin 92e0ad5c9e left_sidebar_navigation_area_popovers: Fix property name starred_message_counts.
The bug was introduced in 22a58c739c
2024-07-19 09:23:38 -07:00
evykassirer d23d8b8565 search: Avoid duplicate search results from case sensitivity.
Previously, if you typed "channel: rome" you'd see a result for
both channel "rome" and a second one for "Rome". This commit
deduplicates that by comparing for duplicates without case
sensitivity.

Note that if you fully type "channel: rome" you'll see the
result with a lowercase R instead of uppercase. It would
be a bit involved to change this, so I'm leaving that as
something to address in the future.
2024-07-18 12:33:54 -07:00
Sayam Samal 43e1a643c0 compose_closed_ui: Change mobile "+" button behavior.
This commit removes the popover from the "+" button shown in the closed
compose UI at mobile widths, and instead performs compose actions
directly on-click. The "+" button now opens the compose box with the
channel picker open (even if the user is in a topic or channel view).

This reduces the number of clicks required to start a new message from
the closed compose UI in mobile views, and makes the behavior more
consistent across all the views.

Fixes #30634.
2024-07-18 12:13:03 -07:00
Sayam Samal f545adcb93 compose_closed_ui: Remove unnecessary code updating the new DM button.
The `update_new_direct_message_button` function sets the text for the
new DM button to "New direct message" on every update cycle, which makes
no difference since the button starts with that text and never changes.
2024-07-18 12:13:03 -07:00
Sayam Samal 39d6d3ed27 compose_closed_ui: Make UI in DMs view consistent with non DMs view.
This adds the "New direct message" button back in the closed compose UI
for DMs view, to make the closed compose UI consistent across the app.

Since the closed compose UI is always visible, and one that is likely
to be used frequently, it makes sense to have the same UI across all
the views to avoid the mental overhead of figuring out how to compose
a message in different views.
2024-07-18 12:13:03 -07:00
Aman Agrawal 48edf4c8b8 typeahead: Ignore mouse position once user uses keyboard.
This keeps the first item focused when user uses keyboard.
User can still move the focused item using mouse and click to select it.
Highlighting an item via mouse and then pressing enter would select
the highlighted item.
2024-07-18 11:52:37 -07:00
Sahil Batra 6b1216402f settings: Hide font size and line height inputs when compact mode is checked. 2024-07-18 11:36:53 -07:00
Sahil Batra d8aedc1f8e settings: Fix flashing of information density setting inputs.
We change the code to update the visibility of information
density setting inputs only on successful completion of
request and not on receiving events.

Visibility of inputs is not being live updated on receiving
events because that leads to flashing of inputs when deselecting
the "Compact mode" checkbox due to the data being sent in
different events and data with the client being different for
time till the all events are received.
2024-07-18 11:36:53 -07:00
Sahil Batra 59068c24e9 settings: Pass dense_mode value if changing other settings.
This commit updates code to pass dense_mode value in request
if changing font size or line height settings to some value
other than legacy settings.
2024-07-18 11:36:53 -07:00
Prakhar Pratyush e1f3c54a1d message_edit: Fix tooltip not hidden on closing message edit form.
Bug:
A tooltip appears on hovering over a control button in the
message edit form. Now when the form was closed either using
Esc key (cancel) or Enter / Ctrl + Enter (save), the tooltip
didn't disappear. This resulted in a random tooltip visible
in the message list view.

Fix:
Since tippyjs doesn't hide tooltip even after the element is
hidden we need to explicitly hide the tooltip in those cases.
See https://github.com/atomiks/tippyjs/issues/938

This commit fixes the above mentioned bug by explicitly hiding
the tooltip instance.
2024-07-18 10:52:48 -07:00
Kenneth Rodrigues 2be9774192 integration_url_modal: Fix multiple modals opening.
Earlier the `generate integration url` button (fa-link) was still in
focus even after opening the modal.
This caused the modal to open multiple times when the user pressed the
enter key. This commit fixes that issue by focusing on the input
dropdown when the modal is opened.
2024-07-18 10:46:52 -07:00
Kenneth Rodrigues 5023daaf9b settings_emoji: Fix multiple modals opening.
Earlier the `Add a new emoji` button was still in focus even
after opening the modal. This caused the modal to open multiple times
when the user pressed the enter key. This commit fixes that issue by
focusing on the input field when the modal is opened.
2024-07-18 10:46:52 -07:00
Kenneth Rodrigues 87ff793b5a edit_linkifier: Fix multiple modals opening.
Earlier the `edit` button was still in focus even after opening the
modal. This caused the modal to open multiple times when the user
pressed the enter key. This commit fixes that issue by placing the
carat at the end of the first input field when the modal is opened.
2024-07-18 10:46:52 -07:00
Kenneth Rodrigues 37725e4e9f change_password: Fix multiple modals opening.
Earlier the `change your password` button was still in focus even
after opening the modal. This caused the modal to open multiple times
when the user pressed the enter key. This commit fixes that issue by
focusing on the input field when the modal is opened.
2024-07-18 10:46:52 -07:00
evykassirer c622622135 search pills: Decode display value.
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20quotes.20representation.20in.20pills/near/1890117
2024-07-17 12:27:40 -07:00
evykassirer 05d4e02dcd search pills: Don't re-narrow when deleting pills. 2024-07-17 12:25:59 -07:00
Sanchit Sharma 6dba4cf943 invite_stream_picker_pill: Hide typeahead after backspacing a pill.
Include `hide_on_empty_after_backspace` when
passing opts to `set_up_streams`

Fixes: #30542.
2024-07-17 12:15:45 -07:00
Sanchit Sharma afe9ac7900 typeahead: Add hideOnEmptyAfterBackspace option.
Ensure that for invite modal the typeahead menu does not
display every time a pill is deleted using the backspace
key.
2024-07-17 12:15:45 -07:00
Sanchit Sharma 05cc24d2f0 set_up_streams: Fix function to use value from `opts`
Nullish operator has been used for more clarity.
2024-07-17 12:15:45 -07:00
Shubham Padia f77738c235 navbar: Replace fa-envelope with zulip-icon-user.
Fixes part of #30918.
We don't need `align-self: baseline;` for `fa-envelope` set in
`message_view_header` since this is a different icon and it appears
better without it like other icons.
We also don't need the explicit font-size for switching b/w 14px and
16px mode since `zulip-icon` class takes care of that by default.
2024-07-17 12:08:07 -07:00
Prakhar Pratyush 5cdebcb2dd banner: Update banner text for notify_messages_outside_current_search.
This commit updates the banner text in the case of message sent
while in search view to match the narrow_to_recipient_banner text
displayed in other cases.
2024-07-17 11:35:47 -07:00
Prakhar Pratyush 91e935c695 echo: Fix error during local echo while narrowed to search view.
Earlier, on sending a message while narrowed to a search view
'!can_apply_locally()' resulted in error during local echo.

Reason:
In 'insert_new_messages' the call to 'maybe_add_narrowed_messages'
needs message ID to make a GET request to '/messages/matches_narrow',
but during local echo message ID is not available. We were using
'local_id' (a float) resulting in 400 error response.

Fix:
This commit fixes the bug by skipping the discussed GET request
during local echo.
2024-07-17 11:35:47 -07:00
Prakhar Pratyush 3090247221 process_from_server: Fix message sent in search view not appearing.
Earlier, on sending a new message in a search view it didn't
appear in that view for the sender.

This was because the message event received by the sender
was processed by 'msg_list.view.rerender_messages' which
effectively did nothing because the message is not
rendered in the first place during local echo in that
message list view.

We can't determine locally if the message should be added
to the search narrow. So, we use maybe_add_narrowed_messages
when narrowed to such views.

This fixes the bug and the message appears in the search view.
2024-07-17 11:35:47 -07:00
roanster007 47fad72226 narrow: Fix incorrect message_view_header title in `with` operator.
Previously, when a link containing the "with" operator in an incorrect
narrow is loaded, it used to open the correct view with the wrong
title of the message view header.

This commit fixes it by re building the message view header title
in case the narrow for the "with" operator has changed.
2024-07-17 10:15:54 -07:00
roanster007 125ef2a7d4 search: Fix `with` operator to be a valid search term.
This commit adds the "with" operator to be a valid search term,
which is used while rendering search pills.
2024-07-17 10:15:54 -07:00
roanster007 f02c1e321b topics: Fix unnecessary hashchange calls while using with operator.
Previously, while using "with" operator, even when the narrow
was not updated by the operator, hash change requests were
made.

This commit introduces a new variable - "narrow_requires_hash_change"
which determines whether the narrow was updated and thus
requires a hash change or not.

Fixes #30862
2024-07-17 10:15:54 -07:00
Sahil Batra 13eb1381de user_profile: Always include current bot owner in bot owner options.
This change is done to make sure that there is no error if the
bot owner is deactivated as the selected value should always be
present in options.
2024-07-17 10:07:51 -07:00
evykassirer 5e975cd54b search: Remove all pills on backspace from fresh open.
More context:
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20backspace.20doesn.27t.20clear.20all.20selected.20search.20pills
2024-07-16 23:32:21 -07:00
evykassirer 9865384d06 input pill: Differentiate how pills are removed in the callback. 2024-07-16 23:32:21 -07:00
Anders Kaseorg 34d3b2302e blueslip_stacktrace: Handle thrown null or undefined.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-16 23:27:27 -07:00
Anders Kaseorg 3a535cacdc dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-16 23:25:37 -07:00
evykassirer 074542e7ae search: Always reset the search bar when opening it.
Some time ago, I added a condition to not reset
the search bar if the user had already started
typing, so that we wouldn't erase what they'd
started typing. But we encountered a situation
where the search bar can be opened with text in
it: clicking "searching all public channels"
from a search view. We want to reset the searchbox
to add the `channels: public` pill.

I tried to replicate original issue I encountered
where the search box resetting was clearing user
input and couldn't replicate it. So for now I'm
just removing that if statement.
2024-07-16 16:51:30 -07:00
evykassirer d634d202e3 search pills: Render message header when search content changes.
Before we prevented the message header rendering, but this was
tricky for several reasons, and just re-opening the search bar
seems like a better strategy.

More context here:
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20search.20suggestion.20narrow.20from.20recent.20and.20inbox/near/1890393
2024-07-16 16:50:39 -07:00
evykassirer ad3490ce91 search: Remove extra call to narrow_to_search_contents_with_search_bar_open.
This is redundant, because the typeahead will always call this
through `updater`.
2024-07-16 16:50:39 -07:00
evykassirer e36891923b search: Ensure cursor is at end of input after focus. 2024-07-16 16:50:39 -07:00