Commit Graph

53273 Commits

Author SHA1 Message Date
Daniil Fadeev b7c2570933 giphy: Refactor the giphy popover to use toggle_popover_menu.
This change is needed so we can use the `use_as_overlay` option on
mobile screens.
2023-09-13 12:20:35 -07:00
Daniil Fadeev 5b0e74c940 user_card_popover: Rename `show_*` functions to `toggle_*`.
This naming more accurately reflects the functionality of these types
of functions. They are not only responsible for displaying the
popovers but also for toggling them off.
2023-09-13 11:49:12 -07:00
Daniil Fadeev e5da3d9900 user_card_popover: Extract user card popover data into a new function.
The purpose of this change is to simplify the
`render_user_card_popover` function, so it has the single
responsibility of just rendering.
2023-09-13 11:49:12 -07:00
Daniil Fadeev c5f6c00a81 popovers: Extract user info popovers into their own module.
The intent behind this commit is to tidy up how we handle user info
popovers. The first step is to move everything related to them into
its own module. This commit should not have any functional changes.
2023-09-13 11:49:08 -07:00
Daniil Fadeev 64f77b1dee popovers: Stop exporting `toggle_playground_link_popover` function.
This function is only used in the `popovers.js` module, so there's no
need to export it.
2023-09-13 11:48:31 -07:00
Daniil Fadeev 7bcb868f9a popovers: Use a special function to check if the popover is open. 2023-09-13 11:48:31 -07:00
Daniil Fadeev 257c327f39 user_profile: Move event registration to the correct place.
The event callback that was moved is part of `user_info_popover` and
should be registered along with the other actions of this popover.
2023-09-13 11:48:31 -07:00
Daniil Fadeev 523b5a0877 popovers: Remove unused functions from `popovers.js` module. 2023-09-13 11:48:31 -07:00
Daniil Fadeev 0a11a4b983 notifications: Extract notification title retrieval.
This commit aims to extract all logic related to obtaining
notification title from the `process_notification` function into
a separate `get_notification_title` function.
2023-09-13 11:18:35 -07:00
Daniil Fadeev fe5d680f27 notifications: Refactor `process_notification` function.
Turned multiple if statements into a switch/case and rearranged
variable declarations.
2023-09-13 10:55:59 -07:00
Daniil Fadeev 8b8f95b6f5 notifications: Extract sender name removal from recipients list. 2023-09-13 10:55:59 -07:00
Daniil Fadeev 53ef273665 notifications: Extract notification key retrieval.
This commit aims to extract all logic related to obtaining
notification key from the `process_notification` function into a
separate `get_notification_key` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev fdac13ba24 notifications: Extract `notification_source` debugging logic.
This commit aims to extract all logic related to debugging the value
of `notification_source` from the `process_notification` function into
 a separate `debug_notification_source_value` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev a11dedd393 notifications: Extract notification content retrieval.
This commit aims to extract all logic related to obtaining
notification content from the `process_notification` function into a
separate `get_notification_content` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev 8d0a70b6b9 notifications: Simplify if statement.
Since `pm_content_in_desktop_notifications` is a boolean, there's no
need to check if it's undefined.
2023-09-13 10:55:59 -07:00
Tim Abbott ba22433dd9 stream_popover: Inline register_stream_handlers.
Also register these click handlers just on the popover itself directly
in the onMount helper, like we do with all the other popover_menus.js
functions.
2023-09-13 10:55:40 -07:00
Daniil Fadeev 08aec5ac41 stream_popover: Migrate from Bootstrap to Tippy. 2023-09-13 10:55:40 -07:00
Daniil Fadeev f2f0462e09 stream_popover: Rename stream_popped to is_open.
stream_popover.is_open() much more accurately describes what this
does, and in particular the fact that the function applies to all
places the stream popover might be.
2023-09-13 10:55:40 -07:00
Daniil Fadeev 35d97160bc stream_popover: Use currentTarget as reference to the stream popover.
Using currentTarget as a reference element guarantees us that the
relative placement will be the same every time.
2023-09-13 10:55:40 -07:00
Daniil Fadeev e0f72de75c stream_popover: Update the comment that describes the module. 2023-09-13 10:55:40 -07:00
Daniil Fadeev 71de1c2a66 popovers: Use `media_breakpoint_num` instead of a constant value. 2023-09-13 10:55:40 -07:00
Karl Stolley f4fdc5c97c thirdparty: Add Feather Icon credits.
All of these files were introduced in #26283.
2023-09-12 13:08:18 -07:00
Karl Stolley b5bd439769 thirdparty: Use hyphen in date ranges.
While an en dash--as replaced here with a hyphen--is sounder
typographically, the other ranges in the file use a hyphen, which
is arguably also more interoperable in a plain-text file such as
this (though other en dashes live on in the file, as part of the
original licensing text).
2023-09-12 13:08:18 -07:00
Karl Stolley d870f2af24 thirdparty: Add period after Twitter, Inc.
This makes all shortened forms of "incorporated" uniform across
the file, and matches how "Twitter, Inc." is presented in the files
in question, e.g., atop `web/third/bootstrap/js/bootstrap.js`.
2023-09-12 13:08:18 -07:00
Karl Stolley 0d3f475a91 thirdparty: Uniformly present copyright years without commas.
While the spec permits forms both with and without a comma,
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#copyright-field,
this corrects a small number of licensing lines in the file to
match the comma-less form used in the majority of other lines.
2023-09-12 13:08:18 -07:00
Karl Stolley 0c9701b921 thirdparty: Update current year on Kandra copyright. 2023-09-12 13:08:18 -07:00
Karl Stolley 8c0c2c7da6 thirdparty: Add missing comma after Kandra Labs. 2023-09-12 13:08:18 -07:00
Karl Stolley 35730f0291 thirdparty: Alphabetize entries by path. 2023-09-12 13:08:18 -07:00
Anders Kaseorg 8efa418205 typed_endpoint: Add missing tuple comma for OptionalTopic aliases.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-12 11:49:11 -07:00
Anders Kaseorg 9abb850cd9 docs: Use MyST syntax for Sphinx metadata.
https://myst-parser.readthedocs.io/en/latest/faq/index.html#sphinx-specific-page-front-matter

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-12 10:34:03 -07:00
Alex Vandiver 135acfea93 nginx: Suppress proxy warnings when the proxy itself sent the request.
This is common in cases where the reverse proxy itself is making
health-check requests to the Zulip server; these requests have no
X-Forwarded-* headers, so would normally hit the error case of
"request through the proxy, but no X-Forwarded-Proto header".

Add an additional special-case for when the request's originating IP
address is resolved to be the reverse proxy itself; in these cases,
HTTP requests with no X-Forwarded-Proto are acceptable.
2023-09-12 10:10:58 -07:00
Aman Agrawal a8e1c22687 inbox: Add support for vim keys. 2023-09-12 09:20:33 -07:00
Aman Agrawal 6c179bcc48 inbox: Show focus underline for non-dm rows. 2023-09-12 09:20:33 -07:00
Aman Agrawal 58c5701e5e css: Assign a variable to focus underline color of recent view. 2023-09-12 09:20:33 -07:00
Aman Agrawal f12fe219d9 inbox: Sort pinned streams at the top. 2023-09-12 09:20:33 -07:00
Aman Agrawal 4559a9fbf3 inbox: Save collapsed state of streams in localstorage. 2023-09-12 09:20:33 -07:00
Aman Agrawal 6ef0753a51 inbox: Add new narrow. 2023-09-12 09:20:33 -07:00
Anders Kaseorg 3d7b9e622d web: Avoid several unchecked TypeScript casts.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:04:55 -07:00
Anders Kaseorg 4650b789ce browser_history: Delay user_settings.default_view evaluation.
Commit 61f7ede43c (#25759) introduced a
bug: browser_history tried to access user_settings.default_view at top
level as soon as it was imported, before
user_settings.initialize_user_settings has been called, so
browser_history.state.spectator_old_hash was always initialized to
"#undefined".

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:04:55 -07:00
Anders Kaseorg 6988622fe8 ruff: Enable B023 Function definition does not bind loop variable.
Python’s loop scoping is misdesigned, resulting in a very common
gotcha for functions that close over loop variables [1].  The general
problem is so bad that even the Go developers plan to break
compatibility in order to fix the same design mistake in their
language [2].

Enable the Ruff rule function-uses-loop-variable (B023) [3], which
conservatively prohibits functions from binding loop variables at all.

[1] https://docs.python-guide.org/writing/gotchas/#late-binding-closures
[2] https://go.dev/s/loopvar-design
[3] https://beta.ruff.rs/docs/rules/function-uses-loop-variable/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
Anders Kaseorg cf4791264c python: Replace functools.partial with type-safe returns.curry.partial.
The type annotation for functools.partial uses unchecked Any for all
the function parameters (both early and late).  returns.curry.partial
uses a mypy plugin to check the parameters safely.

https://returns.readthedocs.io/en/latest/pages/curry.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
Alex Vandiver ccbd834a86 postgres_exporter: Rebase the per-index stats branch.
The branch from the PR is somewhat stale, and is missing important bugfixes.
2023-09-11 17:59:54 -07:00
Prakhar Pratyush 20886b80d9 topic_list: Update the order of "Followed" topics in the muted stream.
For sorting topics in the left sidebar topics list, the "Followed"
topics are treated the same as "Unmuted" topics.

In a muted stream and not zoomed state:
* followed/unmuted topics at the top.

In an unmuted stream or zoomed state in a muted stream:
* normal recency sorting

The reason is that the "Followed" topics have a tier of interest
above being unmuted, so they shouldn't lie below the "Unmuted" topics
in the list.
2023-09-11 17:55:37 -07:00
Prakhar Pratyush 5d069b7d7a topic_list: Add an icon and update the color for "Followed" topics.
This commit adds the follow icon to the right end
(before the three-dot menu icon) of the topic list item
for followed topics.

The icon replaces '@' instead of showing both the '@' and "Follow"
icons in the case of unread mentions, as users don't care if they
are following a topic if they've got unread mentions there.

In a muted stream, the text color of followed topics in the topic list
is set to be similar to that of unmuted topics.

The reason is that the followed topic has a tier of interest above
being unmuted, so it shouldn't stay faded in the topic list.
2023-09-11 17:55:35 -07:00
Prakhar Pratyush 07fd2aa344 topic_list: Add a CSS variable for the unmuted topic's color.
This commit adds the CSS variable '--color-unmuted-topic-list-item'
for the unmuted topic's color in the topic list.

The color for both the light and dark themes is defined in
'zulip.css' and used in 'left_sidebar.css'.

This approach helps to remove the use of the selector 'unmuted_topic'
only for color definition in 'dark_theme.css'.
2023-09-11 17:12:21 -07:00
Alex Vandiver 5874c6542f migrations: Remove indexes on Message without realm_id.
These indexes should no longer be necessary after the changes in the
previous commit.
2023-09-11 15:00:37 -07:00
Alex Vandiver b94402152d models: Always search Messages with a realm_id or id limit.
Unless there is a limit on `id`, always provide a `realm_id` limit as
well.  We also notate which index is expected to be used in each
query.
2023-09-11 15:00:37 -07:00
Alex Vandiver f9dd2549eb narrow: Set a realm_id limit on messages in user searches. 2023-09-11 15:00:37 -07:00
Alex Vandiver 3518d31797 migrations: Add indexes with realm_id.
This is designed to help PostgreSQL have better specificity and
locality in its indexes.  Subsequent commits will adjust the code to
make sure that we use these indexes rather than the `realm_id`-less
versions.

We do not add a `realm_id` variation to the full-text index, since
it is a GIN index; multi-column GIN indexes are not terribly
performant, require the `btree_gin` extension for `int` types (which
requires superuser privileges on PostgreSQL 12 and earlier), and
cannot be consistently added concurrently on running instances.

After all indexes have been made, we also run `CREATE STATISTICS` in
order to give PostgreSQL the opportunity to realize that recipient and
sender are highly correlated with message realm, allowing it to
estimate that `(realm_id, recipient_id)` is likely as specific as
matching a given `recipient_id`, instead of as likely as matching
`realm_id` times matching a `recipient_id`.  Finally, those statistics
must be filled by `ANALYZE zerver_message`, which is run last.
2023-09-11 15:00:37 -07:00
Alex Vandiver 067de6f948 coverage: Skip zerver.lib.migrate coverage.
It is only covered when we run migration tests, which we are not
guaranteed to always be able to do.
2023-09-11 15:00:37 -07:00