Commit Graph

51039 Commits

Author SHA1 Message Date
Joelute cdad925add popover: Scroll to top of long message when viewing message actions.
Previously, when a user scrolls down a long text of message and presses
the hotkey for viewing the message actions, the popover menu would continue
to open where the message actions button. Thus, the popover menu would be
cut short and sometimes off the screen. These changes will scroll the
client to the top of the message and ensure that the popover menu is
always visible.

Fixes: #23774.
2023-04-18 17:06:24 -07:00
brijsiyag 0c30acbe39 streams: Fix notice appears even when the panel is not empty.
This fixes regression in 55bd3220b6,
Where notice gets rendered even when there are streams shown in panel.
Now the check var to render message conditionally checks for both
`subscribed` and `all streams` tabs. We are avoiding the fully use of DOM
in this context because if the filter results in no stream, then also
it will display a notice. Also this commits swaps order of calling
`stream_data.delete_sub()` and `stream_settings_ui.remove_stream()`
functions in server_events_dispatch because `update_empty_left_panel_message`
uses stream_data, which was giving outdated data.
2023-04-18 17:02:01 -07:00
Prakhar Pratyush 83bbd8c767 user_topics: Update 'do_update_message' to handle 'merge userTopic states'.
This commit updates the logic for migrating user_topic rows
during the move-messages operation when the target topic
already has messages.

Previously, the target_topic's visibility_policy was simply
set to the original_topic's visibility_policy,
and the original_topic's visibility_policy was set to INHERIT.

This commit updates the move-messages code path to determine
the new visibility_policy depending on the visibility policies
of the original and target topics.
The target_topic's visibility_policy is then updated.

The number of db queries has increased by two:
One query corresponds to determining if 'target_topic_has_messages'.
Another query corresponds to 'get_users_with_user_topic_visibility_policy'
to determine 'target_topic_user_profile_to_visibility_policy'.
2023-04-18 16:40:57 -07:00
Prakhar Pratyush d5f148aa36 user_topics: Update 'topic_has_visibility_policy' to support INHERIT.
This prep commit updates the lib function
'topic_has_visibility_policy' to add support for the case
when visibility_policy=INHERIT.

Previously, it had support for all the visibility policies
except INHERIT.
2023-04-18 16:40:57 -07:00
Prakhar Pratyush 18eea3fc4a message_edit: Refactor the move user_topic records code block.
This commit refactors the move user_topic records
code block in 'do_update_message', resulting in
clean code.

We directly iterate over the dictionary items
instead of looping over the keys and fetching
values if the key exists.
2023-04-18 16:40:57 -07:00
brijsiyag 5cef364c74 upload: Open compose immediately on file drop or paste event.
This commit changes the way compose box responds to a file drop or paste.
Currently, the compose box expands only after the file is uploaded to the
server, which can cause confusion if the upload fails and there is also no
progress bar. With the update, the compose box will expand immediately upon
drop or paste events showing the status of upload. Also it was opening
the stream compose box even if we are in a direct message, now it starts
a reply.

Fixes #24654.
2023-04-18 16:37:56 -07:00
Ruchir Harbhajanka e08256ce88 urls: Move jwt_fetch_api_key endpoint to v1_api_mobile_patterns.
Moves jwt_fetch_api_key endpoint to v1_api_mobile_patterns so
that tools/test-api detects it as an API endpoint that is pending
documentation.

Fixes #24982.
2023-04-18 15:44:31 -07:00
Anders Kaseorg 1f05ed2486 emails: Remove compiled from .gitignore.
It’s unused since commit 2f203f4de1
(#24991).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-18 13:25:52 -07:00
Lauryn Menard 2c043c6242 message-type: Add support for "direct" as value for type parameter.
For endpoints with a `type` parameter to indicate whether the message
is a stream or direct message, `POST /typing` and `POST /messages`,
adds support for passing "direct" as the preferred value for direct
messages, group and 1-on-1.

Maintains support for "private" as a deprecated value to indicate
direct messages.

Fixes #24960.
2023-04-18 12:29:33 -07:00
Lauryn Menard 42d9560413 message: Use `recipient_type_name` for API message type references.
Refactors instances of `message_type_name` and `message_type`
that are referring to API message type value ("stream" or
"private") to use `recipient_type_name` instead.

Prep commit for adding "direct" as a value for endpoints with a
`type` parameter to indicate whether the message is a stream or
direct  message.
2023-04-18 12:29:33 -07:00
Lauryn Menard c87fbacaed message: Use more accurate `recipient_type` when applying unread event. 2023-04-18 12:29:33 -07:00
palashb01 3ad5e7dfc0 tippy: Prevent second appearance of tooltips for recipient bar icons.
There are four icons in the recipient bar that have tooltips, and
each of them shows a second appearance if we click on a button of
the topic menu that is just over the area of the icon. To prevent
the second tooltip, we have used the
'hide_tooltip_if_reference_removed' function to observe changes in
the DOM and hide the tooltip if the reference is removed.
2023-04-18 10:03:09 -07:00
Palash Baderia 054098fa01 tippy: Prevent appearance of second `view_user_card` tooltip.
With the recent migration of the topic_menu popover to Tippy,
some tooltips have been impacted. If we click on a popover menu
and then click on any button where the area is above the tooltip
icon, two tooltips appear. The first one is expected to appear over
the reference element, but the second tooltip appears on the top
left corner of the screen because the associated reference element
is hidden.

This commit fixes this issue for the view_user_card tooltip with
the help of the 'hide_tooltip_if_reference_removed' function.
We have set the attributes config to be 'true', since when the
tooltip appears, the parent div with classname
'message_row include_sender' is added with the value
'sender_name_hovered' in its className. We just need to observe
this classname change to hide the tooltip.
2023-04-18 10:03:09 -07:00
Mateusz Mandera eb4fc7568c auth_enabled_helper: Add realm_authentication_methods argument.
This allows removing pointless db queries when calling
*_auth_enabled(realm) repeatedly.
2023-04-18 09:22:56 -07:00
Mateusz Mandera 72d56d5d59 auth: Remove Realm.AUTHENTICATION_FLAGS class attribute.
With the removal of the authentication_methods bitfield this is now
useless and just duplicates AUTH_BACKEND_NAME_MAP keys.
2023-04-18 09:22:56 -07:00
Mateusz Mandera ffa3aa8487 auth: Rewrite data model for tracking enabled auth backends.
So far, we've used the BitField .authentication_methods on Realm
for tracking which backends are enabled for an organization. This
however made it a pain to add new backends (requiring altering the
column and a migration - particularly troublesome if someone wanted to
create their own custom auth backend for their server).

Instead this will be tracked through the existence of the appropriate
rows in the RealmAuthenticationMethods table.
2023-04-18 09:22:56 -07:00
Sahil Batra 41f17bf392 popovers: Fix showing resolve topic option in sidebar popover.
We previously showed "Mark as unresolved" or "Mark as resolved"
option in topic sidebar popover only is user was allowed to
move messages between streams. This commit fixes it to show
if user is allow to move within stream, or in other words edit
the topic, since resolving or unresolving topics is essentially
topic ediitng only.

Note that we still cannot show or hide the option as per the time
limit setting (since client may not have the first message of the
topic locally), so we just show or hide it as per
move_messages_within_stream_policy setting.
2023-04-18 09:01:39 -07:00
Sahil Batra 8874328b87 stream_popover: Add "Rename topic" option in topic sidebar popover.
This commit adds "Rename topic" option in topic sidebar popover
which will be shown when user is only allowed to edit topics and
not streams.

Note that we still cannot show or hide the option as per the time
limit setting (since client may not have the first message of the
topic locally), so we just show or hide it as per
move_messages_within_stream_policy setting.

Fixes #19886.
2023-04-18 09:01:39 -07:00
Sahil Batra 0b608d7952 message_edit: Add buffer when checking time to disable move message inputs.
This commit adds 5 seconds buffer when checking the permission to edit
stream and topic for disabling the inputs in "Move message" and
"Move topic" modal.

We already do this for the message content edit UI.
2023-04-18 09:01:39 -07:00
Aman Agrawal d3dc26cbad header: Improve dropdown click handler.
Minor tweaks that make sense to do.
2023-04-18 08:54:55 -07:00
Aman Agrawal 2553858c91 portico-header: Fix navbar user dropdown not working.
As part of #24678, this code was accidentally removed. We just
add it back to fix the broken user profile dropdown in the navbar
of non corporate pages.
2023-04-18 08:54:55 -07:00
Sahil Batra c27ff12b8c user_groups: Update ID of overlay container element.
This commit renames ID of the container element of group
settings overlay to group_overlay_container. We also
rename the variables used for this element. This makes
it consistent with the container element of settings overlay.
2023-04-18 08:53:08 -07:00
Sahil Batra a5580264eb stream_settings: Update ID of overlay container element.
This commit renames ID of the container element of stream
settings overlay to streams_overlay_container. This makes
it consistent with the container element of settings overlay.
2023-04-18 08:53:08 -07:00
Tim Abbott c995e48e11 recent: Clarify recenter_focus_if_off_screen.
The previous name suggested it did something unconditionally.
2023-04-17 19:10:42 -07:00
Lakshay Mittal ce578423f8 popovers: Hide popovers during scroll in recent_conversations.
Previously, popovers scrolled oddly along with the content in the
Recent Conversations tab; copy our approach in the message feed of
closing them on scroll.
2023-04-17 19:10:42 -07:00
Aman Agrawal 5b71acf21b message_list_view: Change date of sticky header more carefully.
If the sticky recipient bar hides the date separator completely,
the recipient bar needs to show the correct date for the message
next to it, otherwise the user will see the wrong date for the
message.

To fix this, we show the date on the date separator as soon as
the sticky message header starts to overlap with the date separator.
2023-04-17 18:51:00 -07:00
Ishaan Singh 96b051bec4 left_sidebar: Fix 'more topics' view scroll position.
This is a preparatory work for #24360.

'DIRECT MESSAGES' are completely collapsed in the 'more topics' view.

Clicking on 'DIRECT MESSAGES' exits the 'more topics' view and
scrolls to it from that state. One wouldn't be able to open
'DIRECT MESSAGES' without leaving the 'more topics' view.

Fixes: #25035.

Signed-off-by: Ishaan Singh <asishaan.191cs124@nitk.edu.in>
2023-04-17 17:40:35 -07:00
Sahil Batra 2700ad7903 typeahead: Show stream privacy icons in typeahead options.
We now show the stream privacy icons along with their names
in the typeahead options.
2023-04-17 17:19:11 -07:00
Sahil Batra 0676629008 dropdown_list_widget: Show stream icon in the button.
We now show the stream privacy type icon for the option
selected in dropdown list widget.

This commit also includes a minor CSS change to make the
web-public better aligned in the dropdown list widget
"Move topic" and "Move message" modal. There is no visible
change for other pages and other icons due to this CSS
change.

Fixes part of #22355.
2023-04-17 17:19:11 -07:00
Hardik Dharmani 82bf1ba58a shortcuts: Update `Shift + M` shortcut to work for unmute topics too.
Renamed toggle_topic_mute function to toggle_topic_visibility_policy.

In toggle_topic_visibility_policy function if topic is either muted or
unmuted it will set the topic's visibility_policy to Inherit else, if
stream is muted or unmuted topic's visibility_policy will be set to
unmuted and muted respectively.

Updated set_user_topic_visibility_policy to only show feedback widget
in case of muting topics with hotkey.

Fixes #25125
2023-04-17 17:16:28 -07:00
Aman Agrawal 043d54d170 scheduled_messages: Add overlay to display and edit them.
Fixes #20971
2023-04-17 16:59:25 -07:00
Aman Agrawal ff52187289 compose: Add UI to schedule messages.
Fixes #20971
2023-04-17 16:59:25 -07:00
Palash Baderia a4a8fd7bf3 typo: Remove duplicate word in comment. 2023-04-17 15:42:21 -07:00
Lauryn Menard c8a4b401c7 unsubscribe-success: Update template for org name and welcome emails.
Because unsubscribing from welcome emails cannot be undone, it is
confusing that the unsubscribe success page suggests that the user
can. Makes the second sentence about undoing the unsubscribe action
conditional on the `subscription_type` not being "welcome".

Updates the first sentence to specifically note the Zulip realm
that has been updated for the unsubscribe action so that it is
clear for which Zulip organization the user's settings have been
updated/changed, since the user might have accounts with various
Zulip organizations (via Zulip Cloud or self-hosted servers) that
use the same email account.
2023-04-17 12:58:32 -07:00
Aman Agrawal fbb2967ff0 message_body: Remove link from message time when locally echoed.
Fixes #25069

Since the locally echoed link of message doesn't work, it is
better to remove it.
2023-04-17 12:19:20 -07:00
Aman Agrawal 2c83efc6b4 message_row: Rename `local` class to be more verbose. 2023-04-17 12:19:20 -07:00
Aman Agrawal 7bd66891f0 css: Add background color for date row.
The logic to avoid first unread message with a date row to not
have an unread marker works purely based on `z-index` and seems
to be working nicely.

This avoids a bug where the background color of the date row
of the first unread message is different from others.
2023-04-17 12:12:41 -07:00
Sahil Batra 8293bbea28 message_edit: Show modal if user cannot resolve topics.
We show a modal if user is not allowed to resolve or unresolve
topics due to time limit. The modal just contains the text
mentioning user cannot resolve topic without stating the
count of messages that are within the time limit as we do
not recommend partial resolving of topics.

This commit does not include any changes for resolving or
unresolving topic using "Move topic" or "Move message" modals,
as we will still consider them as simple topic move and show
the same modal that is shown in general for moving message.
2023-04-17 11:25:28 -07:00
AcKindle3 e08535ab3e typo: Fix a typo in block comment
Changed `one` to `want` so that the sentence make sense.
2023-04-17 09:59:41 -07:00
Alex Vandiver 3f9ed40c62 version: Bump PROVISION_VERSION for previous change.
e536a14b61 left off the required major PROVISION_VERSION bump.
2023-04-17 09:36:11 -07:00
Aman Agrawal a06f3d26d0 scheduled_messages: Add endpoints to fetch and delete them. 2023-04-14 17:38:37 -07:00
Aman Agrawal c0ef1c360a message_send: Edit scheduled message if its ID is present.
If the ID of the scheduled message is passed by the client, we
edit the existing scheduled message instead of creating a new one.

However, this will soon be moved into its own API endpoint.
2023-04-14 17:38:37 -07:00
Aman Agrawal 555041c081 models: models: Extract get_recipient_ids method.
This will be used by scheduled messages to as it is used by drafts.
2023-04-14 17:38:37 -07:00
Aman Agrawal a0eac4aaf4 models: Rename _type to recipient_type_str. 2023-04-14 17:38:37 -07:00
Aman Agrawal b63f440fb1 models: Allow scheduled msgs to store rendered content.
This is required by the client to display a list of currently
scheduled messages.
2023-04-14 17:38:37 -07:00
Aman Agrawal a941545523 drafts: Add abstract classes for messages in an overlay.
This will help up achieve 2 things:

* Have a lot of common CSS for drafts and scheduled messages.
* Have common JS for things like keyboard navigation between drafts
  and scheduled messages.
2023-04-14 17:38:37 -07:00
Aman Agrawal c8878ed6a5 drafts: Use new tooltip design to show keyboard shortcuts. 2023-04-14 17:38:37 -07:00
Tim Abbott 1d2cf734f3 lint: Limit JS assert rule to web/tests. 2023-04-14 12:26:33 -07:00
Joelute 5d69a54849 time_picker: Reduce increment of minutes to one.
After some discussions in CZO, it was decided that we should reduce the
increment of minutes to one because the up/down arrow isn't very helpful
at all. Most of the time, users would manual type their desired time and
micro adjust with the arrow keys if needed.

This change also solves the issue where the time picker only counts
multiples of 5s as valid time as it was tied to the increment of minutes.
2023-04-14 11:02:10 -07:00
Hardik Dharmani d7d3126f80 settings: Use `place_caret_at_end` for New Email input field.
Used updated `place_caret_at_end` function from ui_utils to focus
`New Email` input field and place the cursor at end on modal render.
2023-04-14 10:59:42 -07:00