Commit Graph

14594 Commits

Author SHA1 Message Date
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