Commit Graph

14838 Commits

Author SHA1 Message Date
N-Shar-ma 431cd8b10a typeahead: Don't show default emojis if overridden by a realm emoji.
When a realm emoji overrides a default emoji, `:emoji_name:` now renders
as the realm emoji. Still, the typeahead menu would misleadingly show
the now overridden default emoji for the same name. Selecting it would
render as the realm emoji, which is very confusing user experience.

Now when selecting the emojis to suggest in the typeahead, the overridden
default emojis are excluded.

Fixes part of #24120.
2023-01-31 15:52:08 -08:00
N-Shar-ma 8a5b71fdbd emoji_settings: Only allow admins to override default emoji.
Uptil now, any user could add a custom emoji with the same name as a
default emoji, thus overriding it (with a confirmation after warning).

To create more friction for this action, now only admins are allowed to
add custom emojis that override default ones. All users can still add
custom emojis with other names.

Fixes part of #24120.
2023-01-31 15:50:13 -08:00
N-Shar-ma a4e477bf02 emoji_settings: Reword modal to confirm overriding default emoji.
Better explain what exact effects overriding a default emoji name has.
2023-01-31 15:46:13 -08:00
N-Shar-ma c519c31bda emoji: Fix checks for whether custom emoji may override default. 2023-01-31 15:46:04 -08:00
Tim Abbott 970071e3bd Revert "message_row: Allow time row to expand if it needs more width."
This reverts commit 2bf47c7d4b.

This appears to have resulted in the message controls being misplaced.
2023-01-31 15:39:52 -08:00
Aman Agrawal b8f91b6513 message_body: Keep the sender name padding as a different element.
This helps us align the tooltip on sender name at the center of it
while still having a tooltip in the gap between avatar and sender
name.
2023-01-31 15:35:46 -08:00
Aman Agrawal dbef64426b message: Convert `view user card` to a tippy tooltip. 2023-01-31 15:35:46 -08:00
Aman Agrawal 65f9dbc5f3 tippy: Directly use `content` property to set content. 2023-01-31 15:35:46 -08:00
Aman Agrawal 00752f8059 message: Keep user card tooltip limited to user name and avatar.
We accidentally added tooltip to open user card to a much larger
area than intended as a regression from moving the message to
use grid.

In this, we keep it limited to user name and avatar by adding
the tooltip directly to them.
2023-01-31 15:35:45 -08:00
Zixuan James Li b21f533af3 settings_users: Show all bots in organization settings.
We intended to show all the bots in the bots organization settings for
non-admin users as well. This switches from bot_data.all_user_ids() to
people.get_bot_ids() to get a full set of ids for all the bots in the
organization.

Because the source of data changes, "realm_user" instead of "realm_bot"
triggers the update of the bots list.

The code example (example4) is updated since we incorporate a side
effect into "realm_user"'s "add" op.

Note that while "realm_user" does not have a "delete" op, we still stop
redrawing bots on "relam_bot"'s "delete" op, because "delete" was only
triggered when the bot owner changes, the bot does not disappear from
the list of all bots.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
Zixuan James Li 5ecd0cecf4 people: Implement get_bot_ids.
This provides a way to access all the bot users, no matter if they are
owned or admined by the current user or not.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
Aman Agrawal 2bf47c7d4b message_row: Allow time row to expand if it needs more width.
While setting a min-width according to the current width, we allow
the time column to expand if the translated `AM/PM` time needs
more width.
2023-01-31 14:47:40 -08:00
Palash Baderia 92f085c571 recent_topics: Clear search box on show.
Fixes: #20956.

Recent topics and all messages have empty search query, so it is
important to clear the search query when switching to them, otherwise
search text from previous query is displayed.
2023-01-30 16:49:08 -08:00
N-Shar-ma 9def249af1 typeahead: Fix bug where typeahead showed momentarily on shift + tab.
Break on `keyup` for case of `shift` key, instead of letting it trigger
the typeahead.

Fixes: #24152.
2023-01-30 14:38:25 -08:00
N-Shar-ma e2e39acbc4 widgets: Make the todo and poll widgets look consistent / similar.
Earlier the todo and poll widgets' UI differed a lot, especially in the
font size and weight, and the color and shape of the checkbox and vote
count box.

Now the font weights and sizes are consistent in both the widgets and
the todo widget's checkboxes and poll widget's vote count boxes are
styled similarly.

This is the rebased and cleaned version of #21006, and is visually near
identical.

Fixes: #20283.
2023-01-30 11:51:33 -08:00
N-Shar-ma abb3881bdb refactor: Convert any instances of `pt` to `px` in `widgets.css`. 2023-01-30 11:51:33 -08:00
N-Shar-ma 92788a52bb compose: Handle hotkey triggers depending on whitespace in composebox.
The `focus_in_empty_compose` function used for hotkeys, now checks if
the compose box is truly empty by considering it's untrimmed value. If
there are just spaces in the focused compose box, `focus_in_empty_compose`
returns false now.

This fixes the bug where using the left key among just spaces did not move
back the cursor as expected, and may unexpectedly trigger edit state for
the last sent message.

For `up` hotkeys, message navigation is also triggered if the cursor is
at the start of the composebox with just whitespace. A new helper
function is added for this check.
2023-01-30 11:32:37 -08:00
Sahil Batra 6b7e588a68 css: Remove some unnecessary CSS.
This commit removes the margin-bottom CSS added for
select elements to override the margin added by bootstrap.
Since we have removed the bootstrap CSS rules for
select elements in previous commits, we can remove
the overridden CSS in this commit.

This commit also removes margin-bottom CSS for input
element in one case, because CSS in app_components.css
already overrides the current bootstrap CSS for input
element.
2023-01-26 12:36:31 -08:00
Sahil Batra 03668a4272 subscriptions: Remove unused CSS.
Since, we have removed bootstrap CSS rules for select elements
in previous commit, we do not need to set this rule since
default value of margin is 0.
2023-01-26 12:36:31 -08:00
Sahil Batra 0cf169be71 bootstrap: Remove CSS rules for select elements from bootstrap.css.
This commit removes the bootstrap CSS rules for select elements in
bootstrap.css. The requried rules are already added to specific
elements in previous commits to keep the existing design.

Fixes part of #23635.
2023-01-26 12:36:31 -08:00
Sahil Batra af36e9f823 css: Add "bootstrap-focus-style" class to select elements.
This commit adds "bootstrap-focus-style" class to the select
elements such that we can add CSS rule for focusing a select
element at single place only using this class.
2023-01-26 12:36:31 -08:00
Sahil Batra 0d4839d900 modal: Add bootstrap CSS rules for select elements in modal.
This commit adds bootstrap CSS rules used for select elements
used in different modals in modal.css.

This change is done so we can safely remove select CSS
rules from bootstrap.css as a part of our process to
remove bootstrap.

This commit also changes the CSS for propagate mode select
element in "Move messages" modal to use ID as selector
instead of class such that the width property can be
overridden correctly.
2023-01-26 12:36:31 -08:00
Sahil Batra 45fcd9ee45 settings: Add bootstrap CSS rules for select elements.
This commit adds bootstrap CSS rules used for select
elements in settings page in settings.css.

This change is done so we can safely remove select CSS
rules from bootstrap.css as a part of our process to
remove bootstrap.

Due to this change, a couple of settings have lesser
margin at the bottom than before, but they look fine
with lesser margins and anyways had unnecessarily
larger margin before.

We also update the selector used to set width of
desktop-icon-count-display setting such that the
default of 220px is correctly overridden by the
specific CSS for this element.
2023-01-26 12:36:31 -08:00
Sahil Batra a3a3f7796a stream_settings: Add bootstrap rules for select elements.
This commit adds bootstrap CSS rules used for select
elements in stream settings to existing CSS in
subscriptions.css.

This change is done so we can safely remove select CSS
rules from bootstrap.css as a part of our process to
remove bootstrap.
2023-01-26 12:36:31 -08:00
Sahil Batra bbcca49a5e invite: Add bootstrap CSS rules for select elements in invite modal.
This commit adds bootstrap CSS rules used for select elements in
invite UI in zulip.css.

This change is done so we can safely remove select CSS rules from
bootstrap.css as a part of our process to remove bootstrap.

This commit also adds class to a couple of select elements in invite
UI such that we can use those class to write CSS as using IDs would
lead to the dark-theme background not being applied correctly.
2023-01-26 12:36:31 -08:00
Sahil Batra 275da6b300 activity: Add bootstrap CSS rules for select elements in support page.
This commit adds bootstrap CSS rules used for select elements in
activity support page in activity.css.

This change is done so we can safely remove select CSS rules from
bootstrap.css as a part of our process to remove bootstrap.
2023-01-26 12:36:31 -08:00
Sahil Batra 4be60fa1ba upgrade: Add bootstrap CSS rules for org type select element.
This commit adds bootstrap CSS rules used for org type select
element in sponsorship page in billing.css.

This change is done so we can safely remove select CSS rules
from bootstrap.css as a part of our process to remove bootstrap.

We also remove inline style for this element and instead add
it with other CSS in billing.css.
2023-01-26 12:36:31 -08:00
Sahil Batra 6de03c415c integrations_dev_panel: Add bootstrap CSS rules for select elements.
This commit adds bootstrap CSS rules used for select elements in
devtools integrations panel in integerations_dev_panel.css.

This change is done so we can safely remove select CSS rules from
bootstrap.css as a part of our process to remove bootstrap.
2023-01-26 12:36:31 -08:00
Sahil Batra d708bc338c register: Add bootstrap CSS rules for select elements.
This commit adds bootstrap CSS rules used for select
elements in realm creation form to the existing CSS
in portico_signin.css.

This change is done so we can safely remove select CSS
rules from bootstrap.css as a part of our process to
remove bootstrap.
2023-01-26 12:36:31 -08:00
Sahil Batra 72b528e22b development: Add bootstrap CSS rules for select in dev login form.
This commit adds bootstrap CSS rules used for select element
in dev login form in portico_signin.css.

This change is done so we can safely remove select CSS rules
from bootstrap.css as a part of our process to remove bootstrap.
2023-01-26 12:36:31 -08:00
Sahil Batra e14b1f03fa register: Refactor template for new account registration.
This commit refactors the template code for source-realm
select element to have same structure as other inputs
and select element in the page. Thus this change also
makes the styling of source-realm select element consistent
with other select element in the page.
2023-01-26 12:36:31 -08:00
Sahil Batra 970d692d69 settings: Fix upgrade-banner for narrow width screens.
The upgrade banner was being clipped for narrow width screens
and was only partially visible. This commit changes it to instead
wrap the content such that complete content is visible on the
screen.

We also decrease the right margin for icon in the banner such
that the text of the banner fits in one line for at least normal
screen size and zoom in stream settings overlay.
2023-01-26 10:31:07 -08:00
SameepAher 3fe6d0def1
streams: Use singular in feedback for a single added subscriber.
The message displayed after successfully adding users to a stream previously
used a plural even if only a single user was added.
2023-01-26 10:22:35 -08:00
David Rosa b79daa9fa3 gear menu: Drop special naming for organization settings menu item.
Removes the special naming of the organization settings gear menu
item for admins so that it lines up with how we refer to the
"Organization settings" UI itself in the help center documentation.
2023-01-26 10:17:45 -08:00
Sahil Singh d05f672132
compose: Delete drafts with attachments.
Draft messages containing attachments, polls, or other items that cannot be locally 
echoed would not be deleted after sending the message. 

The explanation is simple: We only cleared the draft associated with a message in the 
`reify_message_id` local echo code path.

Fixes #24063.
2023-01-25 14:17:51 -08:00
Lauryn Menard 019fa7e122 organization-profile: Update deactivate organization section.
Removes the info icon with the tooltip information and replaces
it with a question help link icon to the help center article on
deactivating an organization.

Also, when the button is disabled, adds a tooltip on hover that
explains only organization owners can deactivate an organization.

If the current user's owner role is changed, then the button and
tooltip are live updated.

Part of #22892.
2023-01-24 13:09:53 -08:00
Aman Agrawal 37431cf0b5 urls: Provide `email` as a GET parameter.
Since we want to use `accounts/new/send_confirm` to know how many
users actually register after visiting the register page, we
added it to Google Tag Manager, but GTM tracks every user
registration separately due <email> in the URL
making it harder to track.

To solve this, we want to pass <email> as a GET parameter which
can be easily filtered inside GTM using a RegEx and all the
registrations can be tracked as one.
2023-01-24 11:29:50 -08:00
Aman Agrawal f4e9bf269c css: Fix positioning of text elements in message row without sender.
When I changed the padding for message content in the PR which
converted the message row to a grid, I forgot to adjust
the position of edited and time elements.
2023-01-23 16:41:03 -08:00
brijsiyag f314d819aa settings: Remove unused class.
Removed class is not used for any CSS.
Also heading is not for the message retention setting.
2023-01-23 15:09:21 -08:00
brijsiyag 02450b7aa6 settings: Fix info icon in header row outside header.
This info icon was smaller than similar ones sitting in heading rows,
because the icon element was outside the `<h3>` element for the row.

Fixes #23801
2023-01-23 15:08:42 -08:00
Akarsh Jain caeeddd975 typeahead: Fix suggestion box positioning on window resize.
The suggestion box was not being repositioned correctly when the window
was resized. This commit adds a resizeHandler() function to handle
window resizing properly and reposition the suggestion box to its
current position.

Fixes: #23681.
2023-01-23 15:05:14 -08:00
m-e-l-u-h-a-n fbb475b16a streams: Fix hash redirect for deleted/invalid stream ids.
The logic for hash redirects for stream settings did not check
for deleted or non-existent streams. Thus a hash of the form
`/#streams/{invalid_stream_id}/*` gave gave a blueslip error.

This change fixes that logic to treat such hashes equivalent to
streams whose settings cannot be accessed by that user and
redirects such invalid hashes to `/#streams/subscribed/`.
2023-01-20 15:07:00 -08:00
N-Shar-ma fb81e5504c typeahead: Remove misleading comment regarding favouring popular emojis. 2023-01-20 14:41:21 -08:00
N-Shar-ma aa72b51bca emojis: Prioritise custom / realm emojis when sorting.
Fixes: #18135.
2023-01-20 14:41:21 -08:00
N-Shar-ma 249f482b06 emojis: Filter out unicode emojis with same codes from typeahead menu.
Since emojis can have multiple aliases, an emoji was often suggested
under multiple names (like `smiling devil` / `smiling imp`), crowding
typeahead suggestions redundantly, and taking up the place of other
potentially relevant emoji suggestions.

Now such duplicates are removed post the sorting of suggested emojis,
and only the most relevantly named (highest sorted) copy is retained.
2023-01-20 14:41:21 -08:00
N-Shar-ma c64726ea9a compose: Retain compose state across narrows if recipient was edited.
Uptil now, the compose box's state was retained across narrows only if
the compose box had any content in it. Else it was reset to match the
current narrow.

To not lose any changes made to the recipient fields only, the compose
box will now retain its state also if the recipient (stream, topic or
PMs) has been manually edited.

This is achieved by having a variable in `compose_state` track if the
recipient fields were changed, and checking it before resetting the
compose box on narrowing. This variable is reset when the compose box's
context is changed by clicking on a message, or when a message is sent.

Fixes: #23064.
2023-01-20 12:56:37 -08:00
Sahil Batra 3cb69b138e settings: Disable save button when value is out of range.
This commit adds code to disable save button when the value
in custom input box is too large for an integer. Note that
since the value for message edit, message delete and email
notification batching settings are in minutes in the custom
input but are sent to API in seconds, we make sure that the
seconds value should be inside the range.
2023-01-20 12:45:53 -08:00
Sahil Batra 82aacb4996 settings: Fix custom input handling of message retention setting.
This commit adds code to convert $custom_input.val() to Number
in get_message_retention_setting_value such that values like
"48aa" are treated as NaN and we correctly show save-discard
widget with save button disabled. If we not convert it to Number,
Number.parseInt will just convert "48aa" to 48.

This commit is similar to 711536f53a.
2023-01-20 12:45:53 -08:00
Sahil Batra 235bd3fb1b settings: Disable "Save changes" button for invalid values.
This commit disables the "Save changes" button when there is
an invalid value in custom input of message retention setting.

This commit includes changes for both realm and stream message
retention setting.
2023-01-20 12:45:53 -08:00
Sahil Batra ba1188db05 settings: Rename admin-realm-time-limit-input class.
This commit renames admin-realm-time-limit-input class to
time-limit-custom-input such that there is no confusion
when it is used for stream settings also.
2023-01-20 12:45:53 -08:00
Sahil Batra 565d133985 settings: Refactor code for waiting period setting.
This commit refactors code for realm waiting period setting
to be similar to other time-based inputs. We also add the
code to disable the save button when custom inputs have
invalid values.
2023-01-20 12:45:53 -08:00
Sahil Batra bc5f0e881e settings: Rename IDs of waiting-period-threshold setting elements. 2023-01-20 12:45:53 -08:00
Sahil Batra 4dd1676e96 settings_config: Add waiting_period_threshold_dropdown_values.
This list will be used in further commits in settings_org.js
code for waiting period threshold setting.
2023-01-20 12:45:53 -08:00
Sahil Batra 43898be138 settings_org: Rename custom_days option to custom_period.
This commit renames custom_days option for realm waiting
threshold setting dropdown to custom_period such that we
can reuse existing code for similar time-limit settings.
2023-01-20 12:45:53 -08:00
Tim Abbott 235768ae4c setting: Remove now unused dependant-inline-block class. 2023-01-20 12:39:28 -08:00
Ningxi Zhang 69d8101c6a settings: Move the retention days input below the dropdown.
Moved the "Retention period (days):" under the dropdown "Custom".

This is consistent with similar date window inputs elsewhere, and
conveniently just requires changing a single class.

Fixes: #23532
2023-01-20 12:38:04 -08:00
Ningxi Zhang e6cf074929 settings: Improve wording of retention period options.
Replaced the "Retain for N days after posting" option with "Custom".
Only show the spot for entering the time if that option is selected.
Labeled the custom time like we do for message editing:
"Retention period (days): [ ]".

This is now consistent with similar settings.

Fixes part of #23532.
2023-01-20 12:37:42 -08:00
Sahil Batra ca845a6f76 bootstrap: Remove form-horizontal CSS from bootstrap.css.
This commit removes all CSS rules for form-horizontal class
from bootstrap.css. We have already removed instance of
this class in previous commits.
2023-01-19 17:26:58 -08:00
Sahil Batra 802deb1761 settings: Remove form-horizontal class from modal templates.
This commit removes form-horizontal class from various modal
templates. We add CSS for margin-bottom property for select
and input elements to keep the design same as before. Most
of the added CSS can be removed once we remove bootstrap
CSS completely for these elements.

We can safely remove this class since vertical-align property
is already present due to other bootstrap CSS. And
margin-bottom property for checkbox inputs are added by
bootstrap and for text inputs inside ".new-style" element it
is handled in app_components.css. For other inputs, this commit
adds CSS as mentioned above.

The display property for inputs other than checkbox and select
elements is set to inline-block by other bootstrap CSS.
For checkbox-type inputs browser sets display property to
inline-block but it is eventually computed to "block" as the
float property is set to left and so it is not required to
set display property for checkbox type inputs.
2023-01-19 17:26:58 -08:00
Sahil Batra 8b7a911b0e settings: Remove form-horizontal class from settings template.
This commit removes form-horizontal class from form elements
in user profile, org profile, org settings and org permission
pages. We also add margin-bottom property for select elements
in this page.

We can safely remove this class since vertical-align property
is already present due to other bootstrap CSS.
And margin-bottom property for checkbox inputs are added by
bootstrap and for text inputs it is handled in
app_components.css.

The display property for inputs other than checkbox and select
elements is set to inline-block by other bootstrap CSS.
For checkbox-type inputs browser sets display property to
inline-block but it is eventually computed to "block" as the
float property is set to left and so it is not required to
set display property for checkbox type inputs.

We have added CSS for select elements in settings.css which can
be removed later once we remove bootstrap for select elements
completely.
2023-01-19 17:26:56 -08:00
Sahil Batra a144166e12 settings: Remove form-horizontal class from notification settings.
This commit removes form-horizontal class from time-limit-setting
div in notfication_settings.hbs. We can safely remove this class
since display and vertical-align properties are applied for select
and input elements by other bootstrap CSS, the margin-bottom
property for custom input is applied by existing CSS in
app_components.css and this commit adds margin-bottom property for
select elements.

The CSS added in this commit will probably be removed once we
remove bootstrap CSS rules for select elements completely.
2023-01-19 17:26:11 -08:00
Sahil Batra aa7329e18b settings: Remove form-horizontal class in org settings pages.
This commit removes form-horizontal class from form elements
in custom-emoji, linkifiers, playgrounds, default-streams,
default-user-settings, auth-methods and user privacy settings
templates.

We can safely remove this class because vertical-align property
for input elements is set by other bootstrap CSS and margin
property for text inputs is set in app_components.css and for
checkbox inputs it is set by bootstrap itself.

The display property for inputs other than checkbox and select
elements is set to inline-block by other bootstrap CSS.
For checkbox-type inputs browser sets display property to
inline-block but it is eventually computed to "block" as the
float property is set to left.
2023-01-19 17:24:49 -08:00
Sahil Batra 1a0e8af4a9 settings: Remove unnecessary form-horizontal class.
This commit removes form-horizontal class from form
elements in alert-words, realm-exports and user-privacy
pages.

We can safely remove this class since there is no select,
input, help-inline or input-append child elements for these
and thus this class is not used for applying any CSS rules.
2023-01-19 17:24:49 -08:00
Sahil Batra da9cfa206a topic_edit_form: Remove form-horizontal class.
This commit removes form-horizontal class from form element
of inline topic edit form. We can safely remove this class,
since all properties applied by bootstrap using this class
are already overridden by specific CSS for the input element
in zulip.css.
2023-01-19 17:24:49 -08:00
Sahil Batra 48dec70099 invite: Remove form-horizontal class from invite modal.
This commit removes form-horizontal class from invite_user
template. We can safely remove this class as vertical-align
property is already handled for input and select elements
by other bootstrap CSS.

For checkbox type inputs, the display property is already
set to inline-block by browser for all input elements but
it is eventually computed to "block" since float property
for this element is set to left. So, setting display
property is not necessary for checkbox input.

We add margin-bottom property CSS for now and that can
eventually be removed when we remove bootstrap CSS for
these elements completely.
2023-01-19 17:24:48 -08:00
Sahil Batra 3920a73b20 social_auth_select_email: Remove form-horizontal class.
This commit removes form-horizontal class from form elements
in social_auth_select_email.html. There is no visible input
element in the form element so the bootstrap CSS using
"form-horizontal" class does not apply to any of the elments
in the page, so removing this class does not have any affect.

The "form-horizontal" class is used in portico-signin.css for
adding hover behavior, so we add a new class "select-email-form"
and use it to add the hover behavior.
2023-01-19 17:24:14 -08:00
Palash Baderia 4901a0d19b settings: Link organization settings users to user cards.
This makes it easier to browse details on users and bots when
interacting with them in the settings interface.

While the original issue was about just the bots panel, this is
clearly useful for all users.

Fixes: #23970.
2023-01-19 11:13:33 -08:00
Aman Agrawal a31df1d58b css: Don't render message failed buttons.
We used to make message failed button (retry / cancel) invisible
when the message is successfully send instead of not rendering them.
This resulted in them being accessible via keyboard when they are not
visible. I couldn't find a reason for retry and cancel buttons to
use `visibility` to be hidden instead of just being not rendered via
`display: none`.
2023-01-19 10:57:14 -08:00
Praveen Kumar 5b89f34f48
message_failed: Hide focus rectangle while animating.
The focus rectangle would spin along with the arrows, which looked bad.

We do want to allow focus rectangles on this element for keyboard interaction,
so we just disable the focus rectangle during the animation.

Fixes #24110.
2023-01-19 10:40:27 -08:00
Evy Kassirer cc35e2f9b2
navbar: Remove stale .rightside-userlist CSS class.
Since fbe9a9e539, the top_navbar element
unconditionally has the rightside_userlist class. There's some CSS
associated with this class NOT being present, which can be deleted as having
no effect, and then we can remove the class as having no effect as well,
2023-01-19 10:37:38 -08:00
Aman Agrawal 863ec70955 message_body: Structure hidden message similar to a normal message.
Messages sent by muted users are hidden. To make sure they are
displayed properly, we provide them a HTML structure similar to
that of a normal message so that any CSS applied to a normal
message also applied to it.

This fixes message controls being misaligned in hidden message.
2023-01-19 09:04:37 -08:00
Akarsh Jain 82aa15cb38 subscribers: Add warning when last user unsubscribes from private stream.
This commit adds a warning to the confirmation modal displayed when
the last user of a private stream attempts to unsubscribe. The warning
explains that, as the only subscriber, unsubscribing will result in the
stream being automatically archived. This change helps ensure that users
are aware of the consequences of their actions and can make informed
decisions.

Fixes: #23954
2023-01-18 16:12:07 -08:00
Aman Agrawal a13058223d compose: Don't allow same message to be sent twice.
It is possible to send the message twice by clicking send button
very quickly twice or by pressing enter and send button simultaneously.

This can be easily reproduced for large messages sent in a stream
narrow. Hard to reproduce for small messages or in PM narrows.

I was not able to reproduce locally, but was able to reproduce on
chat.zulip.org. So, this is an untested bug fix.

Fixes #22562
2023-01-18 16:04:58 -08:00
Duncan e582055d2a help center: Add mobile instructions to "Mute a topic".
Fixes #22146.
2023-01-18 16:00:12 -08:00
N-Shar-ma 963e1412b5 typeahead: Add message view context to PM recipient suggestions.
Uptil now when composing PMs, only for @-mentions was the stream / topic
being viewed taken into consideration. The PM recipient suggestions were
unaffected by the current view.

Now this context has been added to the PM recipient suggestions as well,
ensuring consistent sorting of options across both typeahead menus, with
subscribers and recent posters to that stream / view getting priority.

When the view is not narrowed to a stream / topic, the PM suggestions
are sorted the same as before.

This PR has the same code changes discussed and made in #22630, with an
added test suite.

Fixes: #21645.
2023-01-18 15:50:04 -08:00
Lauryn Menard 1e96c6e9a2 settings-profile: Move tooltip for name change disabled to field.
Moves the tooltip when name changes are disabled to be shown on
hovering over the full name input field. Removes the question icon
that previously showed the tooltip on hover.
2023-01-18 13:39:16 -08:00
Lauryn Menard 578af48632 settings-modal: Only update display if overlay loaded in DOM.
If the personal / organization settings overlay has not been
loaded to the DOM in the user's session, then there's no need
to update the overlay display for changes to the user's
permissions to update their name, email or avatar.

So we check for the relevant element ids before updating the
overlay display when the user's role or these organization
settings change, and return early if they are not present in
the DOM.
2023-01-18 13:38:09 -08:00
Greg Price f38b5c41da shared: Bump version to 0.0.18 2023-01-18 13:25:44 -08:00
Anders Kaseorg a5fefa5932 shared: Remove js source from distributed package.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-18 13:25:08 -08:00
Greg Price 5407d52cb4 shared: Bump version to 0.0.17 2023-01-18 13:22:47 -08:00
Greg Price 52de17e08f shared: Specify files for NPM package, so lib/ gets included
Otherwise `npm publish` and friends leave it out because it's
ignored in Git.

This also cuts out `tools/` and a few other such files.
2023-01-18 13:20:56 -08:00
Anders Kaseorg d41917ecd0 shared: Add TypeScript build step.
This transpiles the JavaScript and (future) TypeScript in
`static/shared/js` to `static/shared/lib`. It also compiles away
ES2020 syntax that’s not supported by the oldest JS engines targeted
by zulip-mobile.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-18 13:10:13 -08:00
N-Shar-ma 25eff08324 typeahead: Show the time typeahead irrespective of text before syntax.
Uptil now, on typing "<time" after some other autocompleteable token
like a mention or emoji, the timezone aware time typeahead would not
get triggered since the time syntax was checked after the earlier syntax
had been mistakenly used to (wrongly) tokenize the precursor text.

Now the code has been fixed to detect the time syntax the same way as
the rest: checking each character in the precursor text from end to
start, and tokenize it correctly.

Fixes: #23998.
2023-01-17 17:10:14 -08:00
Sahil Batra e80e3b07c4 settings: Fix flickering of icon when hovering on discard button.
The color of "x" icon in "Discard" button flickers when hovering
over the button. This commit fixes it by just adding the hover
color to the text and not icon which was anyways set to original
color using different selector which was the cause of flickering.
2023-01-17 14:45:48 -08:00
Sahil Batra c0e2c9b6d6 settings: Change hover behavior of save discard buttons.
This commit fixes the hover behavior of save-discard button
in dark theme. We change the text to be slightly brighter
on hover and keep the icon color same.

The background-color property is removed from hover CSS. This
change is safe because for save-button, we already define
different hover behavior below which takes precedence. And
for light-theme, the discard button already has the same
background-color without hovering, so this property was only
affecting discard button in dark-theme.
2023-01-17 14:45:48 -08:00
Sahil Batra e804795fa6 settings: Fix text color for discard button in dark theme.
We change the color of text and "x" icon in the discard
button in dark theme to be same as that of other text
in the settings page.
2023-01-17 14:45:48 -08:00
Sahil Batra 4e63794ddd settings: Fix background-color of save-discard widget in dark theme.
The correct background-color for buttons of save-discard widget
was not being applied and instead almost transparent color was
applied to dark-theme CSS rules. This commit adds ID to the
selector such that CSS in app_components.css is preferred over
dark-theme CSS.
2023-01-17 14:45:48 -08:00
Sahil Batra 0718043283 bot_settings: Remove "#bot_table_error" element.
We do not use "#bot_table_error" element to show any errors
anymore. It was previously used to show the error if bot
creation failed but since 6db88f0d39 moved bot creation
to a modal, we now show error, if any, inside the modal
itself. This commit also removes the hide_errors function
since the error element itself is removed.
2023-01-17 09:45:40 -08:00
Sahil Batra 316248308a bot_avatar_row: Remove ".bot_error" element.
We do not use ".bot_error" element to show errors
anymore after a9893fb654 added confirmation modal
for reactivating bot.
2023-01-17 09:45:40 -08:00
Sahil Batra fe3e58b497 settings_bots: Remove unused functions.
This commit removes bot_error function in settings_bots.js
since it is not used now. It was added in d90d1a04 and was
used in error handling, but since we changed the design to
show dialog for reactivation and deactivation of bots and
errors are shown inside the dialog and errors are handled
differently and thus the function's usage was removed in
a9893fb654.

This commit also removes get_bot_info_div which was only
used by bot_error function.
2023-01-17 09:45:40 -08:00
Sahil Batra 2aeda1b0c4 profile_settings: Remove "hide" class from h3 element.
We already have "inline-block" class for the h3 element
in profile_settings.hbs, so the display property is set
as "inline-block" and the CSS set by "hide" class is
overridden. We should not have "hide" class for this
element, since we want to show that element and not
hide it.

This was probably added while picking code of some
other element in bb816e199.
2023-01-17 09:45:40 -08:00
Lauryn Menard 2a60e4c1e6 portico-signin: Clean up CSS for buttons on dev login page.
Removes the `btn-direct` class in `portico.css` that was only
being used for dev login buttons.

Adds `dev-button` class for general CSS rules for buttons on the
dev login page. Adds `dev-login-button` and `dev-create-button`
classes for CSS rules specific to the two types of buttons on the
page.
2023-01-17 09:44:26 -08:00
Lauryn Menard 49daf6743a portico-css: Remove unused `find_account` CSS rules.
Removes `#find_account .btn` and `#find_account .form-control`
rules in `static/styles/portico/portico.css`.

The last use of these rules was removed in commit 7afbc9ddd6
when the login and registration pages were redesigned.
2023-01-17 09:42:56 -08:00
Sahil Batra 42c28f008b stream_settings: Move upgrade-text below the label.
This commit moves the upgrade text for message retention
setting below the label so that it is clear that the text
is present for message retention setting. This change is
done for both stream creation form and stream edit panel.
2023-01-15 13:36:33 -08:00
Sahil Batra 0bc61281df stream_settings: Fix upgrade text in stream edit panel.
The upgrade text shown for message retention setting for realms
on limited plans should mention about sponsorship only for
non-business orgs. In the stream edit panel, the sponsorship
text was present even for non-business orgs because the
is_business_type_org parameter was not being passed to the
template, so this commit fixes the code to pass the
is_busines_type_org parameter correctly to the template.
2023-01-15 13:36:33 -08:00
Sahil Batra 90566ab772 stream_create: Disable the message retention setting for limited plans.
We should disable the message retention setting in stream creation
form for limited plans.
2023-01-15 13:36:33 -08:00
Sahil Batra 6f20d7c9ab stream_create: Refactor code to set default value for retention setting.
The message retention setting is only visible to owners in the
stream creation form, so the jquery code to hide the custom
input, set the default value for dropdown and listener to
show and hide the custom input should be called only for owners.
2023-01-15 13:36:33 -08:00
Sahil Batra 1c1b911a42 stream_create: Fix comments in show_new_stream_modal.
We fix the comment stating that announce_stream setting
is set on "on", as we handle it differently now in
update_announce_stream_state.
2023-01-15 13:36:33 -08:00
Aman Agrawal 1f3367abfb message_list_view: Remove dead next_is_same_sender code.
The `next_is_same_sender` has no effect on the CSS of the message
displayed and the JS changes seem to have no effect too.

See cc8021a742 for more details.
2023-01-14 14:49:28 -08:00
Josh Klar 465d0b2710 message_list_view: Use translated form of "at" in timestamp tooltip.
The English word "at" was manually appended to the string output of
datetime-related functions to generate the string shown in the tooltip
when hovering over the timestamp of a message. Use the translated form
"{date} at {time}" instead, as found elsewhere in the codebase.
2023-01-12 20:47:01 -08:00
Lauryn Menard 1a3b0edf4b account-settings: Disable deactivate account button when only owner.
Disables the deactivate account button in the user's account and
privacy settings tab if they are the only active organization owner.

Adds a tooltip when hovering on the deactivated button to let the
user know why the button is disabled.

The backend already returns an error for self account deactivation
requests if the user is the only organization owner.
2023-01-11 13:30:31 -08:00
Lauryn Menard 7abf476443 settings_account: Update avatar widget if user/org permissions changed.
Adds `avatar.build_user_avatar_widget` to the updates done in
`settings_account.update_avatar_change_display` when the user
has permission to change/delete their avatar.

For the case where a user has their personal account profile
settings open while the organization or user's permissions are
changed, `user_avatar_widget_created` boolean is added to
`settings_account.js` to track whether the widget and handlers
have been created so that live updates don't rebuild the
existing widget and handlers.

Also, updates `avatar.build_user_avatar_widget` to return early if
the user cannot change their avatar. This pattern better matches
the other instances where we use the direct upload widget for the
organization icon and logos.
2023-01-11 13:12:59 -08:00
Lauryn Menard fd4e071f32 organization-logo: Update the titles for the logo color schemes.
The "day" and "night" color scheme names were updated in #20371,
but the organization profile settings tab still has had the old
names for the two types of wide logos.

Updates "Day logo" to be "Light theme logo" and "Night logo" to
be "Dark theme logo".
2023-01-11 13:12:59 -08:00
Lauryn Menard 55f34c3086 settings-org: Hide image upload button if user no longer admin.
Adds hiding any elements with the `image_upload_button` class in
the organization profile (icon and logos) to the live updates in
`settings_org.maybe_disable_widgets`, so that any role changes
that remove admin permissions will update these images so that
they no longer appear able to be updated / deleted.
2023-01-11 13:12:59 -08:00
Lauryn Menard eef22e4e04 settings-account: Make live update for avatar changes consistent.
The `settings-info-icon` with the tooltip for the user avatar
section was removed in commit 103db2afaf. This removes the changes
to that tooltip in `settings_account.update_avatar_change_display`.

Instead of hiding or showing the `image_upload_button` in that same
live update function, we now add or remove the `hide` class, which
in the previous commit has a specific CSS hover rule for the image
upload widget.

Also adds test coverage for the `is_admin` case for this setting
because administrators can always change their own avatar even if
the organization has disabled avatar changes.
2023-01-11 13:12:59 -08:00
Lauryn Menard d3a513f4bd image-upload-widget: Render `image_disabled` div if text to display.
If there is no `disabled_text` provided for the image upload widget,
then there is no need to have the `image_disabled` div rendered in
the template. This allows the hover CSS rules to be more general for
the image upload widget in general.

Adds a check for `disabled_text` around the `image_disabled` div
element in `image_upload_widget.hbs`.

Also, changes `image_upload_background` class to
`image_hover_background` so that it more accurately describes what
the CSS rule is for and why it's used in both the `image_disabled`
div and the `image_upload_button` div.
2023-01-11 13:12:59 -08:00
Manas Jayaswal 3cbec56e81 image-upload-widget: Fix hover behavior when image cannot be changed.
The `hide` CSS rule in `app_components.css` was being overwritten
by the more specific rules in `image_upload_widget.css`, which
meant that when changing the inage was disabled the hover text for
updating or deleting the image was still visible.

Adds `hide` class (and therefore more specific rule) to
`image_upload_widget.css` for when this text should be display
none.

Fixes #23844.
2023-01-11 13:12:59 -08:00
Tim Abbott e50ab2dad3 message_list_view: Remove include_footer parameter.
This only set the last_message CSS class, which is no longer used for
styling or JavaScript code.

(The calculation was also wrong, in that new messages arriving would
not cause it to be removed from the previous message with the
last_message class).
2023-01-10 17:03:37 -08:00
Tim Abbott b1155516d1 lightbox: Rewrite logic depending on last_message CSS class.
The last_message CSS class didn't mean what it said it did, due to
issues with live update.

Further, this logic was poorly written, with `$message` changing types
from a .message_row to a .recipient_row for now apparent reason.

I was able to reproduce at least one bug where the `v` shortcut would
not correctly open the lightbox that is fixed by this rewrite.
2023-01-10 17:03:37 -08:00
Aman Agrawal 2fa88362bc message: Hide first action button on narrow widths.
Fixes zulip#19759

Before grid, there was overlap of action buttons and text (photo 1).
With grid, there was just very little space for messages (photo 2).
With this commit, the message gets a bit more space (photo 3).

This helps us add more width to the content column of message
on narrow widths. Note that it will still always be less than
before grid, since we are explicitly preventing overlap.
2023-01-10 17:03:37 -08:00
Aman Agrawal 26011c98fd css: Use grid layout for messages.
Using grid layout moves us away from fixed widths
and position for items where possible, which will
make it easier to make messagebox changes without
breaking formatting.

Visual changes expected in this commit:
- When the action buttons overlap the message content,
it will no longer visually overlap but completely cut off
the content — which is good, but means the messages can’t
be as wide on narrow width views. There’s a slight improvement
to this in an upcoming commit.

Also removes the `last_message` CSS, which was busted due to the
`last_message` calculation not correctly being updated for new
messages arriving, and didn't improve styling.
2023-01-10 17:03:37 -08:00
Aman Agrawal 953277bdae message_list: Add `content_edit_mode` when editing a message.
Having the class at the top of message DOM structure when the
user is editing a message, helps apply css when user is editing
a message.

Short prep commit for the next commit; no visible changes
2023-01-10 17:03:37 -08:00
N-Shar-ma d88ce61801 typeahead: Make the typeahead completions undo friendly.
We now use the undo supporting `insert` function from the
`text-field-edit` module to update the text after autocompletion,
instead of just resetting the value of the textarea / input, which was
not undo-able.

So that the undo history seems sensible, we replace only the minimal
diff between the text before and after autocompletion. This ensures
that only this diff, and not the entire text, is highlighted when
undoing, as would be ideal.

Fixes: #14311.
2023-01-06 16:53:57 -08:00
N-Shar-ma 95b77c0c1a util: Add function `get_string_diff`.
The new function specifies the single minimal diff between 2 strings.
It takes in 2 string parameters and returns an array with 3 integers
where the 1st is the index where the difference starts and the 2nd and
3rd are the indices of the end of the diff in the 2 strings.
2023-01-06 16:53:57 -08:00
N-Shar-ma 88603bd34b todo: Fix bug preventing toggling todos with content in composebox.
Uptil now, with the composebox expanded and some content in it, when a
task in a todo widget was clicked, it did not toggle as expected but
focused the composebox, selecting all the text in it.

This is fixed by ensuring the task is a clickable message element and
clicking it doesn't collapse the composebox. This has the added benefit
of fixing the bug where toggling a task expanded a collapsed composebox.

Fixes: #22928.
2023-01-05 12:59:58 -08:00
Sahil Batra 677b26025a settings_org: Refactor code for dropdown list widget settings.
This commit refactors the code for dropdown list widget settings
such that we can reuse the added functions for further settings
that will use dropdown_list_widget.

This change will be helpful when we will add group-based settings
and change some of the existing role-based settings to be group-based.

We add a new function "get_widget_for_dropdown_list_settings" to
get the widget variable from setting name. The functions to get
and set the setting value use "get_widget_for_dropdown_list_settings"
function to get the widget and then gets or sets the setting value
accordingly.

We also add "data-setting-widget-type" and "data-setting-value-type"
attributes to the element like other settings.

The "data-setting-widget-type" attr is used by get_input_element_value
to use "get_dropdown_list_widget_setting_value" function for
dropdown-list-widget settings.

The "data-setting-value-type" attribute is used to parse the setting
value to correct types in "get_dropdown_list_widget_setting_value"
function.
2023-01-04 17:51:42 -08:00
Lauryn Menard e7c6f35482 user-events: Update account settings display if `is_admin` is changed.
There are a few account settings that are possibly deactivated if
a user is not an administrator (email, name and avatar changes),
depending on the organization's policy for changing those settings.

When a user's role is updated to become (or no longer be) an admin,
the display for these account settings may need to be updated.

Adds `settings_account.update_account_settings_display` to the
functions called in `user_events.update_person` if the active
user's role is changed to or from an administrator role.
2023-01-04 16:26:21 -08:00
Sahil Batra 2378d62da1 settings: Fix bug when changing stream specific notification setting.
The class for "tr" element was changed in c22de76af7, so
get_stream_id function was not able to get the correct stream-id
from the target element. This commit fixes get_stream_edit
function to also check for closest ".stream-notifications-row"
ancestor element and thus it returns the correct stream id.
2023-01-03 11:17:04 -08:00
Anders Kaseorg bd884c88ed Fix typos caught by typos.
https://github.com/crate-ci/typos

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-03 11:09:50 -08:00
Sahil Batra 1cfded7e6f billing: Use same font-family for inputs as for rest of the page.
Rest of the page uses "Source sans 3" font and also most of
input and select elements in rest of the app use the same font.

This commit updates the select, input and textarea elements in
"/upgrade" page to use "Source sans 3" font and not the one set
by Bootstrap.
2023-01-02 08:28:34 -08:00
Sahil Batra 541076ca68 integrations_dev_panel: Use same font-family as used in the app.
Most of the select, input and textarea elements in the app uses
"Source sans 3" font.

This commit updates the select, input and textarea elements in
"/devtools/integrations" page to use "Source sans 3" font
and not the one set by Bootstrap.
2023-01-02 08:28:34 -08:00
Lauryn Menard a00a1ab5ce dev-login: Rename `btn-admin` class to `btn-dev-login`.
Renames and cleans up some of the CSS rules for the `btn-admin`
class that is used in the dev login page for input elements.

Confirmed via git-grep that this class is only used on the dev
login page.
2022-12-30 21:26:42 -08:00
SameepAher 37a8bebf77 compose: Fix overflow in expanded compose box preview mode.
Fixed a bug in expanded compose box preview mode,
which lead to buttons at the bottom of the compose box
being pushed off the screen and text overflowing.

Manually tested for different screen sizes.

Fixes: #23493.
2022-12-30 17:57:17 -08:00
Lauryn Menard 19f2795e41 settings-account: Move tooltip for email change disabled to button.
Moves the tooltip when email changes are disabled to be shown on
hovering over the email button text and pencil icon. Removes the
question icon that previously showed the tooltip on hover.
2022-12-30 17:54:00 -08:00
Lauryn Menard c50de056c9 settings-account: Move disable change email logic out of template.
Moves the complicated logic in `account_settings.hbs` for whether
to disable the change email button (and show the tooltip) to
`settings_data.ts`.

This update mirrors how similar realm settings are handled,
such as `realm_name_changes_disabled`, and means that the
`realm_email_changes_disabled` bool is added to `page_params.ts`.

Prep commit for moving the email changes disabled tooltip from
a separate question icon to the disabled button itself.
2022-12-30 17:54:00 -08:00
Lauryn Menard 782cc80d99 account-settings: Refactor change email button and modal class names.
Prep commit for updating tooltip from info icon to disabled button.
2022-12-30 17:54:00 -08:00
Zixuan James Li 6d9aba8aff muted_users: Convert muted_users to typescript.
muted_users.js is another dependency of people.js to be converted into
typescript. Note that for filter_muted_users, we avoid typing persons
with a type that might get added to people.ts in the future, as it
otherwise might introduce cyclic dependency.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
Zixuan James Li bec8e48616 muted_users: Pop muted_users from page_params.
This avoids accessing the global page_params directly.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
Anders Kaseorg 5f76fb16b7 styles: Add overflow: hidden fallback for overflow: clip.
overflow: clip is missing in Safari < 16.
https://caniuse.com/css-overflow

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:31:06 -08:00
Anders Kaseorg 9dbb43eb71 realm_logo: Add fallback for MediaQueryList.addEventListener.
MediaQueryList.addEventListener is missing in Safari < 14:
https://caniuse.com/mdn-api_mediaquerylist_eventtarget_inheritance

Fixes #23915.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:28:20 -08:00
Sebastian Noack d4d285fc43 bootstrap: Remove print media styles.
Bootstrap's print media styles do not improve the appearance of printed
pages of this website.
2022-12-16 00:01:25 -08:00
Sebastian Noack be1ec77300 bootstrap: Remove figure element reset. 2022-12-16 00:01:16 -08:00
evykassirer 3d4374f2a6 streams: Return early from can_post_messages_in_stream for spectators.
This code path isn't currently reached for the logged out "spectator"
view, but it will be in upcoming commits. This makes sure that case
is handled properly.
2022-12-15 17:26:04 -08:00
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