Commit Graph

56871 Commits

Author SHA1 Message Date
Alex Vandiver ed70b62ea8 create-database: Treat "zulip" db without "zerver_messages" as empty.
A user who somehow got an empty `zulip` database, but without a
`zerver_messages` table in it, would get stuck in the installer at:

```
++ su postgres -c 'cd / && psql -v ON_ERROR_STOP=1 -Atc '\''SELECT COUNT(*) FROM zulip.zerver_message;'\'' zulip'
ERROR:  relation "zulip.zerver_message" does not exist
LINE 1: SELECT COUNT(*) FROM zulip.zerver_message;
                             ^
+ records=
```

Treat a failure to select from `zerver_messages` as having 0 messages,
and continue with the `DROP DATABASE IF EXISTS` / `CREATE DATABASE`
that `create-db.sql` usually does.

Fixes: #29110.
2024-03-08 12:40:39 -05:00
Prakhar Pratyush 7e9212a1a0 corporate: Use 'next_invoice_date' as the event_time in invoice_plan.
Earlier, we were using 'timezone_now' (the time cron job runs)
as the event_time while invoicing plans in 'invoice_plan'.
This is not accurate as it will lead to invoicing ledger entries
created after 'next_invoice_date' and before 'timezone_now'.

We should only invoice the ledger entries created till
next_invoice_date. It should be independent of the time
at which cron job runs.

This commit updates the logic to use next_invoice_date
as the event_time while invoicing via cron.
2024-03-08 09:25:46 -08:00
Prakhar Pratyush 31a0aa2a83 test_stripe: Fix time travel to incorrect datetime.
Earlier, at few places in test_stripe we were doing
incorrect time travel. For example:
A plan was invoiced till self.next_year & while checking
the billing page, we were using the self.now datetime.
To correctly check the billing page state after plan is
invoiced, we should use a datetime greater than or equal
to the time at which plan was invoiced.

This commit fixes such logically incorrect time-travel.
2024-03-08 09:25:46 -08:00
Prakhar Pratyush 72d9a4a074 test_support_views: Fix event_time of LicenseLedger entry created.
While creating a LicenseLedger entry in 'create_customer_and_plan',
we should set the 'event_time' to the same time at which the plan
is created.

Earlier, the 'event_time' for ledger entry & 'billing_cycle_anchor'
of the plan were set to different values, which is not the
correct behavior.
2024-03-08 09:25:46 -08:00
Alya Abbott 736070ca2e portico: Align plans on /for/education with /plans. 2024-03-07 17:31:20 -08:00
nimishmedatwal 8e0518d777 user_profile: Navigate tabs by arrow keys.
Left/right keys arrows in User Profile now navigates
between tabs when it's first opened.
Fixes #28615
2024-03-07 16:48:04 -08:00
Alya Abbott e4cf5ba0c5 bookends: Add periods to stream status bookends.
Also change "deactivated"->"archived" for consistency.
2024-03-07 16:16:02 -08:00
Temidayo32 42dd55df42 condense: Convert module to Typescript. 2024-03-07 16:15:30 -08:00
Anders Kaseorg e00641b0c4 requirements: Move pip and zoneinfo forks to zulip organization.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-07 18:44:04 -05:00
evykassirer c0bce2c4bf state_data: Fix alphabetical sorting. 2024-03-07 13:25:20 -08:00
evykassirer 3622bff379 activity_ui: Convert module to typescript. 2024-03-07 12:46:37 -08:00
evykassirer c78de3cbc1 state_data: Add realm properties. 2024-03-07 12:46:37 -08:00
Lauryn Menard f3906f4a2f remote-support: Add ability to deactivate and reactivate remote servers. 2024-03-07 11:51:00 -08:00
evykassirer 33484e7ac3 people: Cache results of remove_diacritics. 2024-03-07 11:46:54 -08:00
evykassirer 1db2d0fd0f people: Move comments above fields. 2024-03-07 11:46:54 -08:00
Prakhar Pratyush bd969de208 stripe: Don't invoice fixed-price plans for additional licenses.
Earlier, the code block to calculate additional licenses charge
raised assertion error when processing a fixed-price plan.

The code block shouldn't be executed for fixed-price plans as
we don't charge customers on fixed-price plans for additional
licenses.
2024-03-07 09:54:34 -08:00
Prakhar Pratyush 5085d58bc7 corporate: Fix to check if the plan we are processing is paid or not.
Earlier, the 'self.on_paid_plan()' check was verifying if the
billing_session/customer is on paid plan and not the plan we
are processing.

This resulted in a bug. While processing a legacy plan, a customer
switches from legacy plan to a paid plan resulting in the
'self.on_paid_plan()' check returning True.
It leads to invoicing legacy plan which shouldn't happen.

The fix is to check if the plan we are processing is paid or not
instead of the remote_realm/remote_server plan_type.
2024-03-07 09:54:34 -08:00
Prakhar Pratyush 01516ef512 invoice_plan: Don't test an Optional value using implicit truthiness. 2024-03-07 09:54:34 -08:00
Alex Vandiver 597704fa5f tests: Clarify test_inaccessible_msg_after_stream_change. 2024-03-06 17:31:16 -08:00
Alex Vandiver 40eb5bf42d tests: Split test_message_edit.py. 2024-03-06 17:31:16 -08:00
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