Commit Graph

14605 Commits

Author SHA1 Message Date
evykassirer 53d8abe79b compose_state: Use stream_name() and topic() universally.
This change ensures that every call to find the stream name or topic
in the composebox is calling compose_state functions instead of directly
taking a value from an HTML element specified by a classname.

This has better code readability and abstracts away the classname,
and also makes it easier to change which classname we use (which
will be happening in an upcoming change as part of switching the
stream name field to a dropdown).

Note that this change means that the stream name will always be
trimmed, whereas before it was whatever the user had written even
if it had trailing whitespace. This shouldn't be an issue as far
as we (me + Tim) can tell, and also it will become irrelevant as
soon as the dropdown changes land.
2022-12-15 17:26:04 -08:00
evykassirer 7f9989003a compose_state: Break out stream_name() into separate getter and setter.
This code is equivalent, because the keep_leading_whitespace parameter
of get_or_set was never used for the stream name.

This addresses an open TODO and makes the code more readable.
2022-12-15 17:25:36 -08:00
Tim Abbott 6200f0f734 narrow: Inline set_narrow_title helper.
Now that it only has a single caller, it's easier to read the code to
get rid of this tiny helper.
2022-12-15 13:09:35 -08:00
Lauryn Menard 7c083edb96 narrow: Update narrow title for undefined filter views.
Updates `compute_narrow_title` to cover the two cases for views
with undefined filters: "All messages" and "Recent conversations".

Also, moves the call to `notifications.redraw_title` from
`set_narrow_title` and to `update_narrow_title`.
2022-12-15 13:05:22 -08:00
Lauryn Menard 7686bca385 narrow: Refactor logic for getting narrow title for browser/tab.
Creates a new function, `compute_narrow_title`, that returns a
string for the narrow title based on the current filter, so that
`update_narrow_title` can call that function, and then use the
returned string to set the narrow title.

Adds a node test for the new `compute_narrow_title` function for
cases that differ from the title generated by `filter.get_title`.
2022-12-15 13:05:22 -08:00
Tim Abbott 0bc47b1c77 invite: Display globe icon for web-public streams.
This requires both passing through the is_web_public parameter to the
template, and a bit of CSS to make the globe not huge.
2022-12-14 21:04:12 -08:00
SameepAher ebd0908ae6 invite_users: Add globe icon in web public streams.
This is implemented by reusing the stream_privacy handlebars helper.

We can't use it in the public stream case, because the design of the
invite users modal uses no space between the `#` and the stream name.

Fixes part of #23496.
2022-12-14 20:58:29 -08:00
SameepAher 7e4b9a3c01 invite_users: Discard "#" in private streams.
Added an if statement which renders "#" only when it's not "invite only".

Fixes part of #23496.
2022-12-14 20:51:43 -08:00
evykassirer 1b0a14bf40 compose banner: Add specific functions to clear warnings and errors.
Instead of removing all compose banners, we now remove only warnings
and errors -- this makes no difference right now, but this change
will allow us to add other compose banners that are cleared at
different times.
2022-12-14 20:36:07 -08:00
Josh Klar 2e825f637d css: Apply negative spread radius to message box-shadows.
This fixes a visual regression in newer Electron builds (without
regressing Firefox) for which I still don't entirely know the root
cause, where extra "borders" were being applied to messages in both
streams and PMs. Applying a negative "spread radius" to the box-shadow
properties of these elements, and moving that pixel to the "horizontal
shadow" aspect of the property (which is used to create the left-side
"ruler" effect), restores the expected look and feel.

Tested in qutebrowser (Chromium 87-based), Electron v18+v19, and Firefox
107.

Refs (and should unblock) zulip/zulip-desktop#1251
2022-12-14 17:28:37 -08:00
Anders Kaseorg b0c1b2c37f styles: Delete useless rules for stream and topic names.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Anders Kaseorg 34306ba1f3 styles: Don’t clip tall characters in stream and topic names.
Fixes #23867.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Rishant Rokaha eed13cecff
stream_settings: Fix invisible view stream btn for private streams.
If new stream is created as one of the two private options, the view stream button was not visible 
immediately, but does appear after a page refresh. This bug turns out to be caused by the wrong
selector being used in the code intended to make the button visible.

Fixes: #22556.
2022-12-14 12:44:00 -08:00
N-Shar-ma 38587b79b9 compose: Always preserve cursor position post replacement in a textarea.
Refactored (moved) the code for preserving the cursor's initial logical
position from `quote_and_reply()` in `compose_actions.js` which calls
`replace_syntax()` directly into `replace_syntax()` in `compose_ui.js`.
This ensures that anytime text in a textarea is replaced, the original
cursor position is always restored.

Earlier, this was needed to be done separately, and missing that would
lead to bugs with the cursor unexpectedly jumping on replacement.

Fixes: #23863.
2022-12-14 12:40:51 -08:00
Rohitt Vashishtha 8d539cff8f css: Remove unneeded 35px right margin from recipient row.
This margin doesn't make sense in a wider view, and is actually
a hinderance to the layout on narrower screens, and removing it still
keeps more than enough separation from the buttons on the right.
2022-12-14 12:27:23 -08:00
Rohitt Vashishtha f6f2f9e70a css: Prevent composebox to_text from getting wrapped.
Even when there is space, the to_text was getting wrapped in languages
that have more than one word for "To:", like Korean.
2022-12-14 12:27:23 -08:00
Sahil Batra d0626bbaef message_edit: Remove get_editability function.
This commit removes get_editability function and we can instead
use is_content_editable and is_topic_editable/can_move_message
functions to check the permissions. We can remove get_editability
since there is no longer a sort order to the possibilities and
it is not necessary that if a user has permission to edit content
then they can edit the topics also.

So, this commit adds is_message_editable_ignoring_permissions
check to is_content_editable and also modifies the tests accordingly.
2022-12-13 23:11:50 -08:00
Sahil Batra 98c4e11d0b settings: Organize message editing and message moving settings.
We separate the message editing and message moving settings
into different sections.

We do not change the help-links for the section headings and keep
both of them same linked to "Configure message eiditng and deletion"
as we would anyway be changing or spliting this page and can update
the links at that time.
2022-12-13 23:11:50 -08:00
Sahil Batra 939a6edf0f settings: Rename helper function to check who can edit topics.
This commit renames "can_edit_topic_of_any_message" function
in models.py to "can_move_messages_to_another_topic" and
"user_can_edit_topic_of_any_message" function in settings_data.js
to "user_can_move_messages_to_another_topic".

This change is done since topic editing permission does not
depend on message sender now and messages are considered same
irrespective of whether the user who is editing the topic had sent
the message or not. This also makes the naming consistent with
what we use for the label of this setting in webapp and how we
describe this action in help documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra ac96db2d95 settings: Update labels of settings for moving messages.
This commit updates the labels for "edit_topic_policy" and
"move_messages_between_streams_policy" settings.

The label for topic editing setting is changed to
"Who can move messages to another topic" since the topic
edit permissions do not depend on message sender now and
messages are considered same irrespective of whether the
message was sent by the user editing the topic or by
someone else.

The label for stream editing setting is changed to
"Who can move messages to another stream".

These changes also makes the labels consistent with how these
actions are described in help center documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra 24a1f7b792 message_edit: Topic editing permission should not depend on message sender.
This commit changes the topic edit permssions in webapp to not depend
whether the user editing the message had sent the message or it was sent
by someone else. Backend changes were done already in previous commits.

Previously, we always allowed topic edits when the user themseleves had
sent the message not considering the edit_topic_policy and the 3-day time
limit. But now we consider all messages as same and editing is allowed only
according to edit_topic_policy setting and the time limit of 3 days in
addition for users who are not admins or moderators.
2022-12-13 23:11:50 -08:00
Sahil Batra e6ec2badb5 message_edit: Make topic editing independent of allow_message_editing.
We now allow editing stream and topic of message even if
allow_message_editing if False using webapp given that is
allowed as per other topic and stream edit specific settings.

Fixes a part of #21739.
2022-12-13 23:11:50 -08:00
Sahil Batra ad9a7d2e06 message_edit: Add "Nobody" option for move_messages_between_streams_policy. 2022-12-13 23:11:50 -08:00
Sahil Batra 02eee3a04f message_edit: Add "Nobody" option for edit_topic_policy setting. 2022-12-13 23:11:50 -08:00
N-Shar-ma de4ae16989 polls: Replace `choice` with `option` in the poll editing UI.
All instances of `choice` have been replaced with `option` in the UI
for editing a poll. In code, `option` was already being used. This
ensures the same terminology is used across the code, the UI and the
related help center article.
2022-12-13 16:57:44 -08:00
Ujjawal Modi 35f05631dd css: Fix spilling out of long email on email change confirmation.
In the email change confirmation page, now long emails break to
multiple lines instead of spilling out.

Fixes #23654.
2022-12-13 16:29:10 -08:00
Yuri Sulyma 911b3b5365 ts: Convert util.js to TypeScript; add (Raw)Message type in types.ts.
Co-authored-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:23:29 -08:00
Zixuan James Li b757c1a9b6 util: Move is_pm_recipient to compose_fade_helper.
"is_pm_recipient" is not supposed to be called with an arbitrary
recipient object which might have "to_user_ids" being undefined.
Since this helper is only used with focused_recipient in
compose_fade_helper, we move it there.

Note that the helper is no longer separately tested. It is now covered
by the test case of "compose_fade_helper.would_receive_message".

(See
5e74a8d0cc/static/js/compose.js (L156-L162))

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:20:36 -08:00
Zixuan James Li 55793cb4d5 util: Stringify possibly undefined values.
This avoids "@typescript-eslint/restrict-template-expressions" when we
convert util.js to util.ts.

Note that prettier would otherwise split the first template literal
expression in half if we don't start a newline.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:20:36 -08:00
Zixuan James Li a3a0103d86 markdown: Calculate linkifier precedence in topics.
This uses the linkifier index among the list of linkifiers in the
replacement as the priority to order the replacement order for
patterns in the topic. This avoids having multiple overlapping matches
that each produce a link.

The linkifier with the lowest id will be prioritized when its pattern
overlaps with another. Linkifiers are prioritized over raw URLs.

Note that the same algorithm is used for local echoing and the
backend markdown processor.

Fixes #23715.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:16:20 -08:00
Zixuan James Li 4602c34108 markdown: Correctly retrieve indices for repeated matches.
The same pattern being matched multiple times in a topic cannot be
properly ordered using topic_name.find(match_text) and etc. when there
are multiple matches of the same pattern in the topic.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:16:20 -08:00
Sahil Batra c31dc14e9d css: Remove bootstrap CSS rules for textarea elements.
We remove bootstrap CSS rules for textarea elements
from bootstrap.css file since we already added required
CSS rules to the individual elements.
2022-12-13 12:03:06 -08:00
Sahil Batra 26b7e40ac5 invite: Add bootstrap CSS rules to emails textarea in invite overlay.
This commit adds required bootstrap CSS rules used for emails
textarea element in invite modal with existing CSS for that
element in zulip.css. We also change the selector to use class
instead of ID such that the dark theme CSS can take precedence
when using dark theme.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 264bfd4583 message_edit: Add bootstrap CSS rules to message edit textarea.
This commit adds required bootstrap CSS rules used for message-edit
textarea element with existing CSS for that element in zulip.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 735743879a compose: Add bootstrap CSS rules for compose textarea.
This commit adds required bootstrap CSS rules used for
compose textarea element in with existing CSS for that
element in compose.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 74b985ccce billing: Add bootstrap CSS rules for textarea in sponsorship page.
This commit adds required bootstrap CSS rules used for textarea
element in sponsorship page with existing CSS for that element
in billing.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra cb699d6c10 support: Add bootstrap css rules to textarea element in support page.
This commit adds required bootstrap CSS rules used for textarea
element in support page with existing CSS for that element in
portico_signin.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 2e93a4ccd6 integrations_dev_panel: Add CSS rule for textarea elements.
This commit adds bootstrap CSS rules used for textarea element
in devtools integrations panel in integerations_dev_panel.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra fc21e68a9e settings: Set margin-bottom for email field in deactivate modal.
This commit adds margin-bottom property to CSS of email field
in user deactivation modal with other CSS properties for this
field in settings.css since we are going to remove bootstrap
CSS rules in further commits.
2022-12-13 12:03:06 -08:00
Sahil Batra 1c0b9b8c7a css: Extract common bootstrap CSS rules for textarea in settings.
This commit extracts some common bootstrap rules used for textarea
elements in settings (both organization and stream settings) and
this rules are added for settings_textarea class. We also add
settings_textarea class to the textarea elements in settings.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
N-Shar-ma 571f6b1e91 message_edit: Fix the name of a property being accessed wrongly.
The `stream_id` property of a stream object was being wrongly accessed
as `id`, which does not exist, in the function
`get_available_streams_for_moving_messages()`

This led to the current stream not being rendered in the dropdown list
as expected in the `Move Topic` modal when the user does not have the
permission to post in the current stream.
2022-12-13 11:54:30 -08:00
Aman Agrawal 36354f0625 message_list: Remove message_list.narrowed from code. 2022-12-12 18:04:11 -08:00
Aman Agrawal e5b5bd4f28 narrow: Don't update selection if user changed narrow.
We don't need to select the message after fetching messages if
the user changed the narrow in the meanwhile.

Note that in this context, message_lists.current ===
message_list.narrowed.
2022-12-12 18:03:11 -08:00
Tim Abbott 5f4faaf22c message_fetch: Pass msg_list to load_messages_for_narrow.
This tweak makes the code easier to reason about and may also help
generalize the codebase to support maintaining multiple message lists.
2022-12-12 08:45:58 +00:00
evykassirer 7d17a11db0 compose banner: Rename banner shown after message is sent.
This is both more clear regarding what the banner does, and is now
in the same folder as the other compose banners.
2022-12-11 17:51:35 -08:00
evykassirer 44c0be7a31 drafts: Move functions out of `launch()` context, for other use.
No functional changes. Moves functions so that other code in this
file can access them.
2022-12-11 17:46:52 -08:00
Clara Gallon 1fea98499d settings: Add "(200×25 pixels)" to wide organization logo description.
Fixes part of #22121.
2022-12-09 17:42:24 -08:00
Anna Larsson 305fb62fb0 search reference: Reorder operators.
The new ordering matches that used in the Help Center search operators
page, which we just reordered to better highlight more frequently used
features.

Fixes #23768.
2022-12-09 17:37:37 -08:00
Anna Larsson 69304eb2d2 search reference: Replace 'email' with 'user'.
Previously, we used `sender:email`, for example, in our examples for
how to use search operators. This is correct for what ends up in the
search input, but the typeahead has a much nicer experience for
selecting a user, and the emails may be fake due to limited
email_address_visibility, so it's clearer to just refere to a user
here.

Fixes part of #23768.
2022-12-09 17:37:29 -08:00
David Rosa a153e9232e Rename "operators" to "filters" in "Search operators" reference.
Changes all the uses of the word "operators" to "filters" in the
in-app "Search operators" reference to align with the updated help
center documentation.

Fixes #23767.
2022-12-09 13:52:13 -08:00
mustafa0x 3b0e311f83
search: Fix missing ARIA role on span used as button. 2022-12-09 13:29:59 -08:00
Sayam Samal cfacb6fe25 user_profile: Convert preview profile to sticky button.
Having the preview profile button always visible makes it more
accessible when the user is at a random scroll positon in the
profile settings.
2022-12-09 13:27:15 -08:00
Rebeca Carvalho a516a13220
move messages: Use case-insensitive sorting in stream selection.
Previously, the options in the stream selection dropdown were sorted in a case-sensitive
fashion, which felt a bit harder to use than just sorting alphabetically irrespective of case.

Fixes: #23283
2022-12-09 11:19:48 -08:00
Sahil Batra 15dbf9742d stream_settings: Remove code for stream privacy modal.
This commit deletes all the functions, CSS and other code
for stream privacy modal since we have udpated the UI to
show stream permission settings always in "General" section
and not inside the modal.

Fixes a part of #19519.
2022-12-09 11:16:26 -08:00
Sahil Batra 404ce8887c stream_settings: Add code to live-update stream settings.
Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler 6237a7b284 stream_settings: Add code to save changes in stream permissions.
This commit adds code to save changes in stream permission
settings.

This commit makes some changes to code in settings_org.js to
handle stream settings and add corresponding handler for
save button in stream_edit.js. We also add a new function
get_request_data_for_stream_privacy to get the data for
stream privacy which can be send with the API request.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler a2a92b52f6 stream_settings: Add code to discard changes in stream permissions.
This commit adds code to discard changes in stream permission
settings.

This commit makes some changes to code in settings_org.js to
handle stream settings and add corresponding handler for
discard button in stream_edit.js.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler 445957df05 stream settings: Show save/discard widget when settings change.
This commit adds code to show save-discard widget when stream
permission settings are changed and subsequently hide it when
the setting is again changed to original value.

Some important code changes -
- Added code in "settings_org.js" to handle stream settings.
- Added handler in "stream_edit.js" to show or hide the
save-discard widget when settings are changed.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler b871ffe712 stream settings: Always show stream settings.
We now show the stream permission settings - stream privacy,
stream post policy and stream message retentions setting,
always in the "General" section of stream settings instead
of showing it in the modal. The setting elements are
disabled for users who cannot change them.

Some important changes are -
- Add proper classes and IDs to the elements such that
code in settings_org.js can be used to set and change these
settings.
- Code in "settings_org.js" is updated to be able to set
stream message retention setting while rendering the page.
- Added enable_or_disable_permission_settings_in_edit_panel
function in stream_ui_updates.js (since that will also be
used in live updating code) to disable the setting elements
if required.
- We also update update_web_public_stream_privacy_option_state
function such that we can correctly enable/disable web-public
option in stream edit panel based on permissions.
- Added code for save-discard widget in stream_settings.hbs in
this commit but code to implement the correct behavior of it
will be added in further commits.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Sahil Batra e64c1948ed app_components: Refactor css for save-discard widget.
We change the CSS for save-discard widget to not be inside
"#settings_page" selector such that it can be used as a
common component for stream settings also.

This commit also updates the selectors to be more specific
such that the ".new-style.button" css cannot override
these rules.
2022-12-09 11:16:26 -08:00
Sahil Batra 59b7a68e71 settings_org: Update populate_data_for_request to have module-level scope.
This commit changes populate_data_for_request to have module-level scope
and not be defined in register_save_discard_widget_handlers, so that we
can use this function for stream settings too in further commits.
2022-12-09 11:16:26 -08:00
Sahil Batra c96dd02084 settings: Remove unused CSS and corresponding organization-submission class.
This class was used for setting margin-top as 0 but since the default value
of this property is already 0, this CSS is not required and thus we can
remove this class also since it is not used anywhere else.
2022-12-09 11:16:26 -08:00
Lauryn Menard 6b3fbab520 narrow-banner: Update default empty banner text to be more general.
Updates the default empty narrow banner text to be more generally
applicable, particularly in the case when all messages have been
moved to a new topic.
2022-12-08 13:01:33 -08:00
Alex Vandiver bfbdd8fd7e analytics: Show N/A for guests and file storage when those are not known. 2022-12-08 12:42:41 -08:00
Lauryn Menard dfa8ef09d8 org-settings: Fix jquery id selector for join organization settings.
Fixes the id used to select and disable the properties for org
admins on the organization permissions settings tab.
2022-12-08 11:36:32 -08:00
evykassirer 291df7ac2a compose notifications: Add # before stream name in notification header. 2022-12-07 16:17:09 -08:00
Sahil Batra ee04677d4b settings: Remove ID from discard button in save-discard widget.
This commit removes ID from discard button in save-discard widget.

Generating IDs using variables results in difficulty to grep
the code and we can anyway access the discard button by using
ID of the settings-subsection-parent div. Also, we do not use
ID to access this button, so we can change this safely.
2022-12-07 10:23:47 -08:00
Sahil Batra 821a409c8b settings: Remove ID from save button in save-discard widget.
This commit removes ID from save button in save-discard widget.

Generating IDs using variables results in difficulty to grep
the code and we can anyway access the save button by using
ID of the settings-subsection-parent div.
2022-12-07 10:23:47 -08:00
Sahil Batra 4b46f08b5f settings: Use subection-parent div to get subsction.
We used id of save-button to get subsection parameter
which is passed to get_complete_data_for_subsection.

This commit now changes it to instead get subsection
from settings-subsection-parent div. We also change
the id of settings-subsection-parent div of organization
joining settings in this commit to be a more reasonable
name as per this change.
2022-12-07 10:23:47 -08:00
Anders Kaseorg 872f4b41c1 ci: Check that non-scripts aren’t marked executable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-07 09:54:01 -08:00
Akarsh Jain 761ca16d6d
css: Add min-width to user presence dot. (#23526)
Previously user presence dot in the right sidebar becomes narrower 
when there is unread counter, and as such, this commit adds a min-width 
to the user presence dot.

Fixes: #23519
2022-12-06 16:15:55 -08:00
evykassirer e9045dcd58 compose: Rename compose_error to compose_banner.
It no longer handles only error messages, but banners of multiple
types.
2022-12-06 15:43:49 -08:00
evykassirer f9c72701c6 compose: Migrate compose_private_stream_alert to use compose_banner.
This is part several updates for #22524.

Notes:

* data-stream_name isn't needed in the template (before or after),
  since there is not even an action button that could use it.
2022-12-06 15:43:34 -08:00
evykassirer 086f02a3ab compose: Migrate compose_not_subscribed to use compose_banner.
This is part several updates for #22524.

This commit also removes `compose_error.hide()` since there is only
one remaining use of it (which has been replaced by the contents of
`hide()`). Eventually `#compose-send-status` should be replaced
fully in a future PR, after we rewrite the upload banner to use
the new banner template.

Testing note: I removed the test test_compose_not_subscribed_clicked
since it heavily relies on the old way of rendering banners and is too
UI-focused (instead of logic focused) for me to feel like it's worth
testing that the banner is removed when clicking the button.
2022-12-06 15:43:34 -08:00
evykassirer 8ced075643 compose: Migrate compose-all-everyone to use compose_banner.
This is part several updates for #22524.

Testing note: I removed the test test_compose_all_everyone_confirm_clicked
since it heavily relies on the old way of rendering banners and is too
UI-focused (instead of logic focused) for me to feel like it's worth
testing that the banner is removed when clicking the button.
2022-12-06 15:43:34 -08:00
evykassirer ab5d088188 compose: Migrate compose_invite_users to use compose_banner.
This is part several updates for #22524.

Testing note: I removed the tests test_compose_invite_users_clicked
and test_compose_invite_close_clicked, since they heavily relied on
the old way of rendering banners and were too UI-focused (instead of
logic focused) for me to feel like it was worth testing that the
banners removed when clicking the buttons.
2022-12-06 15:43:34 -08:00
evykassirer f1c6fc13e7 compose: Migrate generic error to use shared banner template.
Error banners were rendered in a different place than warnings.
Now compose errors and warnings share the same template and styling
in compose_banner.hbs

Testing notes:
* I removed test_message_overflow since it seemed not to test
  anything that test_check_overflow_text wasn't already testing.
* private_message_recipient() can't be called to set emails to non-valid
  emails, so `invalid_recipient` cannot be tested (and is likely very
  difficult to trigger in production, if possible at all).
2022-12-06 15:43:33 -08:00
evykassirer 85cbd324eb compose: Create shared compose banner and use for resolved topic warning.
This is the beginning of a fix for #22524 which converts several
banners to a new style. As a part of that set of changes, this
commit creates the shared template and warning styling. The
resolved topic warning was picked (for no particular reason)
to migrate first. Further commits updating other banners
to follow.
2022-12-06 15:42:07 -08:00
evykassirer dc4f933f4f compose banners: Fix move topic permissions.
Not resolving a topic does not involve moving messages between streams.
2022-12-06 15:40:41 -08:00
Aman Agrawal ca835ec943 actions_popover: Attach emoji_popover to correct reference.
If the selected message was different from the message where
actions popover was present, it resulted in emoji popover being
attached to the selected message instead of the one where
actions popover was present.
2022-12-06 09:58:40 -08:00
Aman Agrawal b1d0c36744 emoji_picker: Remove unused arg.
Looking at the history of build_emoji_popover, it never took a
3rd argument.
2022-12-06 09:58:40 -08:00
Aman Agrawal bab596e5b4 emoji_picker: Directly use $elt. 2022-12-06 09:58:40 -08:00
Aman Agrawal 96a93339cd popover: Remove unused code.
exclude_tippy_instance was not being used correctly since it was
never defined as an `opts` property for `hide_all_except_sidebars`.

Everything seems to be working fine without this. I recall that
popovers seems to be hidden before they were displayed for which
this was required but it doesn't seem to be needed anymore.
2022-12-06 09:58:40 -08:00
Aman Agrawal 13b478f81f popovers: Add comment to clarify hideAll is a tippy function.
This helps some reviewing the code or just skimming through.
2022-12-06 09:58:40 -08:00
Aman Agrawal ae3e3fa3cc popover_menus: Add a comment explaining why we use parse_html. 2022-12-06 09:58:40 -08:00
Aman Agrawal eb45925b1a actions_popover: Use tippyjs instead of bootstrap to display popover.
Fixes #23494
Popover now automatically displays on left when there is not
enough space top or bottom of the reference element.
2022-12-06 09:58:40 -08:00
Aman Agrawal 6a1ae465cc css: Let actions popover icon take maximum possible width & height.
We need to fill width of `actions_hover` with padding of
`zulip-icon`, so that hovering over `.actions_hover` shows you
tooltip and clicking on it shows popover.
2022-12-06 09:58:40 -08:00
Aman Agrawal 4593fcf8d1 actions_popover: Move data to display the popover to a new module.
Since we are switching to tippyjs to display popovers, extracting
this data in a commit of its own, makes further changes easier to
review and merge.

Also, we could add tests with full coverage on the data
provided to popovers, possibly a good first issue for beginners.
2022-12-06 09:58:40 -08:00
Aman Agrawal 8b6dc955f1 popover_menus: Stop propagating click events when opening a popover.
This could result in things like compose box being opened by the click
that opens the popover.
2022-12-06 09:58:40 -08:00
Aman Agrawal 223dca65b2 popovers: Remove part of `reminder` feature.
While `reminder` feature is disabled right now, we need to delete
these functions to avoid conflicts when porting the actions
popover from bootstrap to tippy.
2022-12-06 09:58:40 -08:00
Aman Agrawal 0b9ef0dcf6 popover_menus: Keep element click handlers self-contained.
Hide the popover explicitly inside the event handler of the element.
Also, stop propagating events outside the popover. We add
`navigate_and_close_popover` class to links inside popovers
which don't have any click handler and do the same for them.
2022-12-06 09:58:40 -08:00
Aman Agrawal 95224d680f popover_menus: Adjust comment.
Looking at this again, I was just confused about how we
were propagating events and this seems to be working as it should.
2022-12-06 09:58:40 -08:00
Aman Agrawal 43578847e3 popover_menus: Remove incorrect `return`. 2022-12-06 09:58:40 -08:00
Sahil Batra 5e74a8d0cc subscriptions: Remove redundant CSS rule.
We can remove the "padding-left: 0px" rule for
"label.radio" element now since the default value
for padding property is 0 and we have also removed
the bootstrap applied "padding-left: -20px" rule
in the previous commit.
2022-11-30 17:35:22 -08:00
Sahil Batra a04128f0bd bootstrap: Remove radio input CSS from bootstrap.css.
We have already added the CSS rules added by bootstrap to
individual elements with common rules for all radio buttons
being added in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra 53eeae9019 compose: Do not use bootstrap css for "Enter to send" radio buttons.
We rewrite the CSS rules, handled by bootstrap for the radio buttons of
"Enter to send" setting, to compose.css as we are in process of
removing bootstrap.

The line-height property added to input element by bootstrap is not
added to subscriptions.css since it is already added for all inputs
in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra d2b48fab27 streams: Do not use bootstrap CSS in stream privacy choices inputs.
We rewrite the CSS rules, handled by bootstrap for the radio buttons
for stream privacy choices (in both stream create and edit form),
to subscriptions.css as we are in process of removing bootstrap.

The settings-radio-input-parent block in subscriptions.css is moved
to be top-level instead of being nested inside "stream_privacy_modal"
and "stream-creation-body" block, such that we can use this class
in future for resusable components (like settings_checkbox).

The bootstrap CSS rules are also added to this
settings-radio-input-parent selector.

The max-height property added to label by bootstrap is not added
since it does not applies to non-replaced inline elements.
The line-height property added to input element by bootstrap is
not added to subscriptions.css since it is already added for all
inputs in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra 55aaf1d56d settings: Do not use bootstrap css in radio-type display settings.
We rewrite the CSS rules, handled by bootstrap for the radio
buttons in display settings (both user and realm-level defaults),
to settings.css as we are in process of removing bootstrap.

This commit adds a new class "display-settings-radio-choice-label"
to radio label elements in the display settings and the bootstrap
CSS rules along with existing CSS defined by us for radio-type
display settings are added to this class.

This change will help us in future where we may want to have
reusable components (like settings_checkbox) for radio-type
settings with visual preview.

The line-height property added to input element by bootstrap is
not added to settings.css since it is already added for all inputs
in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra f8065dcd3d streams: Rename radio-input-parent class to settings-radio-input-parent.
This commit renames the radio-input-parent class for parent div of
stream privacy radio inputs to settings-radio-input-parent.

This change is done so that we can use this same class name for adding
other similarly styled radio inputs to be used in settings in future.
2022-11-30 17:35:22 -08:00
Sahil Batra 8f149750f3 email_log: Do not use bootstrap css for radio buttons.
We add the CSS rules handled by bootstrap for the radio
buttons in forward email modal to email_log.css as we
are in process of removing bootstrap

The elements for which CSS rules have been added are label
with "radio" class and "radio" type input elements.

The max-height property added to label by bootstrap is not
added since it does not applies to non-replaced inline
elements.
2022-11-30 17:35:22 -08:00