Commit Graph

11395 Commits

Author SHA1 Message Date
Anders Kaseorg 1547494e25 js: Convert static/js/compose_state.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg f499c4a858 js: Convert static/js/sent_messages.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 32288d245c js: Convert static/js/local_message.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 10a4d2bcbd js: Convert static/js/markdown.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg ea01e6da5e js: Convert static/js/compose_fade.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 527b6a36b3 js: Convert static/js/reload.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg e05293a257 js: Convert static/js/reload_state.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg b830f53eb5 js: Convert static/js/narrow_state.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg a1e9be884d js: Convert static/js/message_live_update.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 817358ce00 js: Convert static/js/message_list_view.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 68f7bfff56 js: Convert static/js/submessage.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 472f3bc478 js: Convert static/js/poll_widget.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg cfacf68fb8 js: Convert static/js/filter.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 16668904c1 js: Convert static/js/top_left_corner.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 1b151d0472 js: Convert static/js/recent_senders.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 850c3c65e7 js: Convert static/js/pm_list.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 666938f46c js: Convert static/js/pm_list_dom.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 20cfb9ef09 js: Convert static/js/topic_list.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 5a68bda15b js: Convert static/js/user_groups.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 592cd780f5 js: Convert static/js/rows.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg fe4d1e839c js: Convert static/js/message_viewport.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 6e045e4470 js: Convert static/js/muting_ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 94a5da325c js: Convert static/js/muting.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg ece27a19bc js: Convert static/js/unread_ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 09920af211 js: Convert static/js/channel.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 1dafb143e3 js: Convert static/js/compose_pm_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 000865ceb1 js: Convert static/js/user_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 977e7dfe07 js: Convert static/js/drafts.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 98c4ffa700 js: Convert static/js/scroll_util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 6477b7631c js: Convert static/js/rtl.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg f85924dd0a js: Convert static/js/keydown_util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg d5740d43f3 js: Convert static/js/vdom.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 3faae49dc0 js: Convert static/js/loading.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg a3e6ebb04c js: Convert static/js/common.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 8947ff10a4 compose: Add setter for wildcard_mention_large_stream_threshold.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 07863d1c8a message_viewport: Move height definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg b5dbe259a8 settings_org: Move *_widget definitions before uses.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 45178e7fed vdom: Move update_attrs definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg d0e099853c compose_state: Move message_content definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 1c7c1ad6a7 stream_color: Move get_color_class definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 64b0c3bac3 sent_messages: Move MessageState definition before use.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg bc55aa6a01 Revert "starred_messages: Add support to unstar all messages in a topic."
This reverts commit 6fba17599f (#16898).

@chrisbobbe reported this crash:

Uncaught TypeError: Cannot read property 'stream_id' of undefined
    at starred_messages.js:43
    at Array.filter (<anonymous>)
    at Object.e.get_topic_starred_msg_ids (starred_messages.js:40)
    at stream_popover.js:221
    at HTMLSpanElement.<anonymous> (stream_popover.js:358)
    at HTMLUListElement.dispatch (jquery.js:5429)
    at HTMLUListElement.v.handle (jquery.js:5233)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-26 16:41:04 -05:00
Suyash Vardhan Mathur d1c24d3f67 api docs: Fix blank line at end of Code Blocks.
Added the missing padding: 0 to remove the blank line in code blocks
as is done in Webapp code blocks CSS. Fixes part of #15967.
2021-02-26 08:14:54 -08:00
Riken Shah e5ad56fa71 keyboard shortcuts: Make keyboard shortcuts modal more responsive.
Some hotkey combinations were overflowing in the keyboard shortcuts
table in smaller width devices.

Fixes part of #16817.
2021-02-26 07:59:15 -08:00
Riken Shah 70bc5ba6f2 settings: Make account settings more responsive.
The textarea in Settings/User Profile was overflowing in
smaller width devices.

This commit fixes that issue by adding appropriate media queries.

Fixes part of #16817.
2021-02-26 07:59:01 -08:00
Anders Kaseorg fa191b9912 Revert "stream-ui: Change view from 2-column to 1-column at width 992px."
This reverts commit 34ada11448.

That commit traded a minor visual glitch for a major usability
regression at my most common browser width (960px).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-26 07:52:47 -08:00
Wesley Aptekar-Cassels 673af19a4d typeahead: Always rank exact string match first.
Previously, exact matches could be pushed off the typeahead list in the
case where there were more prefix matches that happened to rank first,
which is confusing to the user: if an emoji, for instance, falls into
this category, it will never show up in typeahead, which is easy to
confuse with the emoji not existing.

This isn't a perfect fix — there are still cases where it's hard to find
emojis because the prefix-space is very crowded, but it does fix a
category of surprising and frustrating behaviour.

This doesn't come completely without downside - it means that the exact
match emoji will jump to the front of the list, which changes what is
currently conceptually a "filtering" operation to a "filtering and
sorting" operation, but it seems on the whole to be a more ideal
experience. This is particularly notable in the non-typeahead emoji
picker, which uses the same codepath, but this change seems somewhat
desirable even there, since it allows the user to type the name of an
emoji and press enter and have that emoji show up, without having to
visually confirm that they aren't inadvertently selecting a
prefix-matching emoji.

A better solution to this in the long term might be ordering emoji
results by shortest-first as a tiebreaker for alphabetical ordering,
since that should provide the same behaviour while keeping the mental
model as "filtering" (since the sort order won't change as the user
types), but this seems like a reasonable first pass, and changing to
shortest-first ordering after making this change won't break any muscle
memory for existing users.
2021-02-25 17:55:54 -08:00
Aman Agrawal fafbccfcd4 recent_topics: Stop last_msg_time_header::after from overflowing.
We change the text. This is an attempt to make the text space occupied by
the col header of last message timestamp smaller so that
it doesn't overflow to next line in some languages.

Also, add some extra padding.
2021-02-25 17:33:01 -08:00
Aman Agrawal f9537053ea narrow_title: Correct title of RT and all messages narrow.
Recent topics, being the default view, is no longer beta.
2021-02-25 17:32:51 -08:00
Aman Agrawal ce3f1355e1 zulip_logo: Remove custom click handling.
We don't need to handle user clicking on Zulip logo since
changing the hash via the `a` tag takes care of it automatically.

Also, cleanup the narrow.restore_home_state function since
it is no longer being used.
2021-02-25 17:32:32 -08:00
Aman Agrawal 9b92e06a56 code_cleanup: Merge two divs into one. 2021-02-25 17:31:33 -08:00
Aman Agrawal f4f37fca14 hashchange: Extract func which checks current hash is in RT. 2021-02-25 17:31:33 -08:00
Aman Agrawal a210ee2b7d recent_topics: Don't revive focus when user is trying to type. 2021-02-25 17:31:33 -08:00
Aman Agrawal 3e36fe6a1e recent_topics: Don't show topics from unsubscribed streams. 2021-02-25 17:31:33 -08:00
Aman Agrawal 017fbe3fe4 recent_topics: Allow focus back to table from search using esc.
User can now use `escape` key to switch focus from search to
table without using arrow keys to do so.
2021-02-25 17:31:33 -08:00
Aman Agrawal e887428dec stream_events: Re-render RT after a stream is (un)muted.
We manually trigger a re-render of RT after a stream is muted
to update the list of topic in RT for the active filter.

This fixes the bug that RT doesn't update correctly
after a stream is muted.
2021-02-25 17:31:33 -08:00
Aman Agrawal d0a1d95c89 recent_topics: Fix search box not visible after wrapping in safari.
On safari, after search box wraps to next line on smaller widths,
it is not visible due to some flex box default property difference
between chrome and safari. We fix this by resetting default
property.
2021-02-25 17:31:33 -08:00
Aman Agrawal bbe1b742c6 recent_topics: Recalculate space for stream list when activating.
If user is in private message narrow, we reduce height of stream
list to allow height for pm list in the left sidebar. We need
to recalculate it when moving out of pm narrow and moving in
rt narrow.
2021-02-25 17:31:33 -08:00
Aman Agrawal 56aa6673fe recent_topics: Use padding instead of line-height for spacing.
We need to increase a bit of spacing around text in rows at <750px
because row height is reduced after hiding avatars. We use
padding instead of line height so that this plays nice when text
is wrapped.

Note more padding is also required for >750px now because text
can be wrapped now and take more width than avatars.
2021-02-25 17:31:33 -08:00
Aman Agrawal 2f84680b14 recent_topics_row: Display stream icon inline with wrapped text.
Stream # displays in its own line when text is wrapped without
this.
2021-02-25 17:31:33 -08:00
Aman Agrawal 126b5dc186 recent_topics: Let text in wrap to enforce fix width behaviour.
If we don't allow text to wrap, it overrides the fix width of
the columns.
2021-02-25 17:31:33 -08:00
Aman Agrawal 876616f17b recent_topics: Fix % of space taken by columns.
This stops recent topics from adjusting column widths as new
messages are fetched, resulting in a better user experience.
2021-02-25 17:31:32 -08:00
Aman Agrawal b84bce2bc7 all_messages: Change default icon from home to align-left.
Since All messages narrow is no longer home page for webapp,
we change its icon to align-left which also shows a concept of
interleaved topics / messages.
2021-02-25 17:31:32 -08:00
Aman Agrawal a29b328854 MessageListView: Don't reselect message_id if RT is open.
When idle, we try to backfill messages and in the end reselect
the closest message in the list, which can be a unread message
if present.

When recent topics is open, we can backfill messages; but
shouldn't select the message_id otherwise it will mark the
message as read if the message is unread while triggering
`message_selected.zulip`.
2021-02-25 17:31:32 -08:00
Aman Agrawal b5036cd3b3 narrow: Explicitly hide recent topics when changing narrow.
User can go from recent topics to stream / topic narrow via various
means, but all go through narrow.activate, hence we make sure all the
state changes we do in recent_topics.hide are actually applied when we
hide recent topics and go to another narrow.

This fixes the bug that narrowing from left sidebar to a stream
takes user to the top of the narrow.
2021-02-25 17:31:32 -08:00
Aman Agrawal 5d4217ffc9 recent_topics: Fix partially hidden row sometimes in recent topics.
The top row of the RT can be hidden sometimes after scrolling down
and then scrolling up. This is because the focus is applied before
the row is rendered. Applying the focus after the topic row is
rendered by the browser makes sure it is always visisble when
it needs to be.
2021-02-25 17:31:32 -08:00
Aman Agrawal 5fc51d0a4d recent_topics: Let browser handle the inputs we didn't.
For inputs to recent topics which were unhandled, we return false
so that the browser can handle them.

This also fixes the issue of search box not able input `t` key.
2021-02-25 17:31:32 -08:00
Aman Agrawal 760e4fc1e7 recent_topics: Focus on search box on `t` keypress. 2021-02-25 17:31:32 -08:00
Aman Agrawal 8d398ddd54 recent_topics: Focus on first table row after first render.
We land user on the first row of the table instead of the search
box because here user can access hotkeys like `w`, `q`, `/`, etc,
which will not be directly available if user is focused in
recent topics search box.

For tests:
We set focus to search by default to avoid mocking a lot of
table html for getting the tests passing.
2021-02-25 17:31:32 -08:00
Aman Agrawal d2c2371c84 recent_topics: Call revive_current_focus as part of redraw process.
This makes more sense as it ensures we revive focus after every
redraw.
2021-02-25 17:31:32 -08:00
Aman Agrawal a45d3af3e3 hotkeys: Don't pass input to RT when non-RT search is in focus.
This fixes the bug where a user cannot type vim keys in the
general search box / user search / stream search,
since they are captured by recent topics.

The behaviour was flaky for stream search, but can be reproduced
consistently after previous commit fixing the popovers.any_active
output.
2021-02-25 17:31:32 -08:00
YashRE42 2cd234f1b7 recent_topics: Add persistence for filters via localstorage.
Previously the filter would be reset every time the page was
refreshed. This commit adds persistence via localstorage, the tests
follow the pattern used in tests for drafts.

Fixes: #15676.
2021-02-25 17:31:32 -08:00
Aman Agrawal 7fc28eaa16 hashchange: Show recent topics if overlay hash in initial URl.
When user directly has hash for overlay in the URL when app loads,
we need to still show recent topics in the background. This
doesn't need to happen in other cases when user is accessing
the overlay after UI is loaded.
2021-02-25 17:31:32 -08:00
Aman Agrawal 39d123e355 recent_topics: Make it the default view.
Go to Recent Topics on "#", no hash and "#recent_topics".
Go to Recent Topics as the last destination for escape key.
Map `a` key to All messages and change its hash to
`#all_messages`.
2021-02-25 17:31:32 -08:00
Aman Agrawal dda36d1c93 recent_topics: Don't mark messages as read on scrolling.
throttled mousewheel handler marks messages as read in the
message_list regardless of if the message_list is visible or not.

We don't trigger it if recent_topics is visible.
2021-02-25 17:31:32 -08:00
Aman Agrawal 40d8a79ef4 recent_topics: Fill all vertical space available. 2021-02-25 17:31:32 -08:00
Aman Agrawal ad011272fe recent_topics: Remove top and bottom borders.
Don't show recent topics in a separate box.
2021-02-25 17:31:32 -08:00
Aman Agrawal 1eafb1d8b3 recent_topics: Move from overlay to a narrow-like view.
Recent Topics is no longer an overlay now, but note that it is
also not a typical messages narrow. It can reside between
an overlay and a Filter in the sense that it is dispalyed as
a typical Filter narrow but has properties of an Overlay.

Compose box is not visible in this view as it will be confusing
to many users and hence compose shortcuts have also been disabled.

Keyboard shortcuts that apply on messages have also been disabled.

The remaining shortcuts that apply to a narrow are still accessible
here.
2021-02-25 17:31:32 -08:00
Aman Agrawal 9ed3e47796 recent_topics: Show read topics in a darker shade. 2021-02-25 17:31:32 -08:00
Signior-X 15c4a72ac5 frontend: Fix shifted user invite copy icon
This issue adds the appropriate padding to the
copy_generate_invite_link class. This fixes the copy link icon which
seemed to be shifted when clicked.

Fixes #16868
2021-02-25 17:38:08 -05:00
Signior-X 2aec78e954 frontend: Fix right margin in stream description.
This commits gives a right margin to the stream description
so that it does not collide with the icon on its right and
also become better visually appealing.
2021-02-25 13:53:34 -05:00
Steve Howell 98fc28c8ed node tests: Add explicit test for clearing input pills. 2021-02-25 13:42:47 -05:00
aryanshridhar 17bae43052 frontend: Fixed broken label tag and removed label expression.
Fixes the following issues:

- Rectifies broken label tag having a misleading 'for' attribute.
- Removed 'name' attribute from unlabelled span tag.
- Removed label expression from DropdownListWidget to built an,
  abstraction for control group only.

Fixes #17311.
2021-02-24 13:50:29 -08:00
aryanshridhar ea02d48e81 edit_bot: Fixed dropdown username capitalization.
Restructured edit_bot to unwrap label tag from the
control group, hence defaulting to original text size.
2021-02-24 13:50:29 -08:00
Tim Abbott 28ac9f941d css: Fix night theme keyboard UI with popovers.
When interacting with popovers in the night theme using the keyboard
UI (e.g. the `i` menu for a message), the background color was
incorrectly white, resulting from the bootstrap `nav > li > a:focus`
rule.  We had already fixed this for `nav > li > a:hover`; we just
need to add `nav > li > a:focus` to the relevant block of CSS rules as
well.

Replaces #17195 and #17353.

Rewritten to use a cleaner solution by tabbott.
2021-02-24 12:21:54 -08:00
Steve Howell 0ab3649182 reactions: Simplify code to choose popover target.
We now only assign target once, rather than
assigning it then overwriting it for the
not-sent-by-me use case.

I tried to extract a "selector" here but the linter
complained.

Splitting up the tests here ensures we don't
needlessly do extra work here.  (In the prior
clumsy implementation, the second test that
I split out here would fail due to the lack
of us setting up the jquery stub.)
2021-02-24 11:56:40 -05:00
Wesley Aptekar-Cassels d644562b40
composebox_typeahead: Increase max typeahead box size.
On realms with large numbers of custom emoji, the typeahead emoji picker
often isn't useful. This is exacerbated by the fact the picker prefers
longer matches, so if there are five emoji that share a prefix, and an
emoji that is just the prefix, the only-prefix emoji will never show in
the typeahead emoji picker. This means that if someone thinks that there
is an emoji that shares a prefix with many other emoji, but they don't
remember for sure, they cannot use the typeahead emoji picker to check
that the emoji that they are entering exists.

There are two "real" fixes to this, neither of which this commit
addresses:

First, we should adjust the emoji ranking code such that exact string
matches for existing emojis are always shown in the picker. This would
be an improvement overall (the current behaviour is surprising and
frustrating), but it doesn't fundamentally solve the problem - if there
are many matching emoji, some of them will be pushed off the list.

Second, we should allow scrolling through the entire list of matching
entries in a typeahead, instead of only looping through the top N
matches. This will completely fix the problem (although there is some
UI/UX consideration in how to make it clear that the box is scrollable),
but seems like significantly more work to implement.

However, increasing the typeahead box size should improve the user
experience here independently of either of those changes.

I've chosen 8 as the max size for no particularly principled reason -
the fact that it's larger than 5 makes it more useful, but it's not so
large that it covers an obnoxious amount of the screen. Possibly it
would make sense to make it a bit bigger, but 8 seems like a good place
to start.

I've tested this on my laptop, which has a Intel i5-7200U CPU (~4.5 years
old, middle of the line when it was released) on a test instance with
5000 users, as well as on chat.zulip.org, and didn't see any noticeable
performance regression in completing @-mentions or emoji on either.
2021-02-24 08:29:54 -08:00
Anders Kaseorg 6ff28577cc js: Convert static/js/message_list_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg f9c4b5438e js: Convert static/js/localstorage.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg 901a1e16cf js: Convert static/js/list_cursor.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg 8add2ffc4e js: Convert static/js/fetch_status.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg 5a22e73cc6 ui: Remove warning for unsupported old Zulip desktop app.
This warning was added in #6551.  It’s not for any version of the
current Electron app, which we warn about on the server side with
DESKTOP_WARNING_VERSION, but rather some pre-Electron app so ancient I
don’t even know what it is.  Apparently it communicated using the
window.bridge global, so eradicate that too.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 18:14:12 -08:00
Wesley Aptekar-Cassels 1073adfb08 reactions: Fix double-escaping usernames in tooltip.
Appling i18 to reaction tooltips (#16585) caused usernames to be
double-escaped, for instance, if there is a single-quote in a username.
This disables escaping of usernames by i18next, since they're escaped
again later by the rendering code.

Fixes: #16785
2021-02-23 17:48:57 -08:00
Megamind d001916b78
right sidebar: Increase hover opacity of "filter users".
Usually we increase the opacity of an interactable icon on hover, but the search-icon at the top of the 
right sidebar was missing the behavior.

Co-authored-by: ritik <ritikcn05@gmail.com>
2021-02-23 15:30:45 -08:00
Ganesh Pawar 4118279c1a stream-ui: Fix oddly spaced elements in streams tab.
This reverts most of the changes made in commit a5f0379.
2021-02-23 15:17:33 -08:00
Ganesh Pawar 34ada11448 stream-ui: Change view from 2-column to 1-column at width 992px.
This prevents the elements to go on a newline on iPad sized devices.
2021-02-23 15:17:33 -08:00
Anders Kaseorg ba0ee6ddfa dependencies: Upgrade Source Sans Pro font to Source Sans 3.
https://blog.adobe.com/en/2020/11/30/whats-new-in-source-sans-3.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 14:55:33 -08:00
Wesley Aptekar-Cassels be9ae9dac8 js: Don't escape "Last active" in buddy list.
This breaks the French translation, and is incorrect in general.
2021-02-22 16:08:25 -08:00
Anders Kaseorg 279c4b0e24 puppeteer_tests: Port to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Steve Howell ff3175f8a2 lightbox: Export method for testing purposes.
We weren't exercising this method in any
meaningful way during the tests, and when
do add coverage, we probably want to just
test it directly.

We also kill off stub_selector(), which was
never well-documented.
2021-02-22 12:38:07 -05:00
Steve Howell fed1eaf7d7 minor: Inline filter_table in subs.js.
The old structure of having a two-line wrapper was
mostly driven by testing concerns.  Now I just
have a single function with the optional argument.
2021-02-18 13:38:16 -08:00
Steve Howell c3ee1286f4 stream settings: Simplify live-updates for left panel.
Now we just update the whole row any time a sub
changes.  This prevents a whole class of bugs.

As the TODOs indicate here, some of the post-processing
that we have to do on rows after rendering the
template will soon go away.
2021-02-18 13:38:16 -08:00
Steve Howell 7f6287c058 minor: Add comments for stream setting live-updates.
I audited all the functions in stream_ui_updates and
added TODO comments to functions that are clearly just
updating rows in the left panel of Manage Streams.

In an upcoming commit I will simplify the approach so
that we just re-render the entire row.
2021-02-18 13:38:16 -08:00
Steve Howell bbd045de02 refactor: Inline rerender_subscriptions_settings.
The extra level of indirection here was annoying,
and this helps an upcoming simplification to
live updates.
2021-02-18 13:38:16 -08:00
Steve Howell 374d2ff3e2 stream settings: Fix tooltips for stream counts.
The tooltips for the left panel of stream settings
have been broken since November 2018 due to my
commit 8f915da2ca.

The code prior to 2018 was restoring tooltips
right inside the loop where we were detaching
the row from the DOM to put it back into the
DOM at another place.  And then I tried to
just add them in bulk, forgetting that I was
in the middle of all the DOM manipulation (and
hence my selector for the loop was a noop).

Also, I don't think we've ever had them for live
events that add streams.  (I fixed that too.)

It's not clear to me that this code is actually
necessary, as we get hover help without
calling $(...).tooltip(...) properly.

This is probably why we didn't notice any
breakage when we merged my 2018 commit.
2021-02-18 13:38:16 -08:00
Steve Howell a87596a3f9 subs cleanup: Simplify is_sub_already_present().
Checking for the button was a brittle way to do this.

Note that the code on master is flawed insofar as
we don't respect the search filters.  I don't fix that
bug here.  This is a tactical change to eliminate
another function.

Upcoming changes will make it so that all the bugs
related to "notdisplayed" will simply go away.
2021-02-18 13:38:16 -08:00
Wesley Aptekar-Cassels 4173070b3d notifications: Fix composebox notification escaping
The "Narrow to PM with" notification above the composebox was
double-escaped, mangling names with single quotes in them. This removes
the escaping in i18next, causing the name to be escaped only in
handlebars.
2021-02-17 14:04:30 -08:00
Aman Agrawal 827aaa227e stream_edit: Extract generic pill functions to be reused in future. 2021-02-16 16:58:29 -08:00
Steve Howell 34b429dfd5 node tests: Simplify subs tests for filtering.
This is prep for future simplifications to the
real code.
2021-02-16 13:11:10 -08:00
Steve Howell 62e272ce27 stream settings: Remove obsolete scrolling code.
We just want to reset the scrollbar here, which
we still do via ui.reset_scrollbar.

You don't want to preserve scroll position if
you are filtering or re-sorting.
2021-02-16 13:11:10 -08:00
Steve Howell 0060644712 stream settings: Rename vars to left_panel_params.
This replaces either "query" or "search_params".
2021-02-16 13:11:10 -08:00
Steve Howell 9862156158 stream settings: Clean up functions to redraw left panel.
We have long had this annoying two-pass way of building the
DOM that I am trying to eliminate.

The function names that I introduce here describe the current
situation more accurately.

In passing I make it so that we only throttle redraws when
users are actually typing.  Using a throttled redraw when
you click on the sort icons is at best unnecessary, and it
may actually aggravate double clicks.
2021-02-16 13:11:10 -08:00
Steve Howell 20a8077cbd minor: Make sort_toggler a const.
Unlike the other toggler in this module, there
is no reason that sort_toggler has to be a module
level variable.
2021-02-16 13:11:10 -08:00
m-e-l-u-h-a-n 03e4ccbc2d message-view: Increase spacing for lists coming after paragraphs.
Lists that were followed by a paragraph (i.e. our p+ul, p+ol CSS rule)
in messages had negative top margin of -3px.  Adjusting the margin
here is important, because the default styling would result in an
excessive gap that made bulleted lists weirdly far from the previous
paragraph.  See #12113 for background.

However, the -3px negative margin was so large that it reduced spaces
between paragraph and lists, such that there was too little visible
separation between the two.  We fix this by going with a 0px
margin-top instead.

This has been tested for various structures of messages:
1. text + bulleted list
2. bulleted list + unbulleted list(or two lists)
3. only list.

And it looks good in all cases.

Fixes #17284.
2021-02-16 08:56:26 -08:00
Suyash Vardhan Mathur 05928bbdee api docs: Change font size for code and response blocks.
The code blocks and response blocks had small and unreadable font,
because they were using the bootstrap defaults without adjustment for
the size of content on the rest of the page.  Fixes part of
zulip#15967.
2021-02-16 08:22:35 -08:00
Sumanth V Rao caa7548c4a click_handler: Fix bug in intro_reply hotspot.
This bug was caught thanks to the earlier commit which
introduces the "Restart tutorial" feature. To reproduce
the bug,

    1. Restart tutorial
    2. Click "Got it!" on the intro_reply hotspot
    3. Repeat steps 1 and 2

The hotspot for intro_reply won't disappear the second
time around and the intro_stream hotspot would be displayed
simultaneously.

The reason for this was the intro_reply's "Got it!"
button codepath never removing the item completely from
the DOM. This would then conflict with the new intro_reply
hotspot which would get assigned a different 'id'.
2021-02-15 18:35:00 -08:00
Sumanth V Rao 540cca595c hotspots: Fix typos in function name and code comment. 2021-02-15 18:33:21 -08:00
Abhishek-Balaji 6fba17599f starred_messages: Add support to unstar all messages in a topic.
Adds a "unstar messages in topic foo" option to the topic sidebar
popover, if there are any starred messages in that topic, known
to the frontend.

Altered existing "unstar all messages" confirmation modal to mention
the topic name, in the case that it was opened by the topic sidebar
codepath.

This is just a v1, and will not unstar old messages from that
topic, if they have not been fetched by the frontend.

Fixes #12194

Co-authored-by: Abhijeet Bodas <abhijeetbodas2001@gmail.com>
2021-02-15 07:38:37 -05:00
Anders Kaseorg 57f2b8760a shared: Format our one Flow file with Prettier.
Why not.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-14 07:03:32 -05:00
Nishant Mittal f659744720 ui: Fix detection of narrow window.
Fixes #17280.
2021-02-13 07:14:24 -08:00
Anders Kaseorg e9220c7d50 js: Convert static/js/huddle_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00
Steve Howell d67cc2d080 slugs: Fix regex for legacy stream slugs.
This prevents a bug where we interpret "2something"
as a modern slug instead of a legacy stream name.

The bug was probably somewhat unlikely to happen in
practice, since it only manifests if 2 is an actual
stream_id.
2021-02-10 14:37:34 -08:00
Anders Kaseorg 34b98a1cf6 js: Convert static/js/util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 3a110e6419 js: Convert static/js/stats/stats.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 7a0c2e0d6f js: Convert static/js/settings_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg fc2900c004 js: Convert static/js/settings_config.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 5bee572332 js: Convert static/js/portico/signup.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 89cd97ac05 js: Convert static/js/portico/integrations_dev_panel.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 309f6e59a1 js: Convert static/js/portico/email_log.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg da277afa3b js: Convert static/js/portico/dev-login.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 6ab1c1c8a6 js: Convert static/js/portico/desktop-redirect.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1bfc22e4a1 js: Convert static/js/portico/desktop-login.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 4c28abc8f3 js: Convert static/js/portico/confirm-preregistrationuser.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg ea5b1059af js: Convert static/js/markdown_config.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg e6fce07b0e js: Convert static/js/billing/upgrade.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg ce9d1d2b4d js: Convert static/js/billing/billing.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg db7d0f0a30 js: Convert static/js/archive.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 04b549e42a js: Convert static/js/analytics/support.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg ba6b8f5078 js: Convert static/js/analytics/activity.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1adc0da0bd js: Convert static/js/portico/header.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 96fc397716 js: Convert static/js/ready.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1ec9304eee js: Convert static/js/spoilers.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 4360a13dd6 js: Convert static/js/stream_ui_updates.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 8a6fdb662a js: Convert static/js/search_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg e16687af83 js: Convert static/js/settings_ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 2ee29972ac js: Convert static/js/typing_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 63ce32b36e js: Convert static/js/typing.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 86dfb35ff3 js: Convert static/js/settings_muting.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg c366386679 js: Convert static/js/templates.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 881d6c437b js: Convert static/js/tutorial.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg f3fb01a430 js: Convert static/js/colorspace.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 4c37748712 js: Convert static/js/user_status_ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 583febeffd js: Convert static/js/user_status.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 229aacb819 js: Convert static/js/user_search.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 6775715b9f js: Convert static/js/server_events_dispatch.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 5655e326c9 js: Convert static/js/alert_words.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg f3af16db3f js: Convert static/js/invite.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg a935af9243 js: Convert static/js/pill_typeahead.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 118edf8982 js: Convert static/js/copy_and_paste.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg fc57f087b7 js: Convert static/js/message_edit_history.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 03f61c1eb2 js: Convert static/js/stream_create.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 9dd03998f8 js: Convert static/js/zcommand.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1a45d53f3a js: Convert static/js/echo.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg f66441adb2 js: Convert static/js/zform.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 4513ef8861 js: Convert static/js/todo_widget.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg a1dc8e37a2 js: Convert static/js/topic_zoom.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 07e6de1cd9 js: Convert static/js/topic_generator.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 2771434aad js: Convert static/js/stream_sort.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 87f2fe2cce js: Convert static/js/topic_list_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg e3022f353e js: Convert static/js/setup.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 3b49cf6f24 js: Convert static/js/stream_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg a17ce6aeee js: Convert static/js/feedback_widget.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg a175826a5a js: Convert static/js/components.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 6a6a91b977 js: Convert static/js/rendered_markdown.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 1d64e7a8eb js: Convert static/js/lightbox_canvas.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 8bbb0d9193 js: Convert static/js/search_util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg a6bf97057b js: Convert static/js/schema.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 37f362f75a js: Convert static/js/feature_flags.js to ES6 module with modzulator.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 434c934855 bundles: Remove imports with no top-level effect.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg 5182505302 dropdown_list_widget: Add missing export.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 07:35:11 -08:00
Anders Kaseorg 4d6a017320 people: Modernize CommonJS reference in comment.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 09:45:10 -05:00
Abhijeet Prasad Bodas 9cb41c2976 refactor: Extract `excludes_muted_topics` logic.
This commit makes it so that MessageListData
methods always attempt to filter muted messages.
We later, in a new function
(`messages_filtered_for_topic_mutes`)
check if `excludes_muted_topics` is true or not,
and skip the filtering work if it isn't.
This new function consistently returns a new list.

This refactor will later allow us to write clean
and concise code as part of mute users.

This commit also refactors the muting tests
for MessageListData, which were earlier
spread across two `run_test` functions.
These tests should remain organized,
since similar tests will be added as part of
user mutes in future commits.
2021-02-10 07:53:05 -05:00
Abhijeet Prasad Bodas 9ae44c769c refactor: Rename MessageList.muting_enabled.
Previously, the `muting_enabled` property of
MessageListData class was used to indicate whether
some messages in the message list need to be
filtered due to topic muting, depending on the
narrow. For example, we exclude messages belonging
to muted topics from stream narrows, but not from
search narrows.

The name `muting_enabled` is a bit confusing, and hence is
changed to `excludes_muted_topics`.
It is also important that the name be specific, since
a similar new property will be added for user mutes
in future commits.
2021-02-10 07:53:05 -05:00
Suyash Vardhan Mathur c9c40d4fd2 api docs: Cleaned up CSS for parameter classes.
Deduplicated CSS classes of data types of response and
request parameters in API Documentation to use a single
class.
2021-02-09 10:31:36 -08:00
Chris Taylor e341a81987 Tooltip: edited tooltip string to add consistency in static/js/ui.js. 2021-02-09 10:44:21 -05:00
Anders Kaseorg 9896782fd1 dependencies: Remove XDate.
It’s even more unmaintained than Moment and doesn’t add any
functionality we don’t already have.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-07 06:41:33 -05:00
Anders Kaseorg 952a8aa5fd drafts: Fix racy computation that gets current time twice.
The result could have been off by a month if the two calls to new
Date() straddled a month boundary.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-07 06:35:54 -05:00
Anders Kaseorg 42a9e473ae components: Allow passing labels as HTML (but explicitly).
Fixes the sorting button labels in stream settings, which were
regressed by commit f8fbae4d8e (because
the HTML was not marked as being HTML).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 20:12:57 -08:00
Aman Agrawal 6972b31721 subscription_members: Make the help text more clear. 2021-02-06 08:51:36 +05:30
Aman Agrawal 93889d9690 notificaiton_sounds: Add some atonal sounds created by @stwime.
Removed underscore from names.
2021-02-05 12:28:20 -08:00
Aman Agrawal 8baade439d notification_sounds: Add sounds created by @stwime.
These are all good notification sounds that may fit taste of
different users.
2021-02-05 12:28:20 -08:00
Abhijeet Prasad Bodas fd2bf0b31b refactor: Rename frontend muting stuff to include 'topic'.
This is a prep commit, which renames some variables
and functions involved in topic muting to include
the word "topic" in them.

This is done to have clarity when similar code
will be added as a part of the mute-user in
future commits.
2021-02-05 11:17:46 -08:00
Abhijeet Prasad Bodas 5eec4b23ac minor: Explicitly handle undefined date while muting a topic.
If we don't pass `date_muted`, we shouldn't calculate
date_muted * 1000. This code used to work because of
how javascript treats `undefined`.

This commit deals with the `date_muted=undefined` case
in a cleaner manner.
2021-02-05 11:17:46 -08:00
Abhijeet Prasad Bodas dbb69f76fa settings: Fix message not shown in empty muted topics list.
This commit fixes a small bug in the
settings/muted-topics pane.
When there are zero muted topics, the
"You have not muted any topics yet." message
was not shown.

This is fixed by adding the `required-text`
class to the table body.
The bug was introduced in 3bc818b9f7.
2021-02-05 11:17:46 -08:00
aryanshridhar f92f99d92d dependencies: Replace moment.js with date-fns.
Replaced methods/functions of moment.js with date-fns library.
The motive was to replace it with a smaller frontend timezone library.

Date-fns ~ 11.51 kb
moment.js ~ 217.87 kb

Some of the format strings change because date-fns encodes them
differently from how moment did.

Fixes #16373.
2021-02-05 11:04:32 -08:00
Suyash Vardhan Mathur 26a81ab3aa api docs: Display data type of responses in API Documentation.
Previously, the data type of responses wasn't displayed in the API
Documentation, even though that OpenAPI data is carefully validated
against the implementation. Here we add a recursive function to
render the data types visibly in API Documentation.
Fixes part of #15967.
2021-02-05 10:41:42 -08:00
Anders Kaseorg f8d11c6479 compose: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 154fc03fa5 composebox_typeahed: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg dc0972b775 loading: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 56d0d30387 hotspots: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg f8fbae4d8e components: Generate properly escaped HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:26:47 -08:00
Anders Kaseorg 64b78ad992 styles: Use range context queries to eliminate *_max variables.
On a high-DPI display or with a non-default zoom level, the browser
viewport may have a width strictly between md_max = 767px and md_min =
768px.  Use only the *_min bounds for consistency.

This requires queries with strict inequalities to express upper
bounds (width < md_min).  Fortunately, that functionality is provided
by range context queries.  Unfortunately, those are not supported in
all browsers.  Fortunately, we can compile them away using
postcss-media-minmax.  Unfortunately, postcss-media-minmax currently
subtracts 1px for strict inequalities anyway to work around a Safari
rounding bug.  Fortunately, 0.02px should be sufficient for that, so I
submitted a PR:

https://github.com/postcss/postcss-media-minmax/pull/28

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:23:59 -08:00
Anders Kaseorg d679aa015d scroll_bar: Flip max-width queries for min-width.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-05 09:23:59 -08:00
Anders Kaseorg aa650a4c88 js: Escape strings interpolated into CSS selectors with CSS.escape.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 11:00:06 -08:00
Anders Kaseorg 08fe6e4a8f blueslip: Pass through the return value in measure_time.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 09:11:04 -05:00
Steve Howell 17ea215f18 minor: Remove peer_data.clear(). 2021-02-03 15:23:17 -08:00
Steve Howell 58855e8224 refactor: Remove maybe_clear_subscribers().
The maybe_clear_subscribers() function was an artifact of
when we used to attach subscribers to the "sub" records in
stream_data.js.  I think it was basically a refactoring
shim, and due to some other recent cleanup, it was only
used in test code.

We also change how we validate stream ids.

Going forward, peer_data just looks up stream_ids with the
normal stream_data API when it's trying to warn about
rogue stream_ids coming in.  As I alluded to in an earlier
commit, some of the warning code here might be overly
defensive, but at least it's pretty self-contained.
2021-02-03 15:23:17 -08:00
Steve Howell e44e48ef20 minor: Add get_user_set call that I missed earlier.
In my recent commit to introduce get_user_set() I
inadvertently skipped one place to call it.

I also remove a return statement that was made
unnecessary by the new get_user_set() helper.
2021-02-03 15:23:17 -08:00
Steve Howell 016038dcd1 blueslip: Add measure_time wrapper.
Now when we want to measure how long a block
of code takes to execute, we just wrap it with
`blueslip.measure_time`, instead of the awkward
idiom from my original commit of getting a callback
function.

My rationale for the original scheme was that I
wanted to minimize diffs and avoid changing
`const` to `let` in a few cases, but I believe
now that the function wrapper is nicer.

In a few cases I just removed the blueslip timing
code, since I was able to confirm on czo that
the times were pretty minimal.
2021-02-03 15:23:17 -08:00
Ganesh Pawar f70629ea6c composebox: Add typeahead for /todo. 2021-01-30 09:01:13 -08:00
Ganesh Pawar 632abd45eb ui_report: Migrate ui_report.message to ui_report.client_error. 2021-01-30 07:48:44 -08:00
Ganesh Pawar 5802bbfb98 ui_report: Add ui_report.client_error. 2021-01-30 07:48:44 -08:00
Steve Howell e243af531b refactor: Extract get_user_set in peer_data.
We now use the same code in all places to
get the bucket of user_ids that correspond
to a stream, and we consistently treat
a stream as having zero subscribers, not
an undefined number of subscribers, in
the hypothetical case of us asking about
a stream that we're not tracking.

The behavior for untracked streams has
always been problematic, since if a
stream is untracked, all bets are off.

So now if we don't "track" the stream,
the subscriber count is zero.  None of
our callers distinguish between undefined
and zero.

And we just consider the stream to be subscribed
by a user when add_subscriber is called,
even if we haven't been told by stream_data
to track the stream.  (We also stop
returning true/false from add_subscriber,
since only test code was looking at it.)

We protect against the most likely source
of internal-to-the-frontend bugs by adding
the assert_number() call.

We generally have to assume that the server
is sending us sensible data at page load
time, or all bets are off.

And we have good protections in place
for unknown ids in our dispatch code
for peer_add/peer_remove events.
2021-01-29 15:21:07 -08:00
Steve Howell 52281462e2 zephyr: Close exemption for stream-link warnings.
For the rare case where you're doing a link to a private
stream from a larger private stream that is a superset of
the former, we have bypassed warnings that you are linking
to a private stream.

I'm not sure we need this exemption for any situation
(just let the user bypass the warning), but we definitely
don't want false positives for the exemption.

For now I am closing down this loophole specifically for
Zephyr users.

Zephyr users are special in that we might not get
subscriber info on certain streams.

The current behavior for this edge case is a little
unclear.  The current implementation of
peer_data.is_subscriber_subset returns false if both
streams are untracked, but most streams are tracked if we
have a sub for them and just get treated as having an
empty set of subscribers.  And an empty set is a subset of
itself.  Upcoming changes to our server data are gonna
make this edge case even more annoying to maintain.
2021-01-29 15:21:07 -08:00
Steve Howell 5a27ed6a72 refactor: Change where we initialize scrolling code.
This is a more sensible place to initialize the
the scrolling handler, plus it breaks an annoying
indirect dependency on jQuery for the unit tests.
2021-01-29 15:21:07 -08:00
Steve Howell 6c4b1183f2 node tests: Move peer_data tests to new peer_data.js. 2021-01-29 15:21:07 -08:00
Steve Howell 2edfdb4ff8 refactor: Extract bulk functions to add/remove peers.
We also streamline some of the error handling code
by doing everything up front.  This will prevent
scenarios where a single bad stream_id/user_id causes a
bunch of the same warnings in an inner loop.
2021-01-29 15:21:07 -08:00
Steve Howell 805a2b6670 refactor: Remove stream_data.update_subscribers_count.
This removes a bit of complexity.  If a piece of
settings code needs to render a stream with
subscribers, it just asks for it.

We no longer have the brittle, action-at-a-distance
mechanism of mutating the subscriber count on to
the stream_data version of a sub.

Stream subs are pretty small, so making copies of
them is cheap, and the blueslip timings from the
previous commit can help confirm that.

There is some discussion of putting `subscriber_count`
on the Stream model, which may eventually get us
away from tracking it in `peer_data.js`, but we will
cross that bridge when we get there.  See
https://github.com/zulip/zulip/issues/17101 for
more details.
2021-01-29 15:21:07 -08:00
Steve Howell 5bd68b5180 minor: Get blueslip times for stream settings. 2021-01-29 15:21:07 -08:00
Steve Howell dc9b4de05f refactor: Call peer_data.get_subscriber_count().
We are trying to move away from having the
subscriber count on the sub.

This commit handles the easy one-liners
in the JS code.
2021-01-29 15:21:07 -08:00
Steve Howell 5babe54310 typeahead: Use stream_weekly_traffic for tiebreaker.
The weekly stream traffic is a better tiebreaker
for stream typeaheads than subscriber count, as
it's more directly a measure of a stream's current
relevance.

Normally stream traffic and subscriber counts are
closely correlated, but a good example for me is
the #twitter feed on czo, which only has 80 subscribers,
but which gets more traffic than our #integrations
stream (with 16k subscribers).  I would rather
see #twitter win the tiebreaker (if it even got
to the tiebreaker).

The main motivation behind this fix, though, is
to break our dependency on peer_data, which has
some upcoming changes that will introduce some
performance tradeoffs, and I want one less place
to audit.

Also, it will be easier long term to share this
code with mobile if we don't require mobile
to pull in our peer_data dependency.  (The webapp
has different forces than mobile that dicate
our data structures.)
2021-01-29 15:21:07 -08:00
Nikhil Maske aadd42f9e8 design: Adjust the visibility of the spinner icon.
The spinner icon is not visible until the user clicks on topic_edit_save,
so the space alloted to spinner-icon looks empty for rest of the time.
To improve the design, the spinner icon is only shown when the user
clicks on topic_edit_save.
2021-01-29 14:55:06 -08:00
Rohitt Vashishtha 75a0fa5b91 Rename list_render -> ListWidget.
Similar to DropdownListWidget, list_render is actually a widget. The
changed case more accurately represents how its supposed to be used
as a Class.
2021-01-29 09:36:35 -08:00
Anders Kaseorg 1a148f5d9a scroll_bar: Fix incorrectly converted breakpoint.
Commit e941ee4a15 (#16680) incorrectly
converted this from 775px to xl-max = 1199px instead of md-max =
767px, causing misplacement of the FRB for browser widths between
these values.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-27 10:32:45 -08:00
Aman Agrawal 8729965548 last_seen_status_from_date: Fix incorrect last seen value.
We use day_old calculated based on day instead of hours to
render last seen values. This fixes us incorrectly quoting
anything 24 - 48 hours ago as Yesterday and
incorrectly quoting `time` that are Yesterday
but < 24 hours ago in 'x hours ago' format.
2021-01-27 09:58:22 -08:00
Aman Agrawal de4aeacbb1 left-sidebar: Only add expanded class to it if it is a popover.
We were adding `expanded` class to left-sidebar when searching
for streams even if the left-sidebar was not in the popover state.
This cased confusion with popovers.any_active returning true,
when actually it is not.
2021-01-27 09:58:22 -08:00
Aman Agrawal 459e1fc218 sent_messages: Pass correct reference of this in setTimeout.
We explicitly bind `this` to MessageState class which otherwise
was defaulting to `window`.

This resulted in variables like `this.received` and `this.local_id`
being incorrectly interpreted by called function
as `window.(received | local_id)` which are `undefined`.
Hence, frontend thinks that the message was never received.

It was noticed since this was the common log message when
a double message send bug was observed. This change in no
was indicates fixing of the double send bug, but is hopefully
one step forward in that direction.
2021-01-27 09:52:42 -08:00
Anders Kaseorg 8d44cd78ec eslint: Fix unicorn/no-this-assignment.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg a679ee12f3 eslint: Fix unicorn/prefer-regexp-test.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg a77120279d eslint: Fix unicorn/prefer-default-parameters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 1e7347349c eslint: Fix unicorn/no-array-push-push.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 2e501c8667 eslint: Fix unicorn/consistent-destructuring.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 6cd694b8e3 eslint: Fix unicorn/no-array-callback-reference.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 552f4e3d22 eslint: Fix unicorn/no-array-for-each.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg aa7df21265 js: Convert _.chain to array methods.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 1fd4762063 topic_generator: Remove overengineering.
topic_generator previously included an entire lazy generator
combinator library that was used four times.  These straightforward
equivalent loops might not be as fun but they are way simpler.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Aman Agrawal 1b34f689a6 settings: Use sm_max for adjusting settings for small width devices. 2021-01-25 14:49:32 -08:00
Aman Agrawal 65db0aeb98 settings: Use 425px as breakpoint for seperating api key buttons. 2021-01-25 14:49:32 -08:00
Aman Agrawal e4389b7562 settings: Remove dead code.
This code has no effect on the checkbox in settings overlay.
2021-01-25 14:49:32 -08:00
Aman Agrawal b38dc0a48b user_status: Expand to full width on mobile like width devices.
Use 424px as a breakpoint vs 384px.
2021-01-25 14:49:32 -08:00
Aman Agrawal 705fd50e9e feedback_container: Expand to almost full width below 767px.
Remove css clutter.
2021-01-25 14:49:32 -08:00
Aman Agrawal 1374d556da css: Use a min width for main app containers below mm (375px) widths. 2021-01-25 14:49:32 -08:00
Aman Agrawal f8aea9aecb postcss_vars: Use underscore to follow better naming convention. 2021-01-25 14:49:32 -08:00
Aman Agrawal c287377512 css: Replace 575px with it's variable sm-max. 2021-01-25 14:49:32 -08:00
Aman Agrawal d9b60e63cf media_breakpoints: Use ms-min var for 320px. 2021-01-25 14:49:32 -08:00
Aman Agrawal 6fc71194c8 lightbox: Show compact view at 767px instead of 736px.
No regression is possible since are just doing adjustments to
make this view compact at a higher width.
2021-01-25 14:49:32 -08:00
Aman Agrawal e2130b944d compose: Adjust compose box for mobile at 374px vs 370px.
Since the change in breakpoint is minor no regression is seen.
2021-01-25 14:49:32 -08:00
Aman Agrawal adb860f75b css_variables: Add specific breakpoints for mobile devices. 2021-01-25 14:49:32 -08:00
Aman Agrawal 1e56db447c settings: Show bots info at full width at less than 991px.
Since the bots list breaks at 625px with left col of settings
hidden and at  850px with left col of settings visible
without this media query,
having this media query trigger at 991px shouldn't produce
any problems.
2021-01-25 14:49:32 -08:00
Aman Agrawal 89b5245d3c css: Replace 767px with it's variable md-max. 2021-01-25 14:49:32 -08:00