Commit Graph

380 Commits

Author SHA1 Message Date
evykassirer b07bc23e07 upload: Separate uploads into one upload bar per file.
Fixes #24287.
2023-04-12 15:42:07 -07:00
evykassirer 4e7f9100fc upload: Rename hide_upload_status to hide_upload_banner.
This will be clearer naming for when there are multiple banners,
but is likely a more intuitive name even for the current state
of the code.
2023-04-12 15:42:07 -07:00
Joelute be38730d05 time_picker: Set minutes to zero in global time picker.
Usually when a user uses the time picker, they're most likely going to
set the time to the hour rather than the current minute. These changes
will set the minutes to zero whenever we are opening the global time
picker.

Fixes: #23874.
2023-04-12 15:39:49 -07:00
Lauryn Menard 8552ff677d search: Improve suggestions for `is:resolved` and `group-pm-with`.
Improves suggestions to not include `is:resolved` for searches
that have already specified a narrow with direct messages, since
there are no topics for direct messages. And improves suggestions
for searches that already have `is:resolved` to not include options
that narrow to direct messages.

Improves suggestions to not include `group-pm-with` for searches
that have already specified a narrow for stream messages. And
improves suggestions for searches that already have `group-pm-with`
to not include options that narrow to stream messages.
2023-04-12 11:32:52 -07:00
Lauryn Menard b9023db04e node-tests: Remove mock of `topic_list` in `topic_list_data.test`.
With commit f0d1332ba2, we no longer need to mock `topic_list.js`
in the `topic_list_data` node test. Instead, we can pass a string
directly to that function. The default is an empty string unless
there is a search input. Also, updates the default of the zoom to
be false instead of undefined in the tests.
2023-04-12 11:30:56 -07:00
Tim Abbott c43d551c5f Revert "markdown: Fix lists with 3+ digit markers retaining alignment for 2 digits."
This reverts commit d0f9e23ec6.

This didn't work correctly for lists containing more complex syntax inside.
2023-04-11 16:07:17 -07:00
Alex Vandiver f34509bbdd tippyjs: Only destroy tippy popups if they exist at all. 2023-04-11 14:34:53 -07:00
N-Shar-ma 4e2931cefd compose: Disable "Message X" button for DMs when DMs are not allowed.
When in a private narrow, the "Message X" button is disabled if direct
messages are not allowed in the organisation and the current recipient
is not a bot.

Note that when the recipient is a user group with 1, more or all bots,
the button is disabled then too as such PMs are not allowed. Only when
the recipient is a single bot, then it's not disabled, as DMs with one
bot are allowed even in organisations where DMs are disabled.
2023-04-11 11:35:37 -07:00
Sahil Batra f9eff1c478 stream_popover: Disable topic input in "Move topic" modal.
This commit adds code to disable the topic input in "Move topic"
modal if user cannot edit topics as per edit_topic_policy setting.
We do not check time-based permissions here as the first message
of the object may not be available. This commit also fixes a small
typo in the comment for that code along with updating the comment
to mention about disabling topic input.
2023-04-11 11:07:23 -07:00
Sahil Batra 6dc54d3738 message_edit: Show modal when trying to move older messages.
If user tries to move messages older than the allowed time limit,
we show a confirmation modal stating that the older messages will
not be moved and only the alloed messages are moved if user clicks
on "Confirm" button.
2023-04-11 11:07:23 -07:00
Sahil Batra 440f9e397a message_edit: Apply topic edit restrictions to "(no topic)" messages.
Previously, editing topic of "(no topic)" messages was allowed
irrespective of time limit or the "edit_topic_policy" setting.
Since we are working in the direction of having "no topic" messages
feel reasonable, this commit changes the code to not consider them
as a special case and topic editing restrictions apply to them as
well now like all other messages.

We still highlight the topic edit icon in recipient bar without
hovering for "no topic" messages, but it is only shown when user
has permission to edit topics.
2023-04-11 11:07:23 -07:00
N-Shar-ma 61fa24fd5e compose: Have at least 1 new line before and after a giphy gif.
Until now, a giphy gif was inserted in an inline manner, but now we insert
it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 64ec503994 compose: Have at least 1 new line before and after an attachment.
Until now, an attachment was inserted in an inline manner, but now we
insert it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 2961da5ea0 compose: Have at least 1 new line before and after a video call link.
Until now, a video call link was inserted in an inline manner, but now
we insert it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 9d4cec6e87 compose: Make count of new lines inserted around content block customizable.
Until now, we had been inserting a hard-coded number of new lines before
and after a quoted message. Now we replace that with an optional parameter
to make it customizable for different use cases.

This is a preparatory commit for the next commits, which will allow
inserting other elements as a block in the compose box.
2023-04-11 10:40:19 -07:00
Hardik Dharmani 7105a232aa topics_sidebar_actions: Update topics_sidebar to include unmute option.
Updated topics_sidebar_actions.hbs to include a option to add/remove
unmute visibility_policy for a topic is in a muted stream,
if in development environment.

Added 2 new classes sidebar-popover-unmute-topic and
sidebar-popover-remove-unmute for unmute topic option. Also, Renamed
previous sidebar-popover-unmute-topic to sidebar-popover-remove-mute.

Added 4 new click handlersthat uses
user_topics.set_user_topic_visibility_policy() to update
topic's visibility_policy.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani aab252f657 user_topics: Update user_topics.js to include all visibility policies.
Updated user_topics.js to include all visibility policies
rather than just mute/inherit visibility policies.

Replaced muted_topics Map with `all_user_topics` Map which has
structure: {stream_id:{topic_name:{date_updated,visibility_policy}}}.

Removed add_muted_topic, remove_muted_topic functions which were
adding/removing topics in muted_topics Map. Added new function
update_user_topics which take parameter stream_id, topic,
visibility_policy, and date_updated(optional) which adds a topic
to all_user_topics with date_updated and visibility_policy,
if visibility_policy is not equal to inherit.
else, removes topic from all_user_topics.

Added get_topic_visibility_policy which returns visibility_policy
if stream_id is not undefined else return false.

Added 2 helper functions is_topic_muted and is_topic_unmuted which
uses get_topic_visibility_policy and return true if topic is
muted and unmuted respectively else return false.

Replaced switch case statement which was using add_muted_topic
and remove_muted_topic functions in set_user_topic with new function
update_user_topics.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani 46cabdd59e user_topics: Use new API endpoint to update topics_visibility_policy.
Removed functions mute_topic and unmute_topic in muted_topics_ui.js
which were using old API endpoints to mute/unmute topics.

In user_topics.js added new function set_user_topic_visibility_policy
which uses new API endpoint `/user_topics` to update the topic's
visibility_policy to visibility_policy passed to
set_user_topic_visibility_policy function as a parameter.

In functions toggle_topic_mute and mute_or_unmute_topic, replaced
the calls of mute_topic and unmute_topic with the new
user_topics.set_user_topic_visibility_policy function.

Added "web/src/user_topics.js" in EXEMPT_FILES in test-js-with-node
as adding function `set_user_topic_visibility_policy` resulted in
user_topics.js losing 100% test coverage.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani 83fae2f710 user_topics: Rename global map visibility_policy to all_visibility_policies.
Fixes #24244
2023-04-11 09:51:01 -07:00
Sahil Batra e010cb3d5a settings_config: Add "Nobody" group option to system_user_groups_list.
This commit adds "Nobody" group option to system_user_groups_list in
settings_config.js. We do not allow can_remove_subscribers_group to
be set to "Nobody" group currently, but it is nice to add support
for this here since it will be used in more settings in future.
2023-04-11 09:02:09 -07:00
Sahil Batra 9278a219ea user_groups: Refactor get_realm_user_groups_for_dropdown_list_widget.
This commit refactors get_realm_user_groups_for_dropdown_list_widget
function to use "group_permission_settings" module instead of
passing variables like "allow_internet_group", etc. individually
for each settings.

We lose some test coverage due to this commit, but that would be
fixed when we add some more group-based settings and allow groups
other than system groups in the group based settings.
2023-04-11 09:02:09 -07:00
Sahil Batra a5cbf95c12 settings: Add group_permission_settings.ts.
This commit adds a new module group_permission_settings.ts
which is used to define configuration options like
allow_owners_group, allow_nobody_group, etc. for group-based
settings similar to GroupPermissionSetting dataclass we have
in backend.
2023-04-11 09:02:09 -07:00
Aman Agrawal 8c744752ed stream_privacy: Use new lock and hashtag icons.
This commit doesn't modify the lock and hashtag icon in settings.
2023-04-10 23:41:30 -07:00
Aman Agrawal bc8d136d5c css: Implement new design for recipient row.
This mostly includes the CSS changes for recipient row design,
most of the HTML and JS changes are present in previous commits to
this.
2023-04-10 23:41:30 -07:00
Aman Agrawal 3711d0ae69 message_list: Update recipient bar color on theme change. 2023-04-10 23:41:30 -07:00
Aman Agrawal 4b35164bca recipient_row: Add a user icon at start of PMs. 2023-04-10 23:41:30 -07:00
Aman Agrawal 819bf9b2aa recipient_row: Add `>` icon between stream name and topic. 2023-04-10 23:41:30 -07:00
Aman Agrawal 7e473003a6 recipient_row: Use a dimmed stream color for background.
Following important changes are being made here:
* color_class lib is removed since it not used anywhere now.
* We don't need the `dark_background` class since the background
  color is already adjusted based on color scheme. So, all
  instances of it being used is removed.
2023-04-10 23:41:30 -07:00
Aman Agrawal 023584e049 recipient_row: Set color of privacy icon as a shade of stream color. 2023-04-10 23:41:30 -07:00
Aman Agrawal ff6d04f88c drafts: Use generic template to show stream icon. 2023-04-10 23:41:30 -07:00
Aman Agrawal 12ac459379 recipient_row: Use generic template to show stream icon.
stream_privacy template has conditions to show stream privacy icon
for all the cases, so we use it here since we also want to show
`#` icon for public streams.
2023-04-10 23:41:30 -07:00
Aman Agrawal 17a4140773 ui_util: Extract listener for change in `preferred-color-scheme`.
This will further be used for recipient bar colors since they
have different colors in dark and light color scheme.
2023-04-10 23:41:30 -07:00
Aman Agrawal 397ca97060 stream_color: Remove redundant `update_historical` option.
This option has no significance anymore. Both the callers to this
function pass it as `true`, so it is always true when it is being
run.
2023-04-10 23:41:30 -07:00
Aman Agrawal e37f5082de recipient_row: Remove message-header-wrapper div.
This div serves no purpose. Just removed the div and shifted
corrected alignment for other divs.
2023-04-10 23:41:30 -07:00
N-Shar-ma d0f9e23ec6 markdown: Fix lists with 3+ digit markers retaining alignment for 2 digits.
Until now, lists with 3+ digit markers would have their beginnings cut off
to align with 2 digit markers. We fix that by having custom styling for
markers where we align markers only up to 2 digits, and let larger numbers
take up more space pushing the list item content forward as required to fit
the marker.
2023-04-10 21:54:51 -07:00
Lakshay Mittal 4478f8cc55 local echo: Fix tooltip over locally echoed spinner.
Despite the timestamp being hidden while sending the message, the link
on the timestamp (message url) was still hoverable and clickable, and
had a tooltip.

Here we disable the tooltip, but
https://github.com/zulip/zulip/issues/25069 remains open for the link
part.
2023-04-10 17:36:26 -07:00
Lakshay Mittal e86fe4e57c messages: Add spinner for messages sent on slow connections.
At times, it might get confusing for users who are on
slow connections if their messages has not been sent
even after 5s. Including a spinner that will only show
up after 5 seconds has elapsed will keep user informed
about their slow connection.

5s is set as minimum time because showing up a spinner
before than might be distracting for users on normal
connections.

Fixes: #19328.
2023-04-10 17:36:26 -07:00
Mateusz Mandera 1a15449e16 support: Rename "downgrade plan" to "modify plan".
Just a naming change to facilitate adding more options to that <select>
- mainly, an option to upgrade the plan to Plus.
2023-04-10 17:32:45 -07:00
Ujjawal Modi 10adb6c183 settings: Reword permissions notice banners.
Reworded the permissions notice banners on
adding bots panel,user groups panel and custom
emoji panel.
2023-04-10 16:28:12 -07:00
Ujjawal Modi c89ca2e862 settings: Improve permissions notice banners.
This commit changes behaviour of banners
in user groups panel and emoji settings panel
under organization settings.

Now banner in these panels is only
shown when user is an administrator or user
does not have permissions to perform actions
on panel.

Fixes #24157.
2023-04-10 16:28:12 -07:00
Elizabeth Funk bff6be22eb flatpickr: Add check for undefined 'hotkey' to fix type errors.
The flatpickr keyboard UI functions are very confusing. We previously
had a bug where typing keys that were not keyboard shortcuts or
numeric values could throw an exception due to accessing hotkey.name
when hotkey was undefined.

Fix this, and add a bundle of comments improving the documentation of
this confusing code path. Unfortunately, the implementation is still
somewhat mysterious; we leave debugging that to future work.

Fixes #24773.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2023-04-10 12:56:30 -07:00
Tim Abbott c76adf1e89 compose: Ensure compose box is focused after inserting any content.
In `insert_syntax_and_focus`, we now explicitly focus the textarea
before inserting the content, rather than relying on insert() to do
this for us. A comment is added documenting the quirks of insert that
require this.

This fixes a bug where the compose box might not be focused after
inserting video call links, emojis from the picker, GIPHY gifs, and
some other buttons.
2023-04-10 12:46:44 -07:00
AcKindle3 02364dd69f web: Use `uri` instead of `url`.
Following the issue #23380 and PR #25038, this commit changes all
occurences of `uri` into `url` in all comments, local variables,
handlebars templates (.hbs) function names and their callers in
all `.js` and `.ts` files.
2023-04-10 10:26:48 -07:00
Lakshay Mittal 5a89d3b4d2 search: Fix selecting all messages from recent conversations.
When there are no operators to narrow down
the search to, pass into `deactivate()` if
we're in `recent conversations`.

If we are, it will go to `all messages`.

This is done by using `is_visible()`
function of `recent_topics_util`.
2023-04-10 10:24:00 -07:00
Lauryn Menard af0b450817 templates: Update `invite_users_modal.hbs` for undefined variables.
Removes undefined `time_input` from  `invite_users_modal.hbs`.
The default input value for the expiration custom time limit is
not set until the "custom" option is selected from the dropdown.

Removes the undefined `csrf_input` from the same template. And
imports `csrf.ts` into `invite.js` to get the csrf token and
add it to the request data, which is the current pattern used
in other `/web/src` modules.
2023-04-10 09:07:11 -07:00
sbansal1999 ea2de5b0a4 js: Break cyclic dependency between topic_list and topic_list_data.
This commit breaks the cyclic dependency between "topic_list.js"
and "topic_list_data.js".

It achieves this by passing "search_term" generated by the
"get_topic_search_term" function to "topic_list_data.js" directly
through the function call from "topic_list.js".
2023-04-10 08:55:06 -07:00
Hardik Dharmani daad0a6618 navbar: Fix alignment of `search_close` icon on device width < $sm_min.
This commit fixes the alignment of the `search_close` icon on devices
with a width less than $sm_min (576px) by removing a top padding
of 5px and adjusting the position to top 5px from the previous 4px.
2023-04-10 08:09:18 -07:00
Lauryn Menard 95d48bc2ad topic-list-data: Increase max topics shown in left sidebar.
Incresase the max number of stream topics shown when not zoomed
into the stream for more topics in the left sidebar to be a max
of 8 unread conversations and 12 when there are unreads.
2023-04-07 15:10:24 -07:00
sbansal1999 e1a2789de2 js: Break cyclic dependency between top_left_corner and unread_ui.
This commit breaks the cyclic dependency between "top_left_corner.js"
and "unread_ui.js".

It achieves this by shifting the "animate_mention_changes" function
from "unread_ui.js" to "top_left_corner.js".
2023-04-07 15:04:26 -07:00
brijsiyag ee1a83996a user-profile: Prevent unintended clicks through profile modal overlay.
When a user opens a profile modal, the overlay is clicked
through in responsive mode, which results in unintended button/link
clicks. This commit removes the causing CSS properties
`pointer-events:none;` which was passing pointer-events to other
elements and `pointer-events:all` which is experimental and do no
effect.
2023-04-07 10:09:04 -07:00