Commit Graph

11097 Commits

Author SHA1 Message Date
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