Commit Graph

57001 Commits

Author SHA1 Message Date
Alex Vandiver 90abb2281d tests: Split DeleteMessageTest from test_message_edit.py. 2024-03-06 17:31:16 -08:00
Varun Singh 1fb03a27d8 compose_fade: Convert module to TypeScript. 2024-03-06 14:47:47 -08:00
Varun Singh d60848bb81 compose_fade: Refactor 'set_focused_recipient' function.
Previously we  declared the 'focused_recipient' object
with an initial field of 'msg_type' and progressively added
fields by mutating the object(depending on the 'msg_type' ie. 'stream'
or 'private'). This was not TypeScript friendly and the compiler threw.

Now, we first fetch those fields and then create the 'focused_recipient'
object depending on the value of 'msg_type' field.
2024-03-06 14:47:47 -08:00
Varun Singh c67b38fa7d message_viewport: Consistently use 'row_to_output' for callback.
This callback(initially named 'row_to_id') is part of two different
code paths.For one it refers to 'get_row' function local to
'visible_groups' and for other it refers to 'row_to_id' function
local to 'visible_messages'(same namings cause a confusion and is
also inconsistent).

Here I have renamed the callback to 'row_to_output', this is
more explanatory and consistent with name '_divisible_divs' uses
for the same callback.
2024-03-06 14:47:47 -08:00
Varun Singh 99ea6ae3fc rows: Fix type of 'message_group'. 2024-03-06 14:47:47 -08:00
Varun Singh ead68e731b compose_fade: Fix argument to be a jQuery object. 2024-03-06 14:47:47 -08:00
Tim Abbott 242c5cbb1d condense: Pass message objects to collapse functions.
This creates a much cleaner API and types for these functions. Since
the callers already had the message objects, this avoids extra work
both in the most callers and in these functions.

We also loop through all_rendered_message_lists rather than hardcoding
logic for message_lists.home.
2024-03-06 14:40:47 -08:00
Sayam Samal 70013d0f28 navbar: Add navigate to home view tooltip to the organization logo.
The organization logo in the upper left navigates to the user's home
view. We add a tooltip to make this easier to discover.

We show `Esc` as the keyboard shortcut here, unless the user has
disabled it, in which case we show the alt shortcut `Ctrl` + `[`.

Fixes #29185.
2024-03-06 13:58:36 -08:00
afeefuddin 5e18bd762f left_sidebar_navigation_area: Convert module to TypeScript. 2024-03-06 13:57:33 -08:00
Mateusz Mandera b572fa93cd context_managers: Open file in write mode in lockfile_nonblocking.
Otherwise this fails if the file doesn't yet exist.
2024-03-06 10:35:02 -08:00
Karl Stolley b20beda905 emoji_picker: Express colors as CSS variables.
This also adds a previously missing dark-mode background color for
reacted emoji's :focus state in the picker.
2024-03-05 14:58:58 -08:00
Karl Stolley 11fcd4091c emoji_picker: Reorder CSS to match template structure. 2024-03-05 14:58:58 -08:00
Karl Stolley e22666f116 emoji_picker: Remove selectors not used with Tippy. 2024-03-05 14:58:58 -08:00
Sayam Samal a60e3d93e9 compose: Fix topics required banner closing on enter to send.
We were updating the compose banners on every `keyup` event on the
topic input. Since, `keyup` also gets triggered for the modifier and
non-printing keys such as "Enter", this lead to banner for topic
required being closed via the `check_posting_policy_for_compose_box`
when pressing "Enter" to send a message with no topic.

This bug was probably introduced in 5c993f0, which moved additional
logic into `update_on_recipient_change`.

To solve this issue, we use the `input` event instead of the `keyup`
event to update the compose banners only when the value inside the
input element changes.

This change also prevents the the compose banner from being closed
when we only press modifier keys - such as Shift.
2024-03-05 14:57:02 -08:00
Karl Stolley a5a6afb0ab portico: Remove All plans tab at mobile scale. 2024-03-05 14:55:43 -08:00
Alya Abbott 6eefd07c81 docs: Add plan sign-up to mobile notifications sign-up instructions. 2024-03-05 14:55:24 -08:00
evykassirer 0062d3f999 reactions: Deduplicate shared code.
Creates a function for code shared by update_user_fields
and make_clean_reaction.
2024-03-05 14:54:45 -08:00
evykassirer 2de1486719 reactions: Send full message object to update_ui_and_send_reaction_ajax. 2024-03-05 14:54:45 -08:00
evykassirer 3d854771a2 reactions: Make count non-optional on ReactionUserIdAndCount. 2024-03-05 14:54:45 -08:00
Lauryn Menard bd1450f7b0 markdown-css: Wrap longer code elements in documentation.
Add a word-wrap rule so that longer code elements, such as example
URLs or long return value names in the API documentation, do not
overflow out of the view in narrowed browsers or mobile views.
2024-03-05 12:23:16 -08:00
Mateusz Mandera 3ab0fa04c0 remote_billing: Fix phrase on the "server already on a plan" error page.
"All older versions" was incorrect.
2024-03-05 11:53:51 -08:00
Mateusz Mandera c1857b2c86 config_error: Support passing arguments specifying the "go back" link.
Depending on the kind of config error being shown, different "go back"
links may be more appropriate.
We probably hard-coded /login/ for it, because these config errors are
most commonly used for authentication backend config error, where it
makes sense to have /login/ as "go back", because the user most likely
indeed got there from the login page.

However, for remote_billing_bouncer_not_configured, it doesn't make
sense, because the user almost surely is already logged in and got there
by clicking "Plan management" inside the gear menu in the logged in app.
2024-03-05 11:53:51 -08:00
Mateusz Mandera e952c3b627 remote_billing: Tweak /self-hosted-billing/ endpoints access model.
It's best for these to just be consistent. Therefore:
1. The .../not-configured/ error page endpoint should be restricted to
   .has_billing_access users only.
2. For consistency, self_hosting_auth_view_common is tweaked to also do
   the .has_billing_access check as the first thing, to avoid revealing
   configuration information via its redirect/error-handling behavior.

The revealed configuration information seems super harmless, but it's
simpler to not have to worry about it and just be consistent.
2024-03-05 11:53:51 -08:00
Mateusz Mandera 898e47fbdd config_error: Change the look of the page.
Replaces the green theme with the old Zulip octopus with a plain, white
page.
2024-03-05 11:53:51 -08:00
Mateusz Mandera 6593ccd7fc test_helpers: Remove /self-hosted-billing/ from exempt_patterns.
This was added early on and hasn't been removed since, even though we
have tests for the endpoint for a while now.
2024-03-05 11:53:51 -08:00
Mateusz Mandera e39f400f94 remote_billing: Make "plan management" always available.
Just shows a config error page if the bouncer is not enabled. Uses a new
endpoint for this so that it can work nicely for both browser and
desktop app clients.
It's necessary, because the desktop app expects to get a json response
with either an error or billing_access_url to redirect to. Showing a
nice config error page can't be done via the json error mechanism, so
instead we just serve a redirect to the new error page, which the app
will open in the browser in a new window or tab.
2024-03-05 11:53:51 -08:00
Mateusz Mandera d5fb3f3176 authentication_methods: Bump feature level and add changelog entries. 2024-03-05 11:48:58 -08:00
Mateusz Mandera 1ede8da46c events: Change format of authentication_methods realm_update_dict event.
Makes the event in line with state_data.realm_authentication_methods.
2024-03-05 11:48:58 -08:00
Mateusz Mandera da9e4e6e54 backends: Implementation of restricting certain backends by plan.
Only affects zulipchat, by being based on the BILLING_ENABLED setting.

The restricted backends in this commit are
- AzureAD - restricted to Standard plan
- SAML - restricted to Plus plan, although it was already practically
  restricted due to requiring server-side configuration to be done by us

This restriction is placed upon **enabling** a backend - so
organizations that already have a backend enabled, will continue to be
able to use it. This allows us to make exceptions and enable a backend
for an org manually via the shell, and to grandfather organizations into
keeping the backend they have been relying on.
2024-03-05 11:48:58 -08:00
Mateusz Mandera fdbdf8c620 backends: Add ZulipAuthMixin inheritance to ZulipRemoteUserBackend.
By convention, all our backends inherit form ZulipAuthMixin. This is
helpful to have a single place if we want to add some class attributes
that all the backends should have.
2024-03-05 11:48:58 -08:00
N-Shar-ma bff750e825 copy_and_paste: Fix formatting of code pasted from VS Code.
Since the html copied from VS Code is not structured as code but as
styled divs for each line, any code copied from it would be pasted
unformatted with blank lines between each line of code.

This has now been fixed, by detecting VS Code style code blocks by the
CSS property `white-space: pre` and pasting the text within as is, as
code.
2024-03-05 11:34:22 -08:00
evykassirer af8263fb87 people: Don't refetch user when we already have it. 2024-03-05 11:27:34 -08:00
Sahil Batra e965ed2eb8 stream_settings: Show banner on successful stream creation.
This commit adds banner which is shown on successful stream
creation which contains a link to stream narrow. This banner
makes it more clear that stream was created successfully and
also makes it easy to navigate to the new stream.

Fixes #29171.
2024-03-05 10:56:30 -08:00
Sayam Samal 24e5004a54 compose_tooltips: Rename "non-stream" to "non-specific" type/view.
We want to name types/views that are not Stream or Direct related to be
"non-specific". The previously used term "non-stream" could be confusing
since it would literally mean any type/view which is not a stream type/
view, which would encapsulate the Direct type/view also.

Thus, we finally use the following terms to describe the type of
conversation:
1. Stream type (Streams or Topics)
2. Direct type (A)
3. Non specific type (Inbox, Recent conversation, All messages)
2024-03-05 10:55:20 -08:00
Sayam Samal 1091938252 compose_tooltips: Fix compose buttons not updating for inbox view.
This commit fixes the bug, where navigating to inbox view does not
update the closed compose buttons. Due to this the tooltip over the
"Start new conversation" button also showed the wrong content.
2024-03-05 10:55:20 -08:00
Sayam Samal a0411e32b6 compose_tooltips: Fix tooltips for disabled conversation button.
In the situation where the DMs are disabled in an organization, we
disable the new conversation button. But due to this, the tooltip
hinting towards the same, was also being disabled because it was
attached to a disabled element which does not fire any events.

This commit fixes this bug, by wrapping the new conversation button
inside a div, and attaching the tooltip to this wrapper instead.
2024-03-05 10:55:20 -08:00
Sayam Samal f00d79399e compose_tooltips: Change new conversation button tooltip logic.
As reported on CZO, the new conversation button sometimes had stale
tooltip content rendered on it. In this commit, we change the logic
used to render this tooltip, to now render the tooltip content on the
fly via `instance.setContent()` which should eliminate any such bug.

Fixes #27158.
2024-03-05 10:55:20 -08:00
Aman Agrawal de61a91738 message_list: Fix delayed events finding current msg list undefined.
Events that are called after a delay can find message_lists.current
to be undefined if user has moved to non-message list view.
2024-03-05 10:54:07 -08:00
David Rosa 65c68a5a72 help: Move alternate method to remove users from a stream to a tab.
Updates "Remove users from a stream" to follow current help center
documentation patterns.
2024-03-05 10:22:18 -08:00
David Rosa 3d63ea20b6 help: Add "View stream subscribers" page.
Documents how to view stream subscribers via settings and
the right sidebar.

Fixes #28887.
2024-03-05 10:22:18 -08:00
Mateusz Mandera 634015411a update_analytics_count: Use a correct lock mechanism.
Adds a re-usable lockfile_nonblocking helper to context_managers.

Relying on naive `os.mkdir` is not enough especially now that the
successful operation of this command is necessary for push notifications
to work for many servers.

We can't use `lockfile` context manager from
`zerver.lib.context_managers`, because we want the custom behavior of
failing if the lock can't be acquired, instead of waiting.
That's because if an instance of this gets stuck, we don't want to start
queueing up more processes waiting forever whenever the cronjob runs
again and fail->exit is preferrable instead.
2024-03-05 10:21:14 -08:00
evykassirer fb7d77545f reactions: Convert module to typescript. 2024-03-04 19:07:49 -08:00
evykassirer 07671997ca reactions: Calculate vote_text before creating clean reaction.
This is essential for converting to typescript, because
we can't create half a clean reaction and then calculate
vote_text afterwards. Instead, we should calculate it
with the information we already have, and create the
clean reaction object afterwards, all at once.
2024-03-04 19:07:49 -08:00
evykassirer 9d859ddbc9 reactions: Calculate should_display_reactors without clean reactions.
When we move to typescript, we want to be able to calculate
this value *before* creating the clean reactions, so that
we can generate the clean reactions in one go instead of
having some half-created object.
2024-03-04 19:07:49 -08:00
afeefuddin 72681c2d5a hotspots: Convert module to TypeScript. 2024-03-04 18:17:34 -08:00
afeefuddin 6314139d4a zcommand: Convert module to TypeScript. 2024-03-04 18:10:38 -08:00
N-Shar-ma b4d53c7930 compose: Fix bug where inserted content would not be scrolled into view.
On chromium browsers, the scroll position is not restored when the text
in a textarea is replaced. So instead of directly replacing the text,
we call the `insert_and_scroll_into_view` function with `replace_all`
set to true.
2024-03-04 17:14:11 -08:00
N-Shar-ma ef0be22899 compose: Add parameter `replace_all` to `insert_and_scroll_into_view`.
We refactor the `insert_and_scroll_into_view` function to accept a new
parameter, `replace_all`, defaulting to false, that when set to `true`,
will replace all existing content of the textarea with the new content,
instead of inserting the new content at the current cursor position.

This is a prep commit for the next commit, which will set this new flag.
2024-03-04 17:14:11 -08:00
Aman Agrawal ad2e176625 help: Link mark as read in conversation banner to help page.
Fixes #29115
2024-03-04 16:55:59 -08:00
tnmkr 25cca93bc9 stream_settings: Show relevant streams in left panel.
We want to make the default stream listing more relevant. To do this,
we always show "All streams" tab when stream is opened from another
user's profile. From other places, we show "Subscribed" if the user
is subscribed to the stream they are trying to edit otherwise
"All streams" are shown.
2024-03-04 16:52:57 -08:00