Commit Graph

13582 Commits

Author SHA1 Message Date
yogesh sirsat 078d966c64 modals: Refactor help_link_widget for confirmation modal.
Added class "help_link_widget" and applied existing css,
to `a` tag of help_link_widget.

Follow-up of #21508.
2022-03-25 10:43:37 -07:00
Aman Agrawal 8d78f356e6 message_scroll: Use fadeOut effect to hide the scroll to bottom button.
We use `fadeOut` effect to hide the scroll to bottom button more
widely. We already use `fadeIn` effect to display the button
every time.

We deliberately don't use the `fadeOut` effect when doing
`make_compose_box_full_size` to avoid any button overlap with
compose for a short time.
2022-03-24 12:48:57 -07:00
yogesh sirsat c5bb9cb08a settings_users: Confirmation modal for "Reactivate" user.
The implementation closely follows `handle_deactivation()`.

Using the same existing reactivate confirmation modal.

Also, this commit will also lead to open confirmation modal
to reactivate bots in settings > bots, and currently there is no
existing confirmation modal for deactivating bots.

This commit is a follow-up of #21436.
2022-03-24 12:39:12 -07:00
YashRE42 7e03ed9391 people: Extract _calc_user_and_other_ids from get_recipients.
We previously added support for showing the status_emoji to the PM
list, but we only supported individual PMs and not group PMs, this is
prep commit towards supporting group PMs.
2022-03-24 12:21:38 -07:00
YashRE42 72cf5bd90d people: Extract get_display_full_name from get_display_full_names.
We previously added support for showing the status_emoji to the PM
list, but we only supported individual PMs and not group PMs, this is
prep commit towards supporting group PMs.
2022-03-24 12:21:38 -07:00
yogesh sirsat 417766a3e3 modals: Fix margin for help_link_widget in confirmation modals.
The 5px margin is picked to match what we use in settings.
2022-03-24 12:11:47 -07:00
YashRE42 e88ca470ac right_sidebar: Apply left margin to unread counts.
This change was motivated by the addition of status emoji to the buddy
list. Previously there was no spacing between the status emoji and the
unread count, and as such, this commit adds a left margin to the
unread count.

The above change has an additional consequence, long user names such
as "Othello, the Moor of Venice" get truncated with ellipses, instead
of reaching to the edge of the unread counts (as they previously
would).
2022-03-24 11:07:37 -07:00
YashRE42 07df504c79 status_emoji: Bump margin-left on status emoji by 1 px.
While the 2px value that we had previously chosen looked alright for
most emoji (😀, 😃, etc) some emoji such as 🐙
used more of the width available to them and as such still looked too
close to the user name. As such this commit bumps the value to 3px
(4px was a bit too much space).
2022-03-24 11:07:37 -07:00
YashRE42 1b4ff0631c ui_init: Handle youtube play icon positioning via mouseenter handler.
Previously, we were experiencing a regression in the positioning of
the play icon for youtube previews, as such, this commit uses a
previously created `handle_video_preview_mouseenter` to ensure the
positioning is always correct.

This is an ugly way of doing things, because this could be handled
directly through CSS flexbox, however, it is an acceptable temporary
fix.
2022-03-24 10:56:21 -07:00
YashRE42 58184fc2a9 ui_init: Extract embedded video preview mouse handler.
This commit extracts the logic used to ensure that the play icon is
correctly positioned over the video preview for embedded videos, with
the intention that we can use this to fix a regression in the play
icon positioning for youtube video previews.
2022-03-24 10:56:21 -07:00
Aman Agrawal d006b6cc3d message_list_view: For spectators, show login button for failed images.
We render a login button for images that failed to load for
spectators. The image failed to load most likely due to being
rate limited by the server.

Fixes #19840
2022-03-24 10:50:00 -07:00
Tim Abbott 0d90bb2569 narrow: Fix messages being cached without flags set.
f0c680e9c0 introduced a call to
message_helper.process_new_message without first calling
message_store.set_message_flags on the message.

This resulted in it being possible as a race, when loading the Zulip
app to a stream/topic/near narrow, for a message to have the
`historical` flag be undefined due to not being initialized.

That invalid state, in turn, resulted in the message_list_view code
path for rendering the message feed incorrectly displaying additional
recipient bars around the message.

We could fix this by just calling message_store.set_message_booleans
in this code path. However, this bug exposes the fact that it's very
fragile to expect every code path to call that function before
message_helper.process_new_message.

So we instead fix this by moving message_store.set_message_booleans
inside message_helper.process_new_message.

One call point of concern in this change is maybe_add_narrow_messages,
which could theoretically reintroduce the double set_message_flags
bugs detailed in 9729b1a4ad. However, I
believe that to not be possible, because that call should never
experience a cache miss.

The other existing code paths were already calling
set_message_booleans immediately before
message_helper.process_new_message. They are still changing here, in
that we now do a cache lookup before attempting to call
set_message_booleans. Because the message booleans do not affect the
cache lookup and the local message object is discarded in case of a
cache hit, this should have no functional impact.

Because I found the existing comment at that call site confusing and
almost proposed removing it as pointless, extend the block comment to
explicitly mention that the purpose is refreshing our object.

Fixes #21503.
2022-03-24 08:10:14 -07:00
Tim Abbott 00332fd49d markdown: Simulate message flags in frontend markdown processor.
This eliminates an annoying bundle of complexity that caused the
frontend markdown processor's interface with the rest of Zulip's new
message processing code paths being more similar to that of a new
message from the server.

It also cuts down on code duplication.
2022-03-24 08:10:14 -07:00
Tim Abbott 2dd0b386fe echo: Clean up confusing handling of message flags in local echo.
The previous message.unread block in insert_local_message was
non-functional. markdown.apply_markdown is overriding what that set by
calling message_store.init_booleans, which happens to set the same
value for the `unread` flag, and then setting individual message
booleans as it finds elements like mentions during rendering.

Improve this situation partially by deleting the message_unread block,
and adding conversion logic to translate what the markdown processor
is doing into message flags.

Then, we can call message_store.set_message_flags just like we do when
processing new messages arriving via the API. This will be helpful
shortly, when we deduplicate the calls to
message_store.set_message_flags.

As noted in the lengthy TODO, this exposes the fact that we should
really rework how the frontend markdown processor returns the
mentioned state to its caller.
2022-03-24 08:10:14 -07:00
ditsuke 4d03a1b0b7 message_feed_view: Fit multiple images horizontally.
At the moment we fit only a single image per message per line. This is
wasteful of space as multiple images can be accomodated per line on
widescreen displays. This commit modifies the rendered_markdown
stylesheet to make this possible.

The comments detail various technical considerations.

Fixes #20975.
2022-03-22 22:35:17 -07:00
Aman Agrawal 6fcbe4091d web_public_streams: Change globe icon.
This revised globe icon avoids looking like a "language choice" icon
(as the previous one did), while still being recognizably Earth (and
not a disk with some things drawn on it) and not showing only North
America (a flaw with the Font Awesome 4.7 icon).

Used a derivative of icon from
https://unpkg.com/ionicons@5.5.2/dist/svg/earth.svg
with modified outline by Vlad Korobov.
2022-03-22 16:15:55 -07:00
Aman Agrawal 9a7fadbbeb zulip-icons: Move custom icons to shared folder. 2022-03-22 16:14:56 -07:00
Sahil Batra d89b5042a9 settings: Send config_data to bot update API only if required.
There is config_data for the embedded bots only for giphy and
followup bots, so we send "config_data" field to API only for
those bots and not others. Send config_data field as {} to
the API for other bots raised InternalError earlier.
2022-03-22 15:38:43 -07:00
Sahil Batra 630abf57d9 settings: Remove bot from "Active bots" list on changing owners.
On changing bot owner, "delete" event is sent to the previous
owner if previous owner is not an admin. We were ignoring the
"delete" event in webapp previously, but now we update the
bots page in personal settings to delete the bot. Note that
we do not remove the bot from the organization list of bots
currently, since list_widget does not support removing a
row as of now.

In case of previous owner being an admin, the previous owner
receives "update" event and thus the bots list is updated
from that event.

The code for ignoring "delete" event was added in fba2708bbc,
to basically avoid failed lookup for id in the organization
list of bots. I have tested and there cannot be a case of
a failed lookup in the list as per current code for list_widget
module and we are anyways safe after a reload or after closing the
overlay as the list will be updated correctly.

Discussion thread -
https://chat.zulip.org/#narrow/stream/321-settings-system/topic/List.20render.20.2315033

Fixes #20856.
2022-03-22 15:38:43 -07:00
Alex Vandiver b9e428dd5d lightbox: Make the "download" link use the new download endpoint.
The "download" attribute on the button only functions for same-origin
requests; thus, the download endpoint must be used in order for the
"Download" button to function for uploaded images which are stored in
S3, and thus served from a different origin.

This is only done for uploaded images; it does not address a similar
problem with Camo, when Camo is hosted on a different hostname.

Fixes: #19238.
2022-03-22 15:05:02 -07:00
Tim Abbott 2f929bee2f compose: Match width of topic compose to left sidebar space.
Previously, the maximum width for the topic input in the compose box
was artificially limited to 20% of the width of the compose box.

While this may have had some useful role in encouraging short topics,
we can teach that idea in other ways, and it seems more helpful to
have the input length match what works well for viewing topics in the
left sidebar without being cut off.
2022-03-22 11:52:26 -07:00
yogesh sirsat 8d40199729 settings_users: Display error inside deactivate user modal.
Currently, when deactivating a user, we have a "Saving..." loading
indicator and any error message displayed in the heading area of the
users table.

Migrate this to instead do the loading indicator and error message
inside the modal, where it's more in context.
2022-03-22 11:14:48 -07:00
Rishabh-792 3f0b0ee88c settings: Improve help icons in settings.
Improved the contrast of ? and i icons by changing their opacity to a
consistent 0.6, going to 1 on hover.

Changed the colour of playground icon by testing and added spacing
between title and the playground icon by changing the icon margin.

With some TODO comments added by tabbott for readability.

Fixes part of #20484.
2022-03-21 18:07:16 -07:00
SantamRC 373f700736 widgets: Fix line wrapping of todo descriptions.
The simplest solution for doing this involves adding some divs.

Fixes #20523.
2022-03-21 17:52:45 -07:00
My-Name-Is-Nabil cc32a3afff compose: Fix alignment of close buttons in stream invite banners.
Close buttons are misaligned if the warning banner text takes up two lines.

We increase the specificity of the selectors to ensure that this CSS
overrides Bootstrap.

Fixes #20839.
2022-03-21 17:47:12 -07:00
Tim Abbott 7bc0e70693 recent topics: Revert time format changes for now.
As detailed in this conversation:

https://chat.zulip.org/#narrow/stream/137-feedback/topic/recent.20topics.20timestamps/near/1337670

This time format change is not working out as an improvement for at
least some users, myself included.

I think we do want to use some of the refinements attempted here (and
in particular, I'm keeping the new function with its nice test suite),
but I think it's better to revert now and fix forward in a future
release.

See #19775 for added background.
2022-03-21 17:37:32 -07:00
jai2201 040363f6c7 tippy: Render tooltip from tippy.js for stream_sorter_toggle.
Render tooltip to stream_sorter_toggle buttons using
appendTo method of tippy.js to ensure that tooltip doesn't
get hidden behind the parent container and is visible
completely.

Fixes #21329.
2022-03-21 17:35:04 -07:00
somesh202 cf5a70a958 settings: Fix buggy heading hover behavior for some settings panels.
Previously, hovering over the table headers in the code playground
table in the dark theme looked wrong. We were able to trace this issue
to the table-sticky-headers class not having been applied to this
table. The `alert-words` table was also affected and is fixed as well.

This also adds the `actions` class in alert-words table to fix the
inconsistency of the actions column in that table.

We've done an audit and these are the only two instances of either
bug in the HTML templates for a settings table.
2022-03-21 17:24:23 -07:00
Biki-das 64ec62b15c portico: Fixed responsive of integration request buttons.
Previously, these buttons looked broken in mobile size screens.

Fixes #20799.
2022-03-21 16:44:06 -07:00
Aman Agrawal 61cf9d1843 compose: Minor realignment of compose icons. 2022-03-21 16:41:18 -07:00
Austin Riba 0943b38300 lightbox: Add tippy tooltip to lightbox title.
This commit adds a tippy tooltip to the lightbox title which enables the
user to view the filename of an image if the filename is different than
the image title.

Fixes: #21333
2022-03-21 15:36:10 -07:00
Austin Riba 3df0cacd9e messages: Show tippy tooltip for inline images.
This commit adds a tippy tooltip for inline image previews in messages.

There exists some (reasonable) logic in `static/js/util.js` which
overrides all title attributes for links to user-uploaded content to
ensure they always display "Download <filename>". This doesn't make
sense for inline images specifically because they will be opened in a
ligthbox, so we prevent that.

There is an additional tippy instance created in `static/js/tippyjs.js`
to add tippy tooltips to inline images, which takes advantage of the now
preserved title attribute of the parent link.
2022-03-21 15:36:10 -07:00
Lauryn Menard 6063d063b7 narrow: Add message edit history check for near links.
If realm has edit history enabled, adds a check of message
edit history before rewriting operators.
2022-03-21 13:32:11 -07:00
Lauryn Menard 0844a80d66 edit_history: Check edit history for stream and topic match.
Creates a helper function in `message_edit.js` that loops over
a message's edit history to see if a stream and topic pair
existed at some point in the message history.

Exports `util.lower_same` function to use for comparing
edit history topics as lowercase.

Also adds test for new function in `mesage_edit` node tests.
2022-03-21 13:32:11 -07:00
Aman Agrawal f0c680e9c0 narrow: narrow: Make near links work on topic / stream change.
We check if stream and topic present in the URL match that of
the message in its current state. If message is not available locally,
we fetch it before rendering the narrow.

Fixes #15290.
2022-03-21 13:32:11 -07:00
Tim Abbott 86dacee91e narrow: Reorder early startup logic in narrow.activate.
This is important preparation for a recursive call we will be adding
to the function.
2022-03-21 13:32:11 -07:00
Ganesh Pawar b7edd5df2f settings: Place the saving indicator in the header.
Fixes #21441.
2022-03-21 13:30:38 -07:00
yogesh sirsat 3be023911b recent topics: Close Profile popover while muting user.
Fixes: #21456
2022-03-20 16:14:29 -07:00
YashRE42 33af1c1cd6 resize: Fix expensive navbar.resize_app calls leaving recent_topics.
It turns out that the bug this call hopes to fix only happens when the
user first loads the page to recent_topics and then navigates to a
view with a message list (any other view), but we'd make this call
every time the recent topics table was hidden.

Hence, this commit makes it such that we only make that call if (1)
the page is loaded to recent_topics and (2) we're switching from
recent_topics to a message list view for the first time.  We achieve
(1) via binding a handler via ui_init.initialize_everything and (2) by
binding the handler as `.one`, so that it's unbound after its first
invocation.

Additionally, we use window.requestAnimationFrame to prevent this
forcing the browser to do a reflow unnecessarily.

Combined with other commits in this series, this fixes a major
performance problem when leaving recent topics for another view.

See #20255 for details.
2022-03-18 18:23:34 -07:00
strifel a967a86b10 integration: Generate dynamic name for BigBlueButton video calls.
The name for a BigBlueButton meeting is now generated from the stream
name and topic name.

The createTime option is used to have the user redirected to a link
that is only valid for this meeting.

Even if the same link in Zulip is used again, a new createTime
parameter will be created, as the Meeting on the BigBlueButton server
has to be recreated.

Fixes #16498.
Fixes #20509.
Fixes #20804.
2022-03-18 17:27:39 -07:00
YashRE42 0d117ab033 narrow: Don't try to save the recent_topics pre_narrow_offset.
The previous logic didn't make sense -- the scroll offset in recent
topics is not a scroll offset within a message list, so saving it was
useless at best.

However, it was actually much worse than that, because trying to save
the pre-narrow offset while in the process of navigating away from
recent topics had the side effect of forcing a reflow, which resulted
in very expensive browser rendering to no purpose.

Adding this commit to the rest of the series of commits fixing
rendering issues when leaving recent topics, this commit results in an
impressive 3.05 s decrease in the first renarrow, an ~ 300 ms decrease
in the second renarrow and an ~ 500 ms decrease in the third renarrow.

There are still further forced reflows which could be reduced in this
render path, but they seem to not be as severe.
2022-03-18 17:15:36 -07:00
YashRE42 c4bb181056 recent_topics: Save offset when navigating from narrow or "all".
This is partially a prep commit to correctly saving/restoring the
position of the blue message select box when using browser
back/forward navigation, and partially a bug fix that ensures that
switching from "all_messages" to "recent_topics" preserves one's
position in "all_messages".
Note that this is with regards to saving the visual position of the
selected message, not about saving "which message was selected".
2022-03-18 17:07:53 -07:00
Nikhil Maske 5e8c8bfc0f settings_config: Rename "Unread count summary" to "Unread count badge". 2022-03-18 15:29:53 -07:00
yogesh sirsat 0d31781aed popovers: Support reactivating users from user profile popover.
If the target user is deactivated, `Reactivate this user` will be
shown as one of the options in the small user profile popover, where
`Manage this user` would usually be.

We rename `show_manage_user_option` to `can_manage_user` because now
it will also be used as the common condition for whether the current
user has administrative permission to active or deactivate the target
user.

The implementation closely follows the existing deactivation modal.

Fixes #21428.

chat.zulip.org discussion:
design > reactivate user from user popover
2022-03-18 15:19:13 -07:00
yogesh sirsat 1fb4dd2eee popovers: Remove parens around "This user has been deactivated".
These feel like unnecessary clutter, given that we also have italic
styling for this element.

Fixes part of #21428.
2022-03-18 15:19:13 -07:00
yogesh sirsat 211f137fc8 popovers: Remove the "Manage this user" link for deactivated users.
The "Manage this user" link did not work correctly for deactivated
users.

Fixes part of #21428.
2022-03-18 15:18:56 -07:00
N-Shar-ma ecf557eab9 typeahead: Update / hide typeahead menu on clicking outside.
When a user clicks outside the typeahead menu, inside the typing area,
the cursor position potentially changes, so `lookup` is called, which
considers the new cursor position and accordingly hides, continues
showing, or updates the typeahead menu.

This fixes the bug where even after clicking elsewhere, the old
typeahead menu continued showing and on making a selection, the text
was inserted at the wrong (new) position.

Fixes: #21302.
2022-03-18 14:59:28 -07:00
yogesh sirsat 84cdf03bb2 settings_users: Help center link in deactivate confirmation modal. 2022-03-18 14:54:01 -07:00
sayamsamal 5fb3aa4f44 CSS: Deduplicate CSS in image_upload_widget.css. 2022-03-18 14:43:13 -07:00
sayamsamal b06178767b settings: Fix upload spinner alignment in image upload widgets.
The upload spinners for all of the image upload widgets were in
wrong alignment due to the use of magic numbers to center them.

This commit replaces the above mentioned approach with the use
of flexbox to fix alignment issues across all the image upload widgets.
2022-03-18 14:43:13 -07:00