This is necessary to offer the "Unsubscribe" button in full user
profiles when the current user has the necessary permissions for a
given stream.
We remove settings_data.user_can_unsubscribe_other_users, since we've
changed its only caller and it is no longer a useful abstraction.
This commit adds dropdown-list-widget element in create stream UI
to set can_remove_subscribers_group setting when creating stream.
For now only role-based system groups are shown as options.
This commit adds dropdown-list-widget element in "General" section of
stream settings for can-remove-subscribers-group setting. For now we
only show role-based system groups as the options.
This commit adds get_realm_user_groups_for_dropdown_list_widget function
which returns the list of objects containing the display name and id
of system user groups and adds tests for this function.
This commit updates the frontend to show or hide the "Unsubscribe"
button in subscribers list in stream settings as per the
can_remove_subscribers_group setting for the stream.
Previously, subscription rows with a remove-subscription-button were
much taller than those without. This will be problematic when the new
permissions setting makes it possible for the current user to have
permission to unsubscribe the target user from some streams but not
others.
Fix this by both making the button a bit less tall and setting a
minimum height for the rows. Probably a nicer CSS solution is
possible, but this is enough to unblock merging a much larger project.
This should help considerably in the readability of this part of the
codebase; meanwhile, I also took the opportunity to note various TODOs
where we might have something simple we can do to simplify these data
structures or improve their interfaces.
Fixes#22524.
This affects both the banner in the main compose box and the banner
in the message edit compose box. The use of ProgressBar has been
replaced with a more simple CSS (with light Javascript) solution.
The classnames are changing because the upload banner is now a
template rendered and remove()-ed from a banner container
(#compose_banners in the composebox, and a new div for banners in the
message edit view). It used to be in the send_status container so
there are a lot of class renames across the codebase.
This timeout was introduced in this commit: 02c3223985
The UI should close immediately when the user clicks cancel,
and the rest of the canceling code can run behind the scenes.
We want to keep a short timeout for upload completion
so that the user sees the 100% complete upload bar.
Previously notifications.clear_compose_notifications was used accross
the codebase. Since introducing the new
compose_banner.clear_message_sent_banners function, the two functions
are similar enough that we can just use clear_message_sent_banners
everywhere. This commit also moves scroll_to_message_banner_message_id
to compose_banner.
This is a prep commit for redesigning this banner. The
change from `note` to `banner_text` is more consistent
with `compose_banner`. `link_class` is renamed to classname
and will be used for the banner a whole and not the link
class anymore, which is why the check for displaying a link
now looks to see if `link_text` is defined instead.
This has been present since this modal was first introduced in
b9098a42d4, but as far as I can tell, it
has never been correct. We know `old_topic_name` is not
null/undefined, since we do a check with it trimmed earlier in the
function, and there is no product reason why we would would to
silently fail to move a topic because its name was the empty string.
When 'resolve|unresolve' and 'change topic' actions occurs in
the same api call using 'topic sidebar icon', only 'topic_moved'
notification is sent.
Both 'topic moved' and 'topic resolved' notification should be generated.
Currently, 'select_stream_id' is not set to 'undefined',
even if we only change 'topic name' and/or 'resolve|unresolve' topic.
Resulting in no 'resolved_topic' notification.
This commit sets 'select_stream_id' to 'undefined' to fix the issue.
On updating the stream from the dropdown menu in the move-messages popover,
the confirm button is enabled. On changing the stream back to the initial
value, doesn't disable the confirm button. It can result in the
creation of infinite notifications.
On stream update, 'update_submit_button_disabled_state()' doesn't receive
'stream_id' as a parameter, resulting in 'undefined' stream_id,
'button.disabled' is always set to false after the first update.
The banner telling the user to scroll down to the message previously
didn't disappear when the user scrolled past it manually, which is
not ideal.
Keep track of which message is associated with this notification,
and clear the banner when the message scrolls above the bottom of
the viewport.
Previously the message would disappear after 300ms, but it can be
annoying for a useful link to disappear so quickly like that.
This commit removes that logic. Now the banner is closed only when
the user explicitly closes it or clicks on the link.
Note that the banner doesn't go away if the user manually scrolls
down. I still think this change is overall better, but if there's
an easy way to add that as well we should do it!
Fixes part of #19857.
This notification ("scroll down to view your message" with a link
for the user to click to scroll down) was added in e2c388c and
removed in 657e1f1 in a commit almost immediately afterwards.
Later the notification was added again, but there was notably no
link to scroll, just the message to scroll down. 372cb20
The link to scroll down was "added" in 1a63c2d when it was fixing
a similar link in another notification. But the implementation
didn't actually use the link (because there was no classname passed
through).
This commit adds a classname so that the link is clickable by
the user.
Fixes part of #19857.
The image preview in the 'upload_widget' would scale images that are
wider than the intended square shape for custom emoji; this resulted
in a misleading preview, because the server will instead crop such
images to take their leftmost square.
Fix this using 'object-fit: cover', to have the browser do something
similar.
Previews of the current bot avatar and the uploaded bot avatar were not
displayed during bot creation or editing.
We address this by extending The 'upload_widget' component with with
'preview_text' and 'preview_image' parameters to provide a preview of
the image that will be used as the bot's avatar during bot creation or
editing.
Fixes#23023.
This links users or bots in Stream settings -> Subscribed users, to
their respective user profile card.
Also, changes were made to close any active overlay, on clicking any of
the PM buttons in the user profile card. This help us avoid writing
separate conditions for multiple overlays, like settings overlay or
stream settings overlay.
Fixes part of #18880.
Due to some quirks of CSS specificity, a rule for 0 `right-padding` was
overriding a rule for 2px `right-padding` for topic names.
This is now corrected, and the padding increased to 3px for a less
cramped look, for PMs, topics and streams. Repetition of CSS has also
been removed.
The commit af36e9f added a bug that breaks new user invite.
The CSS class ` bootstrap-focus-style` was added to `id`,
hence breaking the value extraction.
Fixes: #24249
We override the bottom margin added by bootstrap for
url type custom profile input in user profile page
and all the inputs in edit-user form. Previously, this
was handled by form-horizontal class which was removed
in #24057.
For most of the other text-type inputs, it is overridden
in app_components.css and for checkbox-type inputs, it is
overridden by other bootstrap CSS itself. But that only
handles text-type and checkbox-type inputs inside
".new-style" element and not url type inputs.
Some other inputs already have specific CSS to override the
bootstrap CSS.
For the same reason, there is no need to override bottom
margin for inputs in organization profile as there is no
url type inputs in that page and this commit removes the
CSS for it.
Creates a shared `disabled_setting_tooltip` class that can be
reused in cases where a personal or organization setting button
or input is disabled and a tooltip is added to give information
about why the user cannot change/access the setting.
Changes `name-input` class, that was only being used in a div
wrapper for the input element for changing a user's full name,
to be a more specific id name: `full_name_input_container`.
This id is used to set or remove the disabled setting tooltip
when name changes are disabled by the organization.
There are no CSS rules set with this class/id.
This fixes a very noticable regression in
92788a52bb, where using Up/PageUp/Home
when focus was in anything other than the compose box would
incorrectly be treated as message feed navigation.
Fix this by adding a new check, but this now has some fairly
duplicated code that queries the DOM for the same thing 3 times in a
row; added a TODO comment explaining a likely better approach.
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.
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.
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.
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>
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>