Commit Graph

13586 Commits

Author SHA1 Message Date
Anders Kaseorg cbca80c846 styles: Fix some invalid CSS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-09 09:37:31 -08:00
Greg Price a71fad9d6b shared: Bump version to 0.0.8. 2022-03-08 20:35:10 -08:00
Greg Price 760cfcc603 resolved_topic: Implement resolve, unresolve, and display.
We have two different frontend implementations of computing the
un-resolved form of a topic name, and they have a subtle -- but
intentional -- difference in behavior.

Factor them both out into the resolve_topic module, along with
their inverse, and with comments and tests.
2022-03-07 21:35:00 -08:00
Greg Price 7852d8e015 topic_list_data: Move "if resolved" conditionals to a single place.
These two conditionals are each relying on the other to trigger
on the same condition, and to do complementary things.  Move them
together to a single place so that that relationship is easy to see,
and to refactor.
2022-03-07 21:35:00 -08:00
Greg Price 7bf0fd3fa3 resolved_topic: Add and use predicate is_resolved.
We leave in place a couple of sites where the `startsWith` is
entangled with other string manipulation.  We'll handle those next.
2022-03-07 21:35:00 -08:00
Greg Price 624cdb0a14 resolved_topic: Start module, in shared package.
For the moment, just move the RESOLVED_TOPIC_PREFIX constant.
More next.
2022-03-07 21:35:00 -08:00
Greg Price dd1091c59a shared: Add a gitignore, for node_modules. 2022-03-07 21:35:00 -08:00
Steve Howell c43d48b22f stream create: Overhaul create-stream add-subscribers UI.
The most notable change here is that when you are adding
subscribers to a stream as part of creating the stream,
you can now use the same essential pill-based UI for
adding users as we do when you edit subscribers for an
existing stream.

We don't try to exactly mimic the edit-stream UI or
implementation, since when you are adding subscribers
during create-stream, we are just updating a list in
memory, whereas in the edit-stream UI, we immediately
send info to the server.

Fixes #20499
2022-03-07 16:58:58 -08:00
Dinesh 57b8e43dbb dialog_widget: Mention post_render in optional parameters for launch(). 2022-03-07 12:44:36 -08:00
Tim Abbott 5d136887b5 policies: Fix effective date on most recent DPA update.
The effective date on the DPA should have been February 7, because we
didn't actually update the zulip.com website until that day.

(This commit was added to the internal zulip.com branch during
deployment of the last DPA update, so users always saw the correct
information).
2022-03-07 12:01:25 -08:00
Tim Abbott 5ee5a7e635 specators: Fix persistent recent topics loading indicator.
This unfortunately requires somewhat ugly duplicated code, but I think
it's the best option for now.

I expect we will somewhat soon work on the transition to no longer
have two duplicate fetches here, and doing so will let us remove this
secondary code path.

Fixes #21304.
2022-03-04 15:51:09 -08:00
Steve Howell 2644fa9645 settings: Make list header sections consistent.
I made the header sections above all our settings
panel lists more consistent.

Before this change:

    * some lists had titles, others didn't
    * the placement of the filter box was random
    * alerts strangely went between the filter box
      and the list
    * filter boxes were too large
    * CSS was haphazard
    * forms were squished against tables

Now all the settings with list have consistent
HTML, CSS, and look-and-feel in the area directly above
their list of items.

With the exception of Custom Profile Fields, all the
lists with headers above them happen to be based on
ListWidget, but the header styling is not coupled
to ListWidget, because we want consistent headers
even if Custom Profile Fields has a non-ListWidget
list (due to its drag&drop features).
2022-03-04 14:37:28 -08:00
Tim Abbott 0c015c7bf3 css: Deduplicate CSS for .always_visible_topic_edit. 2022-03-04 13:25:30 -08:00
Junchen Liu e3237ae7e1 css: Fix hover color for "Edit topic" icon in recipient bars.
Previously, this had different hover behavior from the adjacent
elements, which seems like a bug.

The CSS for this component is shared with Recent Topics; we migrate
the styling for on_hover_topic_read for consistency.

Fixes #21273.
2022-03-04 13:25:30 -08:00
Greg Price 188c500802 shared: Bump version to 0.0.7. 2022-03-04 12:57:56 -08:00
Austin Riba 7dbd092afa shared: Avoid using all replaceAll.
Because Zulip Mobile supports some older iOS browser versions that
don't have replaceAll support yet, and mobile is averse to doing the
infrastructure work required to add a, polyfill we avoid using them in
the shared module for now.

See https://caniuse.com/mdn-javascript_builtins_string_replaceall
2022-03-04 12:29:31 -08:00
Anders Kaseorg baa11303ff alert_words: Fix alert words with HTML special characters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-04 12:26:49 -08:00
Anders Kaseorg ef706e51c3 js: Convert .split(…).join(…) pattern to .replace().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-04 12:26:49 -08:00
Anders Kaseorg 513207523c js: Fix various sloppy uses of String#replace.
Prefer a regexp match over using String#replace to strip expected
prefixes and suffixes because (a) it implicitly verifies that the
input has the expected format and (b) it won’t unexpectedly strip from
the middle of the string.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-04 12:26:49 -08:00
Steve Howell ea082af2ae edit stream: Make filter input more narrow.
You generally only need to type a few characters to filter
down to just a few folks, even in gigantic realms.

I tried not to make it **too** small, just in case, but
the default width was kind of gaudy.
2022-03-04 12:08:54 -08:00
Steve Howell 87aa318e3a edit streams: Change headings and move filter box.
The new layout is:

    Add Subscribers

        [input pill] [Add]

    Subscribers             [filter]
    <list of subscribers>
2022-03-04 12:01:09 -08:00
Steve Howell 79b9759c0b edit streams: Show "(you)" next to your name.
We show "you" in the subscriber list. This is similar
to what we already did in the Users tab.
2022-03-04 12:01:09 -08:00
Steve Howell 5f95a33fa3 create streams: Remove "Stream permissions" header.
The header was more confusing than helpful, and we
want the create-stream UI to be less cluttered.

We don't really need the help-center text here, since
we already have ? icons next to the relevant headings
for the sub-sections.

We kill off some CSS, but we won't kill off stream-title
until the big upcoming changes for stream pills.
2022-03-04 12:01:09 -08:00
Steve Howell 1ff7d91af6 create streams: Use vanilla labels for name and description. 2022-03-04 12:01:09 -08:00
Steve Howell aaf0449059 edit streams: Change "Search" to "Filter".
We only change stream-edit for now, for tactical reasons.

(We have big upcoming changes to stream-create.)
2022-03-04 12:01:09 -08:00
Tim Abbott e54dfda0b1 edit_history: Use modern edit history format in frontend. 2022-03-04 10:25:48 -08:00
Julia Bichler 24673b7a69 settings: Grey out muted streams in personal settings.
Muted streams are now greyed out in the personal settings,
also changes to the notification settings of a muted stream are
not possible anymore.

Also, add a bell-slash icon after the stream name of muted streams,
clicking on it unmutes the stream.

Fixes #19780.
2022-03-03 14:51:15 -08:00
Tim Abbott 76e5715c26 stream_edit: Fix live update for toggling muting.
Previously, updating the UI when streams are muted was split between
two places: The server_events.js code path, which updated the checkbox
state and other parts of the app, and checkbox click handler, which
toggled the disabling of the notification settings checkboxes.

Move these to all live in a single place.
2022-03-03 14:51:15 -08:00
Tim Abbott a93e8d37d4 stream_edit: Extract update_muting_rendering. 2022-03-03 14:51:15 -08:00
Austin Riba 75a29d6b82 lightbox: Remove Pan/Zoom enable button.
With the recent changes to lightbox image handling in #21145 and #20788
it is no longer necessary to have panning and zooming disabled by
default. This commit removes the enable/disable button and instead
replaces it with a "Reset Image" button, and enables panning and zooming
as the default state of the lightbox.
2022-03-03 13:48:32 -08:00
Austin Riba eae0975b63 lightbox: Prevent long titles from altering layout.
This commit attempts to prevent images with long filenames,
descriptions, or author names displayed in the lightbox from altering
the layout of the page.

It also adds a title prop to both the filename and author, allowing a
user to hover and see a tooltip of the full text in the case where the
text is truncated.

Fixes #21058.
2022-03-03 13:48:32 -08:00
Anders Kaseorg 44767dd653 tippyjs: Avoid unsafe allowHTML API in favor of <template> elements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-03 10:13:24 -08:00
Steve Howell 8c1ed7359f manage streams: Promote "Announce stream" in UI.
The option to announce streams is tied to whether
it's public or not, so it makes sense to move it
here.
2022-03-03 10:08:08 -08:00
NerdyLucifer a5d22b1d1e message_feed_ui: Make unread marker line continuous.
Make the unread marker lines at the side of messages continuous by
adding "height: 100%" to ".unread-marker".

This provides a nicer visual experience by not highlighting the
boundaries between messages. (One can see that information using the
timestamps or by moving the selection cursor, where appropriate).

Fixes #20981.
2022-03-02 17:21:30 -08:00
NerdyLucifer c355feea0e dropdown_list_widget: Hide 'disable' button when nothing is selected.
Hides 'disable' button of any kind when nothing is selected
in dropdown list widgets  by removing ':enabled' selector from
the button, the button is not actually a button, it's an <a> tag which
doesn't support "disabled" attribute.

Fixes part of #20831.
2022-03-02 17:18:50 -08:00
Austin Riba df1d395d4e shared: Add flow types for internal_url.
Adds flow type declarations for the shared internal_url module making
it integrate better with zulip-mobile.
2022-03-02 16:42:45 -08:00
jai2201 a8b948c086 tippy: Fix `cancel button` tooltip in compose box.
Add `data-tippy-allowHTML="true"` in button tag and fix the tooltip
for cancel button in compose box.
2022-03-02 09:39:15 -08:00
Anders Kaseorg bdcd9da7e9 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-01 23:09:46 -08:00
Anders Kaseorg d4d277bd1f styles: Remove legacy IE gradient filters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-01 23:09:46 -08:00
Yogesh Sirsat 67870090f5
settings: Use "Label" consistently for custom profile field label.
We use Label as the heading for the field label column in the custom profile
fields table; but for some reason the edit UI called this "Name" instead.

Fixes #21260.
2022-03-01 21:08:34 -08:00
Aman Agrawal e0aba4c639 recent_topics: Center align globe icon. 2022-03-01 21:00:36 -08:00
Austin Riba b22578f975 hash_util: Rename _uri functions to _url.
It's 2022 and the WHATWG no longer recognizes the term URI. Everything
is now a URL or a type of URL. Which is great because it's way less
confusing. Details here:
https://url.spec.whatwg.org/
2022-03-01 18:14:31 -08:00
Austin Riba b39d47995d hash_util: Move stream uri functions to shared.
Moves hash_util.by_stream_uri and hash_util.by_stream_topic_uri to
internal_url so they can be used by external codebases. Due to these
functions being called in many places in the web codebase, wrappers
for both functions are left in hash_util in order to keep these
calls simple.

Also adds test for explicitly testing each function.
2022-03-01 18:14:31 -08:00
Austin Riba 9f1c184311 hash_util: Move encode_stream_id to shared.
Move hash_util.encode_stream_id to internal_url, so it can be shared
with external codebases. Also add a test that explicitly tests escaping
special characters in stream names.
2022-03-01 18:14:31 -08:00
Austin Riba 403310a9e2 hash_util: Move stream_id_to_slug to shared.
Move stream_data.id_to_slug to internal_url, making it shareable. The
function has been renamed to stream_id_to_slug to reflect that it
operates on a stream id.
2022-03-01 18:14:31 -08:00
Austin Riba c0828f118b hash_util: Move enc/decodeHashComponent to shared.
Moves the encodeHashComponent and decodeHashComponent functions out of
hash_util and into internal_url which belongs to shared. This is to
accommodate sharing of this code with mobile or any other codebases that
do not wish to duplicate logic.
2022-03-01 18:14:31 -08:00
Austin Riba f6d9a0b5a4 hash_util: Pass up decoding exception.
In order to accommodate the sharing of hash_util with other codebases
including mobile, UI and web specific code should be removed. In this
commit, we remove exception handling for the decodeHashComponent
function and instead add the UI handling of it further up the call
stack.
2022-03-01 18:14:31 -08:00
Austin Riba 980fd2f976 streams: Fix malformed stream name slugs.
The stream_data.id_to_slug and stream_data.name_to_slug
functions mistakenly used Javascript's String.replace method,
this commit changes it to use String.replaceAll, the result
being slugs generated from streams with names greater than
2 words are now properly formatted.
2022-03-01 18:14:31 -08:00
Anders Kaseorg 8ed7dcf4c0 rendered_markdown: Appease zjquery.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-01 15:19:15 -08:00
Anders Kaseorg d22fca7a78 timerender: Fix object-shorthand ESLint error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-01 14:37:48 -08:00
Anders Kaseorg e090027adc CVE-2022-23656: Fix cross-site scripting vulnerability in tooltips.
An attacker could maliciously craft a full name for their account and
send messages to a topic with several participants; a victim who then
opens an overflow tooltip including this full name on the recent
topics page could trigger execution of JavaScript code controlled by
the attacker.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-03-01 14:26:42 -08:00
Tim Abbott 05a17e5854 spectator: Use display: revert for only-visible-to-spectators.
Inherit uses the settings of the parent element; we actually want to
just undo the `display: none` we'd set for this CSS property, which is
what revert is for.
2022-03-01 11:55:24 -08:00
Tim Abbott 7cc553b75d spectators: Add divider before sidebar login/signup buttons.
This slightly improves the visuals of this component.
2022-03-01 11:51:46 -08:00
Tim Abbott c710d18ec5 spectators: Use display: inherit for only-visible-to-spectators.
The previous `display: unset` logic didn't work with dividers in the
gear menu. This new version should be correct -- what we want to do
here is just override the `display: none` default for this class, not
revert to the default browser styling for that element type.
2022-03-01 11:45:54 -08:00
Aman Agrawal 7e365f7ee3 icons: Replace fa-globe icon with a custom globe icon. 2022-03-01 11:36:38 -08:00
yogesh sirsat 1a15d60de4 settings: Fix external account profile field initialization order.
In open_edit_form, we had an initialization order bug where we called
set_up_external_account_field_edit_form, which clears the field name
field if the external account is of the "custom" type, after
populating the initial values for edit form.

This resulted in these fields being displayed as empty in the UI for
this field type. Fix the issue by reordering the initialization.

Fixes: #21262.
2022-02-28 16:30:49 -08:00
Anders Kaseorg f244c2eca4 Revert "drafts: Use simplebar for scrollbar."
This reverts commit f3964673e7.

It broke drafts_scroll by confusing jQuery object APIs with DOM
element APIs.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-28 15:26:47 -08:00
Julia Bichler f3964673e7 drafts: Use simplebar for scrollbar.
This was originally merged in #21082 in a different variation.
2022-02-28 15:06:19 -08:00
Sahil Batra 9f89d7e069 left_sidebar: Move "Recent topics" higher in the sidebar.
This should increase its visual priority in the UI. We plan to move
"Private messages" to a different component more similar to STREAMS
soon.

Fixes #20869.
2022-02-28 12:09:24 -08:00
Tim Abbott 7ddefc68cc settings: render_alert_words_ui -> rerender_alert_words_ui.
Correctly specifying that this is a rerender function makes starting
with a `loaded` conditional make much more sense.
2022-02-25 17:33:11 -08:00
jai2201 d6c00521b3 settings: Clean up muted_topics/users rendering logic.
This commit removes the unnecessary `data-list-widget` attribute
present in the <div> and <tbody> tag for muted_topics and muted_users table.

It became unnecessary/useless in 19cf6d0e04 and
then was renamed while still useless.

Also uses the correct variable name `muted_topic` and `muted_user`
instead of `muted_topics` and `muted_users` to render a item of their list
in DOM through Listwidget.
2022-02-25 17:33:11 -08:00
jai2201 5e49ddf4e1 settings: Add sorting feature for list of alert words.
This changes the method of rendering list of alert words in DOM,
earlier it was rendered using 'for' loop over the array of alert_words
which is now changed to render using ListWidget, which gets a array
of objects from get_word_list() in alert_words.js.

The use of ListWidget helps to define a parent_container and $container
in table-body of alert-words-table using which we can now apply sorting over
alert words with the help of handle_sort() function in list_widget.js

Changed the method of adding alert_word_settings_item row in table body
through {{#with}} loop because of rendering through ListWidget, which was done
earlier using for loop over each alert-word in while rendering the list.

this commit also mocks template of render_alert_word_item
while mocking ListWidget.create() function in render_alert_words_ui().
and checks that ListWidget.create() is not called when variable `loaded`
is set as false.

Fixes #21142.
2022-02-25 17:33:11 -08:00
Aman Agrawal 27b985e868 recent_topics: Standardize format of last message time.
We follow how other apps present older messages, e.g. Gmail,
Facebook Messenger, etc. display it.

Specifically, the logic we use is:

If the time is <24hr ago, show an absolute time, like "21:30" (or "9:30pm").
Otherwise, show what day it was, and not a time
  If the day was yesterday, say "Yesterday".
  Otherwise, if it was <7 days ago, say the day of week, like "Friday".
  Otherwise, if it was <1 year ago, say the month and day, like "Sep 6".
  Otherwise, say the year, month, and day, like "Sep 9, 2020".

With some tweaks from Tim Abbott to better handle the future case.

Fixes #19775
2022-02-25 16:33:47 -08:00
Aman Agrawal 5ae178b39c recent_topics: Show loading indicator before fetching initial messages.
Hide the loading indicator after initial fetch for recent topics.
2022-02-25 16:29:43 -08:00
Aman Agrawal 98c2038718 recent_topics: Position empty topic text independent of columns.
This avoids a column width change after initial loading of
messages finishes and "No topics match your current filter"
text is displayed.
2022-02-25 16:29:43 -08:00
Aman Agrawal bab9e50581 scroll_to_bottom_button: Use unicode icon for right arrow. 2022-02-25 14:57:22 -08:00
Sahil Batra 75d54206e6 buddy_list: Remove user from buddy_list immediately on deactivation. 2022-02-25 14:55:44 -08:00
Sahil Batra dc478ee091 settings_users: Remove unused code from update_user_data.
Previously, update_user_data was called when deactivating
bots, but it was removed in 58b612a4f0.

Now, update_user_data is only called for 'type="realm", op="update"'
events, but these events are not sent when deactivating or
reactivating a user or bot, so this code is not used.
2022-02-25 14:55:44 -08:00
Sahil Batra 6a64e1c442 settings_users: Call update_view_on_deactivate from server_events_dispatch.
This commit changes the code to call update_view_on_deactivate function
from server_events_dispatch.js on receiving the user/bot remove event
instead of having it repeatedly in the success_continuation method
of click handlers.

We also add check to make sure we return early if the relevant settings
page is not opened yet.
2022-02-25 14:55:44 -08:00
Sahil Batra 9b7dcd11ae settings_users: Pass user_id instead of row to update_view_on_deactivate. 2022-02-25 14:55:44 -08:00
Mateusz Mandera d5db254ca8 CVE-2021-3967: Only regenerate the API key by authing with the old key. 2022-02-25 14:00:52 -08:00
jai2201 9288f00cd7 recent-topics: Add `width` CSS property in filter check icons.
This commit adds a width of 10px to fa-square and fa-check-square
icons in recent-topics table, so that on toggling between these icons
we can prevent the change in width of the whole button to make it look
good visually.
2022-02-25 11:15:54 -08:00
Sahil Batra 9be82356cb invite: Add frontend support to send an invite which never expires.
Fixes part of #20337.
2022-02-24 16:32:20 -08:00
Sahil Batra cec8191bfa popovers: Add option to deactivate user to "Manage user" modal.
This commit adds option to deactivate user to "Manage user" modal.
A modal is opened on clicking the option to confirm the deactivation
and the "Manage user" modal is closed.
The error from the server, if any, is shown in the modal itself
and in case deactivation is done successfully, the modal is closed.

Fixes #18944.
2022-02-24 15:59:58 -08:00
Sahil Batra 0a27c38af7 settings: Pass handle_confirm function as argument to confirm_deactivation.
We pass handle_confirm function as an argument to confirm_deactivation
because we will use confirm_deactivation to deactivate the user from
user-info popover and the popover case will have a different handle_confirm
function (which is called after clicking "Confirm" button of the modal)
since error handling in that case will be different as there will be no
overlay in the background.
2022-02-24 15:59:58 -08:00
Anders Kaseorg 21cd1c10b3 docs: Add missing space in “time zone”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-24 14:05:12 -08:00
Austin Riba 26ec71c39d lightbox: Prevent panning image out of view.
This commit adds a method to detect whether the draggable element has
moved out of view and if it has, move it back into view.

The panzoom library does have a `bounds` option that is supposed to
provide the functionality, but at the time of the commit it does not
appear to work correctly. Upstream bug:
https://github.com/anvaka/panzoom/issues/112
2022-02-23 12:13:17 -08:00
Austin Riba 7d3bbe03ac lightbox: Swap panzoom library to anvaka/panzoom.
This PR changes the library used for panning and zooming in the lightbox
module from timmywil/panzoom to avanka/panzoom.

The original (timmywil) version of the library contains a bug where if
you have a high resolution touchpad and Firefox and you zoom in and out
repeatedly on an image, the image may drift. avanka/panzoom does not
appear to display this behavior.

Restores the behaviour from before 5f83bc5cfe, where clicking
outside the image closes the lightbox, primarily by way of swapping
out the panzoom library.

Fixes: #21163.
2022-02-23 12:12:04 -08:00
Steve Howell ca17a452fd subscribers: Rename file to stream_edit_subscribers.js.
We are going to move to this code organization for
managing streams:

    stream_create.js
        stream_create_subscribers.js
    stream_edit.js
        stream_edit_subscribers.js

The modules stream_create.js and stream_edit.js historically
manage the entire process of creating and editing stream
data (respectively).

Going forward both will delegate most of the subscriber-specific
pieces to either stream_create_subscribers or stream_edit_subscribers.

The stream_*_subscribers modules will be somewhat similar in
nature, but the way that we manage subscribers at creation time
is a bit different than how we manage subscribers at edit time.
2022-02-22 16:29:36 -08:00
Steve Howell 22660a78c7 edit subscribers: Generalize pill/button handling.
This will help us avoid some duplicate code when
we use input pills for stream-create.

See the long comment in set_up_handlers() for
more context.

We also rename:

    submit_add_subscriber_form -> subscribe_new_users

Ideally set_up_handlers() would also extract the
concept of clearing the pills as soon as you either
hit enter or clicked on the Add button, but our
current paradigm for clearing pills when you edit
subscribers for an existing stream on the Subscribers
tab is that we wait for the server to acknowledge
the request. I believe this is a bit of a misfeature,
but I am punting on that change for now.
2022-02-22 16:29:36 -08:00
Steve Howell ebda1dfc8b manage streams: Extract add_subscribers_pill.js.
This is mostly a pure code move.  A few small tweaks:

    * The create() function is new.
    * The new module doesn't assume a `pill_widget`
      global.

This module represents the truly re-usable code
that can be shared during these two user actions:

    * edit-stream subscribers (now)
    * create-stream subscribers (future)

In both situations the input pill has (or will have)
essentially the same behavior, and the next commit
will tighten up the abstraction.

(The two processes will both also use fairly similar
ListWidgets, but the mechanics of managing the list
are going to be different, so we do not intend
to keep around stream_subscribers_ui in its current
name. More on that later.)
2022-02-22 16:29:36 -08:00
Steve Howell 65b51ae3bd subscribers: Extract subscriber_api.
This simplifies some of our dependencies.

As an example, we really don't want compose.js
to depend on stream_subscribers_ui.js, since
the former doesn't use any actual UI code from
the latter.

We also rename the two functions here:

    invite_user_to_stream -> add_user_ids_to_stream
    remove_user_from_stream -> remove_user_id_from_stream

(The notion of "inviting" somebody to a stream is
somewhat misleading, since there is really no invitation
mechanism; you just add them.)

Apart from naming changes this is a verbatim code move.

Finally, we eliminate a little bit of test cruft--the
`override` helper already ensures that a function gets
called at least once during a test.
2022-02-22 16:29:36 -08:00
Steve Howell 1bf9a9e84a node tests: Directly test user_group_pill helpers.
We also sort user_ids to be deterministic.
2022-02-22 16:29:36 -08:00
Steve Howell 0452f49c97 node tests: Directly test simple stream_pill helpers.
We also sort the user_ids to be deterministic.
2022-02-22 16:29:36 -08:00
Purushottam Tiwari 3984df88bb message-editing: Add support for dynamic elements in edit-history.
Edit history of message was rendered directly without passing
it through rendered_markdown.js. Due to this several visual
features for dynamic elements like time, spoilers, mentions
etc were not available.

To fix above issues we pass the content of edit-history
through rendered_markdown before showing edit history modal.

Fixes: #16029.
2022-02-22 15:00:01 -08:00
m-e-l-u-h-a-n 16687d4c74 markdown: Improve drafts rendering of custom Markdown features.
Improves rendering of drafts to make it look more closer
to normal messages. This is done by passing the draft content
through rendered_markdown so that dynamic elements in the content
get updated before showing drafts modal.
2022-02-22 14:59:50 -08:00
Sayam Samal d763847cb9 settings: Fix overflow due to unset border-radius. 2022-02-22 10:42:21 -08:00
Sayam Samal bbfc958c62 settings: Fix responsiveness of the profile avatar.
Moves the profile avatar to the top when the viewport is narrowed down.

Tweaked by tabbott to add the 20px bottom margin in a more consistent
way, which also lets us deduplicate some code.

Fixes #21000.
2022-02-22 10:41:59 -08:00
Sahil Batra 2c664a85fb bots: Do not allow to remove owner from edit bot form in personal settings.
d6fb439c7a removed the option to remove owner from the edit form available
to admins, but the option was still present in the edit form available to
the owner of bots in "Bots" section of personal settings. This commit
removes the option from form in "Bots" section of personal settings as well.
2022-02-22 10:35:18 -08:00
NerdyLucifer 891ed242d1 popovers: Add "busy" status to default emoji status set.
Add info about the status in the array
"default_status_messages_and_emoji_info".
Set status message as "Busy" and emoji "working_on_it".

Fixes #21179
2022-02-22 10:33:31 -08:00
Sahil Batra 21051d2130 settings: Show or hide digest weekday option on changing emails setting.
Previousy, we used to show or hide the digest weekday setting after
saving the emails setting, but now we show/hide as soon as we check
or uncheck the email setting checkbox like we do for other settings.
2022-02-21 08:53:33 -08:00
Dinesh 6afdf2410d message feed: Notify user when messages are not being marked as read.
Notifies user when messages are not being marked as read through a
banner that lets them mark all messages in the narrow as read. Note
that the banner is only displayed if the user's actions, like
scrolling, would've actually marked the messages as read.

This avoids distracting the user when viewing a thread they've already
read.

tabbott has verified that if new messages come in, the banner will reappear.

Fixes: #18768.
2022-02-18 14:48:31 -08:00
Tim Abbott bb5889b0a0 message_list: Add helper for checking if a message list has unreads. 2022-02-18 14:48:31 -08:00
Dinesh a2ca558c3e unread_ops: Add process_scrolled_to_bottom().
There are a few instances where we check if messages can be marked
read and mark that list as read when scrolled to bottom. Using
this would be nicer and also this function can be extended later to
display a banner when messages are not being marked.
2022-02-18 14:48:31 -08:00
jai2201 1b0b0d64e5 left-sidebar: Align more-topics li item with other topic names.
The class `sidebar-topic-check` has a minimum width assigned for the
`topic-resolved` icon to create an appropriate space for that column
whether or not there are resolved topics present.

Add a corresponding `margin-left` to align `more topics`
appropriately.
2022-02-18 13:39:08 -08:00
Aman Agrawal 0eafa6039b message_scroll: Show scroll to bottom button.
Show/hide scroll to bottom button when the last message is
not visible in the current scroll position.

We adjust the bottom offset of the button based on compose box
height.

Fixes #19862
2022-02-18 13:29:57 -08:00
Aman Agrawal ea07b6440c integrations: Adjust font size to fit integration name during initial load. 2022-02-18 12:22:32 -08:00
Aman Agrawal d9497afe9d integrations: Don't fix height of integration icon in detailed view.
This allows us to have more characters that we can use for the
integration name without overflowing the fixed height.
2022-02-18 12:22:32 -08:00
Aman Agrawal 9b622b7d25 gear_menu: Allow user to configure preferred theme.
We save the preferred theme in localstorage so that user doesn't
have to re-select the theme on every reload. Users on slow
computers might see flash of a theme change, if it happens.
2022-02-18 11:29:48 -08:00
Aman Agrawal 8e7e8c7179 gear_menu: Hide non-relevant buttons for spectators. 2022-02-18 11:27:12 -08:00
Aman Agrawal b675db78a3 compose: Change icon of formatting popover to a question.
Fixes #21183
2022-02-18 11:16:19 -08:00
Aman Agrawal bd97797904 compose: Add right padding to drafts to make outline look even. 2022-02-18 11:16:19 -08:00
Aman Agrawal ad555f2feb tippy: Only change background color of tooltips with no theme.
This change was not aimed at popovers that use tippy. Since
popovers use light theme and tooltips don't, we use this
`not[data-theme]` selector to exclude popovers from being
affected by this change.
2022-02-18 10:51:35 -08:00
yogesh sirsat 8a1df07e64 recent topics: Display user info popover when clicking participants.
Tweaked by tabbott to do something reasonable for muted users and
display a cursor indicating clicking will do something.

Fixes #21154.
2022-02-17 15:49:24 -08:00
Aman Agrawal 70c9c2e137 message_events: Remove existing messages that were updated.
For filters that cannot be applied locally, we don't know if the
messages are still a part of the filter. So, we remove the
existing message that were updated and let `maybe_add_narrowed_messages`
treat them all as new messages to the filter.

This fixes the bug where existing messages that were present in
the narrow were not updated.
2022-02-17 15:11:48 -08:00
Aman Agrawal bda90ec5ae message_events: Ask server if cannot filter locally.
For filters that cannot be applied locally, we ask the server
to determine if the `events_messages` are part of the narrow.

Fixes #21073
2022-02-17 12:56:33 -08:00
Aman Agrawal a7f904cdc3 message_events: Take function to add messages as callback. 2022-02-17 12:56:33 -08:00
Alya Abbott e93320c40d portico: Add a self-hosting page.
Co-authored-by: Aman Agrawal <amanagr@zulip.com>
2022-02-17 12:43:13 -08:00
Aman Agrawal c396c2f7a4 home: Send rendered realm description for spectators.
Display rendered markdown after passing it through our local
rendered_markdown JS library.
2022-02-17 16:17:15 +00:00
Aman Agrawal 73266350ef user_info_popover: Hide user local time for spectators. 2022-02-16 13:25:53 -08:00
Jai soni 9cd27fd773
right sidebar: Add word-wrap property in tooltips.
This prevents the overflow of tooltips on hovering over buddy list.

Fixes #21119.
2022-02-16 12:59:38 -08:00
Yogesh Sirsat dcae70c0c0
stream_settings: Ignore hover on actions column in tables.
In the dark theme, disable the hover behavior to display sorting options
for actions column in tables (Which doesn't support this).

Matches existing behavior in light theme.

Fixes: #21137
2022-02-15 17:47:55 -08:00
N-Shar-ma 728fee31b2 typeahead: Ignore mouse position for selection until it's moved.
Added a property `mouse_moved_since_typeahead` to the typeahead class
which tracks whether the mouse has been moved since the typeahead
menu appeared.

The hovered over menu item is highlighted on `mouseenter` only if
`mouseMoved` is true. Otherwise, the cursor is hidden temporarily.

Code substantially reorganized by tabbott.

Fixes: #21018.
2022-02-15 17:26:22 -08:00
Tim Abbott 653af70d5a typeahead: Avoid spurious href on typeahead links.
This cause the browser to display an inaccurate indication of what
will happen if you click.
2022-02-15 17:26:22 -08:00
Aman Agrawal 3736c943b3 narrow_banner: Add special notice for spectators.
On non web public stream narrows, tell user that stream is not
web public or does not exist.
2022-02-15 17:21:41 -08:00
Aman Agrawal fd0f26dc1b right_sidebar: Minor improvements.
Fix width of realm description.
Reduce left margin of list in rendered markdown.
Increase right margin.
2022-02-15 17:21:41 -08:00
Aman Agrawal c3b6b48fa2 click_handlers: Only select messages on click by a spectator.
When a message clicked, don't show login modal or open compose
for a spectator.
2022-02-15 17:21:41 -08:00
Aman Agrawal 450e4bbb56 login: Specify spectator login is in beta. 2022-02-15 17:21:41 -08:00
Sahil Batra d6fb439c7a bots: Do not allow removing owner from UI.
This commit removes the "Remove owner" button
from bot-edit form since we anyways do not allow
to remove owner in the API.

Fixes #20116.
2022-02-15 17:15:39 -08:00
Steve Howell 1e8dff6ca9 edit subscribers: Lift form tag to parent template.
For our Subscribers tab we want to enclose our
add-subscriber widget in a form for now, and we
continue to do so, but now we have the form tag
getting created in the parent template, not the
child.

Here is why:

    We want to re-use our add-subscriber widget in an
    upcoming commit for when you create streams.

    In our create-stream UI, there is already an outer
    <form>...</form> section of the HTML for the entire
    process of creating a stream.

    HTML does not yet you nest forms, and even though
    browsers just silently ignore an inner form, we won't
    want to create semantically incorrect HTML.

    Therefore, we want the child template not to have
    the form tags around them.

It's possible that we don't really even want to
enclose the input-pill widget and Add button inside
a form for the Subscribers tab, but tweaking that
for now is too risky. (We don't really take advantage
of the form tag in any meaningful way, since we
don't directly submit form data to the server, and
we can't use a single submit handler for the Enter
key and Add button due to some magic in our input
pills.)
2022-02-15 17:15:02 -08:00
Steve Howell 67fe782714 create stream: Improve click handler for Create.
We want to avoid submit handlers here, because we may
have embedded widgets that have their own forms or
buttons.

We use "finalize" here to distinguish the two Create
buttons related to streams.  You hit one button to
start the UI and then the second button to finalize
the process.

I also fix the bad test idiom of clicking on the
sea-green button.
2022-02-15 17:15:02 -08:00
Steve Howell e8ad76f522 subscribers: Fix misleading placeholder text.
You don't start auto-completing user groups with an @,
so the previous placeholder text made no sense.

There might be a better way to do autocomplete in
these add-subscriber input pills, but that is beyond
the scope of my current efforts.
2022-02-15 17:15:02 -08:00
jai2201 44bd6cafb7 js: Add tabindex attribute for anchor tag to allow focus.
This adds tabindex='0' in anchor tags for allowing the message menu
popover box to be focusable using hotkey 'i' through keyboard.

This is a necessary follow up to
729c09074a, which removed the href
attribute from anchor tags to which click-handlers were attached,
which resulted in making them non-focusable as jQuery doesn't allow
anchor tags to be focusable without tab-index or href attribute.

Fixes #21125.
2022-02-14 15:23:46 -08:00
Tim Abbott 36b208ad51 reactions: Increase font size for reactions.
This seems to have no negative effect, and substantially improves the
visuals in situations where we're displaying a user's name.

While we're at it, switch to a relative font size.
2022-02-14 12:01:09 -08:00
Tim Abbott d915a13d61 filter: Add near operation to operators allowing collapsing.
I noticed this bug only a few minutes after merging
02af4e9ad0.
2022-02-14 12:00:11 -08:00
Aman Agrawal 430d1a411e tippy: Make background color of tooltips close to black.
This is aimed towards increasing the contrast for tooltips in
dark theme.
2022-02-14 11:57:04 -08:00
Tim Abbott 02af4e9ad0 message feed: Don't share headers for non-adjacent messages.
When viewing a narrow such as a search or `sender:` view, where
consecutive messages in the view may not be consecutive in their
original stream/topic context, we should avoid displaying the messages
with a shared sender/recipient bar header, as that creates the
incorrect perception that they are consecutive.

Back in 2013 (bc8bc8567b), we
implemented this via the collapse_messages flag, but it appears more
recent refactoring (no more recent than
dbffb2a614) made it always true.

The original logic was incorrect, in that it only considered full-text
search views, and not other views with this property.

I originally planned to use the existing logic for
can_mark_message_read designed for this purpose, but I think there
might be product reasons why might want the logic to be independent.
2022-02-14 11:53:35 -08:00
ditsuke 6491ed7213 message_feed_view: Align images with message.
Removes the 5px `margin-right` on images, replacing it
with a 5px `margin-left`. This change aligns the images
with the message content while making sure they do not
stick stick together in other layouts.
2022-02-14 11:48:01 -08:00
Aman Agrawal 2421f6846d compose_control_buttons: Move GIF button out of the popover. 2022-02-13 19:13:29 -08:00
Tim Abbott c4af509339 left sidebar: Increase bottom margin.
This improves the visual appearance of the state where you're scrolled
to the bottom with your mouse over a URL.
2022-02-11 14:33:54 -08:00
jai2201 e11c495dff left-sidebar: Leave space below link for it to be visible.
Add a margin below the subscription link for it to be visible when we
hover over links, where the browser will display the URL in the
bottom-left corner of the screen.
2022-02-11 14:28:30 -08:00
jai2201 2281adc101 left-sidebar: Make subscription link non-sticky. 2022-02-11 14:28:09 -08:00
Tim Abbott c674d4cac0 templates: Fix indentation formatting of input_pull.hbs. 2022-02-11 13:58:02 -08:00
YashRE42 96682a3517 status_emoji: Show status emoji in compose_pm and mentions typeaheads.
Previously the emoji_status set by the user would only be seen in a
few places, it was decided that it would be useful to show the
emoji_status in a couple of other additional places as well.

As such this commit uses the status_emoji template to show the status
emoji in the compose_pm typeahead and the mentions typeahead.

Status emoji changes do not live update these, but neither do user
renames, so there's bigger problems if that's a concern.

Fixes: #19865.
2022-02-11 13:30:08 -08:00
YashRE42 fa7c8f8c32 status_emoji: Show status emoji in compose_pm pills.
Previously the emoji_status set by the user would only be seen in a
few places, it was decided that it would be useful to show the
emoji_status in a couple of other additional places as well.

As such this commit uses the status_emoji template to show the status
emoji in the compose_pm pills. Due to the fact that we use the same
pills system to render in the user_group, we need to add a
conditional to prevent rendering there since the user status is not
valuable there.

Status emoji changes do not live update these, but neither do user
renames, so there's bigger problems if that's a concern.
2022-02-11 13:30:08 -08:00
Tim Abbott 93ce3396ac status emoji: Adjust margin for common element.
After some experimentation, these styles look better in all the places
we're displaying status emoji.  See the comments for justification.
2022-02-11 13:29:32 -08:00
AnushaNathRoy 8da5edb7af status_emoji: Show status emoji in message_body.
Previously the emoji_status set by the user would only be seen a few
places, it was decided that it would be useful to show the
emoji_status in a few additional other places as well.

Use the status_emoji template to show the status emoji in the
message_body and also implement live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-11 13:02:56 -08:00
AnushaNathRoy e1fd47a692 status_emoji: Show status emoji in single PMs in the PM list.
Previously the emoji_status set by the user would only be seen in the
buddy list, it was decided that it would be useful to show the
emoji_status in other places as well.

As such this commit uses the status_emoji template to show the status
emoji in the PM list and also implements live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-12 01:06:52 +05:30
Mr.mad 22bfa56301 left sidebar: Redirect users with no stream create permissions.
Previously, when the user clicked the `Add streams` icon in the
streams list sidebar, we provided a popover offering to create or
subscribe.  This was confusing for users who did not have permission
to create streams.

Redirect users that don't have stream creation permissions
directly to browse streams without going through this popover.

Fixes: #20676.
2022-02-11 11:02:09 -08:00
Tim Abbott a6c364cdd7 left sidebar: Rename streams_inline_cog.
The icon hasn't been a cog for some time.
2022-02-11 10:58:32 -08:00
Tim Abbott 68055048a0 message feed: Add 4px left margin to edited notices.
This makes them not look squished up against the name.
2022-02-10 13:52:24 -08:00
jai2201 67625d6c7b message_feed: Remove the parenthesis around edited notices.
They were found to not particularly improve the UI.

Fixes #21043.
2022-02-10 13:52:24 -08:00
Aman Agrawal 0ac8f053a6 search_suggestions: Remove filters unusable by spectator. 2022-02-10 11:37:38 -08:00
Aman Agrawal 6e4c2e63f5 right_sidebar: Make spectator login buttons don't stick to scroll bar. 2022-02-10 11:37:38 -08:00
Aman Agrawal bf3bf285a2 recent_topics: Hide mute and read buttons for spectators. 2022-02-10 11:37:38 -08:00
Mr.mad c80275370e stream_color: Fix stream color not updating to default.
Previously, if the user changes any stream color and updates it back
to the default color without reopening the change color popover, the
second color change didn't take effect.

Fix bug by destroying the colorpicker object and rebuilding it again
every time a color change is triggered by the confirm button.

Fixes: #21055
2022-02-09 16:20:24 -08:00
YashRE42 c81a8c0346 message_live_update: Only rerender relevant messages for name/avatar.
Previously, we would call `rerender_messages_view()` in order to
rerender messages after user renames or avatar updates. This would
lead to rerendering the entire message list for every change,
regardless of whether any specific message had changed or not.

This used to be acceptable because user renames and avatar updates
were rare events, however, as we plan to show user status emoji near
user names and updates to those would be more frequent than is
affordable, this commit implements
`rerender_messages_view_for_user(user_id)` which only rerenders
messages which have actually been changed.

This commit is, thus, both an optimisation for the existing code and a
prep-commit for the user status emoji.
2022-02-09 14:17:36 -08:00
YashRE42 33f9e83588 message_list_view: Recalculate more fields for _rerender_message.
Previously, we used to only calculate sender_is_bot, sender_is_guest,
small_avatar_url and background_color on the message_container via
build_message_groups (ie via .render, which also gets called from
.rerender_with_target_scrolltop).

This would mean that if we tried to use `_rerender_message` to update
just a single message (which is something we'd like to do, in order to
make rerenders more efficient), these values would not update.

(This could lead to avatars not light-updating properly).

As such, this commit moves assignment of these values into
`set_calculated_message_container_variables`.
2022-02-09 14:16:02 -08:00
Anders Kaseorg a800a86f54 Revert "drafts: Use simplebar."
This reverts commit 8e06335788 (#21048).

It regressed the ↑ and ↓ keys because drafts.drafts_scroll was not
updated to use ui.get_scroll_element.  Also, styling the native
scrollbar as hidden is not the right workaround because the hidden
native scrollbar still exists and can be scrolled independently of the
SimpleBar.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-09 14:15:27 -08:00
Parth e3ddd662ab message_editing: Fix topic edit propagate option cut-off.
In the topic changing UI, the 'Change later messages to this topic'
and other options in the drop down were cut off when selected in some
languages like Russian.

Make the selection box width adjust appropriately according to the
length of the text, and also place it on its own line unconditionally.
users.

With tweaks by tabbott to use the same approach we already use in the
"Move topic" modal to have the bottom margin for the color block match
that of the dropdown_list_widget itself, of having them share CSS.

Fixes #19739.
2022-02-09 14:06:49 -08:00