Commit Graph

14605 Commits

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