Commit Graph

8974 Commits

Author SHA1 Message Date
Anders Kaseorg b0ce4f1bce docs: Fix many spelling mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-07 18:51:06 -08:00
Aman Agrawal c827c73783 right_sidebar: Add realm description for spectators. 2022-02-04 16:00:59 -08:00
Austin Riba 81b1b18886 lightbox: Prevent undesired closing of lightbox during pan.
This commit adds a method of marking an overlay as being meant to be
left open despite click events triggering that would normally close it.
This is to prevent the case where a user drags an image and "unclicks"
in an area where normally clicking would close the overlay.
2022-02-04 14:58:36 -08:00
Austin Riba 1c2fd19d69 lightbox: Revert state of lightbox when closing the overlay.
This commit attempts to revert the lightbox state (at least
the pan/zoom part of it) when the lightbox is closed. The open()
function has been turned into a factory function so that the zoom
control which is instantiated on initialization of the lightbox can be
passed in to the on_close handler of overlay.open().
2022-02-04 14:58:36 -08:00
Austin Riba 5f83bc5cfe lightbox: Replace lightbox_canvas with PanZoom library.
This PR changes how the Pan & Zoom feature of images displayed in the
attachment lightbox are handled.

The existing method of using a canvas element is replaced by the Panzoom
library (timmywil/panzoom). This library is lightweight and has 0
transitive dependencies.

This fixes #20759 where the issue is that the viewport of a zoomed image
was not expanding to fill the available space on the page. Switching to
this new library also solves several other UX issues:

    * Images are no longer blurred when in Pan & Zoom mode.
    * The zoom behavior itself uses focal point zooming: zooming occurs
      where the cursor is on the image instead of at the center of the
      image, reducing the need for extra panning.
    * CSS transitions are used for a more visually pleasing experience
      when switching images, toggling zoom off, etc.
    * The library has the potential to open other file types which
      leaves that option open for us in the future.
2022-02-04 14:58:36 -08:00
Steve Howell 498b02dfb2 presence: Avoid doc/naming references to "orange".
It seems like orange is the loudest possible color to
denote a quasi-neutral-idle state, so we hope to
replace it with another color.

This commit does not change any styling.

I removed the sentences in the doc, since they are
kind of too vague to be useful. If we want to say that
the idle state is correlated with the half-orange
circles in the buddy list, then we want to say that
more specifically.
2022-02-03 15:31:21 -08:00
Steve Howell a9ea525757 pm list: Remove obsolete user_circle_fraction class. 2022-02-03 15:31:21 -08:00
Sahil Batra 984040fd39 js: Remove unused buddy_data.huddle_fraction_present function.
This function is not used currently after we removed the
"Group PMs" section from right sidebar in 43e5b2d28b.

This commit also removes presence.is_active function as it
was only used in buddy_data.huddle_fraction_present.
2022-02-03 10:59:33 -08:00
Sahil Batra d83b50d39f compose: Update error shown on sending message with no topic.
This commit updates the error message shown on sending a message
with no topic in an organization with mandatory_topics setting
set as true to match the error message in API.
2022-02-02 10:11:35 -08:00
Aman Agrawal 1f812df0d2 compose: Use tippy to show tooltips for top right compose icons. 2022-02-02 10:02:49 -08:00
Aman Agrawal a38b11d188 resize: Rename reset_compose_textarea_max_height.
This no logner just resets the max-height of compose-textarea
but also preview_message_area.
2022-02-02 10:01:27 -08:00
Aman Agrawal adf8446b51 compose: Resize compose-textarea after exit from markdown-preview.
Autosize library can miss resize of compose-textarea when
compose is collapsed / expanded while preview box is displayed
and compose-textarea is hidden. So, we force a autosize.update
of compose-textarea, when user exits markdown preview, to ensure
that the textarea is of correct size.

Fixes #19353
2022-02-02 10:01:27 -08:00
Aman Agrawal 31dd1d554c compose: Avoid preview message area overlap with last message.
Instead of blindly adjusting `compose-textarea` on resize,
we adjust the height of `compose-textarea` or `preview_message_area`
based on which is visible.
2022-02-02 10:01:26 -08:00
Priyam Seth 17f74a3f57 compose: Show warning while composing to a resolved topic.
This commit creates the function warn_if_topic_resolved that checks if
the topic to which the user is composing is resolved or not. First it
checks if the stream exists and then if the topic name starts with the
RESOLVED_TOPIC_PREFIX. If the conditions are true, a warning banner is
shown to the user.

It also shows to the user a button to unresolve the topic, if he has
the permission to do so.

Fixes #20584.
2022-02-01 17:50:17 -08:00
Tim Abbott 4989a300f8 message_edit: Fix internationalization of edited notices.
The previous internationalization approach didn't support languages
with a different word order than English.

We also switch to using "moved" to explain topic/stream moves,
consistent with how the message feed explains it.
2022-02-01 14:09:19 -08:00
Tim Abbott b7a07a753f message_edit: Fix display of repeated stream moves.
The recent commits to display the previous and new streams for a moved
message did not correctly handle messages moved multiple times.

To do this, we need to do a somewhat awkward loop, at least until we
modify the API to do this loop for us.
2022-02-01 13:59:31 -08:00
somesh202 71ce154a02 i18n: Add missing translation tags in edit history strings. 2022-02-01 12:25:40 -08:00
somesh202 2b10f958bb message-edit-history: Show the edited stream in the edit history.
Previously, message edit history never displayed stream moves.

Fixes #20452.
2022-02-01 12:22:46 -08:00
Sahil Batra 8565aad3fa stream_settings: Fix color of icon of the title in right column.
This commit fixes two things -

- We use the exact same color that is used for stream name in
day mode.

- Previously, we were passing black color explicitly to the
stream_privacy_icon template. This commit changes it to pass
different color in the night mode which is the same used for
stream name in night mode.
2022-02-01 11:25:01 -08:00
Aman Agrawal b4075b78eb message_feed_errors: Don't show search public stream to spectators.
Fixes #20299.
2022-01-31 17:12:03 -08:00
Tim Abbott c528e768ff message_scroll: Remove misleading comment.
The hacky code referenced in this comment was removed in
d59ccd4c0f.
2022-01-31 17:10:06 -08:00
Aman Agrawal f00db27b64 message_feed_errors: Convert to handlebars. 2022-01-31 17:10:05 -08:00
Aman Agrawal 8f2e973ab2 message_list_view: Cleanup unused bookend code.
`bookend_top` is already defined firmly for `group` in
`add_subscription_marker`, so no need to redefine it.

`bookend_bottom` is no longer used anywhere in the codebase. Not
sure what the history is here.
2022-01-31 16:50:54 -08:00
Aman Agrawal 93a03dcf3a message_list_view: Mark trailing bookend using a new variable.
We need to mark trailing bookends differently to identify them
in DOM easily. This fixes a bookend replication bug which can
happen sometimes when rendering.
2022-01-31 16:42:46 -08:00
Aman Agrawal 0bde50b851 stream_data: Set can_toggle_subscription to false for spectator. 2022-01-31 16:39:17 -08:00
Tim Abbott 6065d66d3d bookend: Simplify can_toggle_subscription variable flow. 2022-01-31 16:39:16 -08:00
Tim Abbott 2b59148e21 bookend: Simplify show_button check.
This lets us use a common function with the same logic, and thus
delete the need for a comment explaining why we think the logic is
correct.
2022-01-31 16:32:10 -08:00
Aman Agrawal 0ce2ae1782 bookend: Use it to advertise recent topics for spectators.
We show a minimal text "Browse recent topics" at the end of
every narrow. This will help new users to find additional
content on the app.

Fixes #19844
2022-01-31 16:32:09 -08:00
Aman Agrawal 0a614fe985 bookend: Move conditional bookend content inside the template.
We move the stream subscribed/unsubscribed bookend info from
js files to bookend handlebar.

Tweaked by tabbott to override the check-templates indentation logic.
2022-01-31 16:32:09 -08:00
Tim Abbott c0d4f8ec79 compose: Fix compose box initialization order.
This effectively reverts part of
70d444a8eb.  While it's correct that we
want to render this bit of Handlebars template early, it was not
correct to move all compose box initialization earlier.

Do the same thing we do with the left/right sidebar container
templates, which is to render them directly in `ui_init.js`.

Fixes #20778.
2022-01-31 10:12:45 -08:00
Anders Kaseorg 90e202cd38 docs: Consistently hyphenate “web-public”.
In English, compound adjectives should essentially always be
hyphenated.  This makes them easier to parse, especially for users who
might not recognize that the words “web public” go together as a
phrase.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-28 17:45:45 -08:00
strifel 9ae72fd48c compose_closed: Extract get recipient label helper.
This makes it possible to reuse this logic.
2022-01-28 14:54:22 -08:00
Tim Abbott b3df4ef23f lint: Fix missing newline at EOF.
Introduced in 98fa5c9ae2.
2022-01-28 11:51:29 -08:00
Aman Agrawal 98fa5c9ae2 flatpickr: Move `show_flatpickr` function in a new module.
This would avoid cyclic imports to access `show_flatpickr`
function.
2022-01-28 11:43:07 -08:00
Sahil Batra 78a81ab21a stream-settings: Add code to live update right panel title on changing privacy. 2022-01-28 11:39:15 -08:00
Sahil Batra 2280777168 stream-settings: Add code to live update right panel title on stream rename. 2022-01-28 11:39:15 -08:00
Sahil Batra 74294ae602 stream_settings: Extract function to set title in right column.
This is a prep commit such that we can use this function to
live-update the title.
2022-01-28 11:39:15 -08:00
Sahil Batra 12efde8a51 stream-settings: Refactor code to pass sub object to title template.
This commit refactors the code to directly pass sub object to
selected_stream_title template instead of passing name, is_web_public
and invite_only as different parameters.
2022-01-28 11:39:15 -08:00
Aman Agrawal 5688d8b0df scroll_bar: Remove unnessary adjustment of keyboard icon.
Since the keyboard icon is not associated with scrollbar, we
can just have a fixed margin-right for it.
2022-01-28 09:50:27 -08:00
Aman Agrawal b0dd063bb8 scroll_bar: Simplify module.
The content which is scrollable is moved left by the width of the
scrollbar when scrollbar is visible. The navbar, floating recipient bar
and composebox doesn't move. We reduce their width by scrollbar width
to adjust for the reduced width of the scrollable content.

Since floating recipient bar is center aligned (with margin: 0 auto)
we also have to move left by half the scrollbar width.

Group css classes having the same value being assigned together. This
makes the code easier to understand.
2022-01-28 09:50:27 -08:00
Steve Howell 576b966edc search suggestions: Add comment about server history. 2022-01-27 10:19:07 -08:00
Steve Howell eb2bf77212 search suggestions: Find older topics.
We no longer limit our list of candidate topics
to 300.

We continue to limit the topic results to 10, since
we don't want to overwhelm users or crowd out
non-topic-related suggestions.

We try to handle this is an efficient manner.
2022-01-27 10:19:07 -08:00
Sahil Batra 7265a76fc6 stream-settings: Show icon according to in the right column title.
We were showing # for all types of streams in the title at the top
in the right column of stream settings overlay. This commit fixes
it to show globe icon for web-public streams and lock icon for
private streams.
2022-01-26 12:50:05 -08:00
Sahil Batra e26de17ee1 stream-settings: Add space between # and stream name in title.
This commit adds space between # and the stream name appearing
at the top in right column in stream settings overlay.
2022-01-26 12:50:05 -08:00
N-Shar-ma 048c9b99e3 compose: Add format hinting for polls.
Added a placeholder key to the polls slash command object. This is
selected and highlighted after being typed ahead in the compose box.
For slash commands without placeholder, everything works as before.

Formatting hints can easily be added for other slash commands too,
by adding a placeholder key to their object.

Fixes part of #20868
2022-01-25 18:12:42 -08:00
Aman Agrawal ec86290e2a tippy: Fix persistent message action tooltips on icons after blur.
When users tabs through the message action icons, they used to
persist even when the focus is not on them. We manually
destroy them on blur event since tippy has some issue with
handling elements with opacity hiding effect.
2022-01-25 11:15:30 -08:00
N-Shar-ma a003fe0246 compose: Fix bug where stream color didn't update on mouse selection.
Called the `decorate` function to update stream color in the compose
box on `change` instead of `blur`.

On clicking on a stream option, the input box for the stream name
remained in focus, hence decorate wasn't triggered on blur. Using
the change event instead, ensures that decorate will be called
anytime the stream is changed.

Fixes: #20871
2022-01-24 17:14:47 -08:00
Anders Kaseorg 44f9aaec32 eslint: Fix unicorn/prefer-dom-node-dataset.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-24 15:55:38 -08:00
Anders Kaseorg 392676d4da js: Avoid _.get.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-24 15:54:21 -08:00
Anders Kaseorg cc40352541 js: Avoid _.first, _.last, _.initial, _.tail.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2022-01-24 15:54:21 -08:00