Commit Graph

49734 Commits

Author SHA1 Message Date
Alex Vandiver 6cf1d9fa20 css: Remove a hardcoded reference to chat.zulip.org. 2023-01-24 17:34:26 -05:00
Alex Vandiver ad8041253c release: Add tests for spelling and links in changelog. 2023-01-24 13:30:04 -08:00
Alex Vandiver 23f4cde91c email_mirror: Ensure that attachments get space to be included.
The content of a message is truncated to `MAX_MESSAGE_LENGTH`, which
is 1000 characters.  Since the email gateway places attachments at the
very end of the extracted body, that means that they are the first
thing to get truncated off.

That is, if an incoming email message contains 1000 `a`s and an image
attachment, the link that attaches the attachment to the message will
get truncated off, leaving it dangling in the database.

Truncate the message body content separately from the attachment links
which are included at the end of the body.
2023-01-24 13:22:13 -08:00
Lauryn Menard 019fa7e122 organization-profile: Update deactivate organization section.
Removes the info icon with the tooltip information and replaces
it with a question help link icon to the help center article on
deactivating an organization.

Also, when the button is disabled, adds a tooltip on hover that
explains only organization owners can deactivate an organization.

If the current user's owner role is changed, then the button and
tooltip are live updated.

Part of #22892.
2023-01-24 13:09:53 -08:00
Alex Vandiver d0de66b273 puppet: Remove "ensure => absent" rules which have all been applied. 2023-01-24 13:05:24 -08:00
Lauryn Menard e7cecc989f documentation: Clean up `MarkdownDirectoryView.get_context_data`.
Changes the check for whether the documentation page is a policy
center page to be the `self.policies_view` boolean instead of the
`path_template` value as it reads much more clearly.

Moves a comment in the code to be contextually relevant.
2023-01-24 13:04:04 -08:00
Lauryn Menard 8859da911b documentation: Rename `article_path` variable when getting context.
Because of the overlap with the `DocumentationArticle` dataclass
field `article_path`, we rename the `article_path` variable used
in `MarkdownDirectoryView.get_context_data` for the absolute path
to be `article_absolute_path`.
2023-01-24 13:04:04 -08:00
Lauryn Menard f7d5cd5690 documentation: Remove "not_index_page" from context.
In commit bbecd41, we added "not_index_page" to the context for
some documentation articles, but use of that context key/value was
removed when the help documentation was removed in commit 1cf7ee9.

Changes `not_index_page` to be a boolean value that's used to set
the page title, but is not then passed on as a context key/value.

Also removes an irrelevant comment about disabling "Back to home"
on the homepage.
2023-01-24 13:04:04 -08:00
Aman Agrawal 37431cf0b5 urls: Provide `email` as a GET parameter.
Since we want to use `accounts/new/send_confirm` to know how many
users actually register after visiting the register page, we
added it to Google Tag Manager, but GTM tracks every user
registration separately due <email> in the URL
making it harder to track.

To solve this, we want to pass <email> as a GET parameter which
can be easily filtered inside GTM using a RegEx and all the
registrations can be tracked as one.
2023-01-24 11:29:50 -08:00
Aman Agrawal a51bf96c70 accounts_send_confirm: Show email to which the link was sent.
This can be useful for the user in case user is worried if they
typed the correct email.
2023-01-24 11:29:50 -08:00
Prakhar Pratyush 1a400b21e7 notifications: Fix missed message email notifications of welcome bot.
A missed message email notification, where the message is the welcome
message sent by the welcome bot on account creation, get sent when
the user somehow not focuses the browser tab during account creation.

No missed message email or push notifications should be sent for the
messages generated by the welcome bot.

'internal_send_private_message' accepts a parameter
'disable_external_notifications' and is set to 'True' when the sender
is 'welcome bot'.

A check is introduced in `trivially_should_not_notify`, not to notify
if `disable_external_notifications` is true.

TestCases are updated to include the `disable_external_notifications`
check in the early (False) return patterns of `is_push_notifiable` and
`is_email_notifiable`.

One query reduced for both `test_create_user_with_multiple_streams`
and `test_register`.
Reason: When welcome bot sends message after user creation
`do_send_messages` calls `get_active_presence_idle_user_ids`,
`user_ids` in `get_active_presence_idle_user_ids` remains empty if
`disable_external_notifications` is true because `is_notifiable` returns
false.
`get_active_presence_idle_user_ids` calls `filter_presence_idle_user_ids`
and since the `user_ids` is empty, the query inside the function doesn't
get executed.

MissedMessageHookTest updated.

Fixes: #22884
2023-01-24 11:16:21 -08:00
Prakhar Pratyush b40bbd6ca8 message_send: Refactor internal_send_*, internal_prep_* & _internal_prep_*.
This commit makes all the parameters after 'content' in
'internal_send_*', 'internal_prep_*' and '_internal_prep_*'
a mandatory keyword argument to increase code readability.
2023-01-24 11:16:21 -08:00
Prakhar Pratyush 4595b5d132 notifications: Add separate function for `is_notifiable` trivial checks.
A separate function named `trivially_should_not_notify` is added which
extracts the common checks from `get_push_notification_trigger` and
`get_email_notification_trigger` which are users' notification settings
independent and thus don't depend on what type of notification (email/push)
it is.
2023-01-24 11:16:14 -08:00
brijsiyag cb35e5c6fc css: Add spinning animation for pre-CSS app loading page.
Fixes #22265.
2023-01-24 11:05:36 -08:00
Alex Vandiver 994806c505 migrations: Fix ownership, and re-attach, mis-owned email attachments.
608c787c52 fixed a bug where messages sent by the email gateway "as"
a user failed to properly attribute ownership of their attachments,
leaving the attachments orphaned and thus with nobody with permissions
to view them.

These orphaned attachments only remain longer than a few weeks if the
`delete_unclaimed_attachments` script has not been run reliably.
Since there is currently no shipped cron job for this, that is most
likely all deployments.

Add a migration to find such orphaned attachments, and re-attach them
to their original message.  While theoretically the attachments
could have been later referenced in other messages -- which would be
very difficult to find and determine if they had access to the
attachment -- we only fix the original message.

In order to make this somewhat performant, we assume that the Message
rows associated with an Attachment made by the email gateway happened
within 5 minutes, since they must have been made during one HTTP
request.

This is complicated by the message potentially having been deleted; in
this case, the Attachment is moved into ArchivedAttachment, so it can
relate to the ArchivedMessage.  The many-to-many
`zerver_archivedattachment_messages` relationship table cannot use its
own `id` sequence for the value, since the `id` is re-used when the
row is inserted into the `zerver_attachment_messages` table -- we
instead consume a value from the `id` sequence of the
`zerver_attachment_messages` table.
2023-01-24 10:49:46 -08:00
Mateusz Mandera 9aacf76f0d do: Install pynacl in the oneclick job.
This is now a required dependency.
2023-01-24 10:33:41 -08:00
Alex Vandiver 1eb31f4f54 upload-release: Update SHA256SUM for existing files if changed.
In the very infrequent case that we re-upload a file, the logic for
upload-release would have the existing SHA256SUM take precedence over
the new one -- despite uploading the new file.

Skip existing filenames (i.e. from the new file) when gathering
SHA256SUM metadata used to assemble `SHA256SUMS.txt`.
2023-01-23 17:41:29 -08:00
Aman Agrawal f4e9bf269c css: Fix positioning of text elements in message row without sender.
When I changed the padding for message content in the PR which
converted the message row to a grid, I forgot to adjust
the position of edited and time elements.
2023-01-23 16:41:03 -08:00
brijsiyag f314d819aa settings: Remove unused class.
Removed class is not used for any CSS.
Also heading is not for the message retention setting.
2023-01-23 15:09:21 -08:00
brijsiyag 02450b7aa6 settings: Fix info icon in header row outside header.
This info icon was smaller than similar ones sitting in heading rows,
because the icon element was outside the `<h3>` element for the row.

Fixes #23801
2023-01-23 15:08:42 -08:00
Akarsh Jain caeeddd975 typeahead: Fix suggestion box positioning on window resize.
The suggestion box was not being repositioned correctly when the window
was resized. This commit adds a resizeHandler() function to handle
window resizing properly and reposition the suggestion box to its
current position.

Fixes: #23681.
2023-01-23 15:05:14 -08:00
David Rosa 256e9651b6 help center: Add section links in "Using Zulip for a class".
Converts the bullets at the top of the page into section links.
2023-01-23 14:23:16 -08:00
Alex Vandiver 50e9df448d puppet: Do not start the "puppet" service.
Zulip runs puppet manually, using the command-line tool; it does not
make use of the `puppet` service which, by default, attempts to
contact a host named `puppet` every two minutes to get a manifest to
apply.  These attempts can generate log spam and user confusion.

Disable and stop the `puppet` service via puppet.
2023-01-23 13:02:09 -08:00
Alex Vandiver 25c9fcdb4e changelog: Tweak wording to clarify impact to Safari. 2023-01-23 15:07:02 -05:00
evykassirer 56c9b4f8c1 puppeteer: Check compose form contents in a new distinct function.
This is a prep commit for a future where we check the stream name
from a different field that isn't in the form, so that we only
have to change code in this single place.
2023-01-23 11:31:47 -08:00
Anders Kaseorg d3164016f5 ruff: Fix UP032 Use f-string instead of `format` call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg e5d671bf2b ruff: Fix SIM210 Use `bool(…)` instead of `True if … else False`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg 7a7513f6e0 ruff: Fix SIM201 Use `… != …` instead of `not … == …`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg 25346bde98 ruff: Fix SIM118 Use `k in d` instead of `k in d.keys()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg 6303ebfc2f ruff: Fix SIM115 Use context handler for opening files.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg c6b6004432 ruff: Fix SIM111 Use `return all(…)` instead of `for` loop.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg b8b29dc3ad ruff: Fix SIM110 Use `return any(…)` instead of `for` loop.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg ff1971f5ad ruff: Fix SIM105 Use `contextlib.suppress` instead of try-except-pass.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Anders Kaseorg b0e569f07c ruff: Fix SIM102 nested `if` statements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
David Rosa 50cf9bc4b8 contributor docs: Document bold formatting for help center inline icons.
Updates "Icons" section of the "Writing help center articles" page
to be consistent with current help center documentation patterns.
2023-01-23 11:15:51 -08:00
David Rosa f1f381dc2c help center: Consistently use bold formatting for icon names.
Fixes formatting of icon names to follow current help center
documentation patterns.
2023-01-23 11:15:51 -08:00
Alex Vandiver d38b3ad09c changelog: Fix the link from `.html#` to `.md#`. 2023-01-23 18:58:26 +00:00
Alex Vandiver 4226026dbc version: Update version and changelog after 6.1 release. 2023-01-23 18:52:47 +00:00
m-e-l-u-h-a-n fbb475b16a streams: Fix hash redirect for deleted/invalid stream ids.
The logic for hash redirects for stream settings did not check
for deleted or non-existent streams. Thus a hash of the form
`/#streams/{invalid_stream_id}/*` gave gave a blueslip error.

This change fixes that logic to treat such hashes equivalent to
streams whose settings cannot be accessed by that user and
redirects such invalid hashes to `/#streams/subscribed/`.
2023-01-20 15:07:00 -08:00
N-Shar-ma fb81e5504c typeahead: Remove misleading comment regarding favouring popular emojis. 2023-01-20 14:41:21 -08:00
N-Shar-ma aa72b51bca emojis: Prioritise custom / realm emojis when sorting.
Fixes: #18135.
2023-01-20 14:41:21 -08:00
N-Shar-ma 249f482b06 emojis: Filter out unicode emojis with same codes from typeahead menu.
Since emojis can have multiple aliases, an emoji was often suggested
under multiple names (like `smiling devil` / `smiling imp`), crowding
typeahead suggestions redundantly, and taking up the place of other
potentially relevant emoji suggestions.

Now such duplicates are removed post the sorting of suggested emojis,
and only the most relevantly named (highest sorted) copy is retained.
2023-01-20 14:41:21 -08:00
N-Shar-ma c64726ea9a compose: Retain compose state across narrows if recipient was edited.
Uptil now, the compose box's state was retained across narrows only if
the compose box had any content in it. Else it was reset to match the
current narrow.

To not lose any changes made to the recipient fields only, the compose
box will now retain its state also if the recipient (stream, topic or
PMs) has been manually edited.

This is achieved by having a variable in `compose_state` track if the
recipient fields were changed, and checking it before resetting the
compose box on narrowing. This variable is reset when the compose box's
context is changed by clicking on a message, or when a message is sent.

Fixes: #23064.
2023-01-20 12:56:37 -08:00
Sahil Batra 3cb69b138e settings: Disable save button when value is out of range.
This commit adds code to disable save button when the value
in custom input box is too large for an integer. Note that
since the value for message edit, message delete and email
notification batching settings are in minutes in the custom
input but are sent to API in seconds, we make sure that the
seconds value should be inside the range.
2023-01-20 12:45:53 -08:00
Sahil Batra 82aacb4996 settings: Fix custom input handling of message retention setting.
This commit adds code to convert $custom_input.val() to Number
in get_message_retention_setting_value such that values like
"48aa" are treated as NaN and we correctly show save-discard
widget with save button disabled. If we not convert it to Number,
Number.parseInt will just convert "48aa" to 48.

This commit is similar to 711536f53a.
2023-01-20 12:45:53 -08:00
Sahil Batra 235bd3fb1b settings: Disable "Save changes" button for invalid values.
This commit disables the "Save changes" button when there is
an invalid value in custom input of message retention setting.

This commit includes changes for both realm and stream message
retention setting.
2023-01-20 12:45:53 -08:00
Sahil Batra ba1188db05 settings: Rename admin-realm-time-limit-input class.
This commit renames admin-realm-time-limit-input class to
time-limit-custom-input such that there is no confusion
when it is used for stream settings also.
2023-01-20 12:45:53 -08:00
Sahil Batra 565d133985 settings: Refactor code for waiting period setting.
This commit refactors code for realm waiting period setting
to be similar to other time-based inputs. We also add the
code to disable the save button when custom inputs have
invalid values.
2023-01-20 12:45:53 -08:00
Sahil Batra bc5f0e881e settings: Rename IDs of waiting-period-threshold setting elements. 2023-01-20 12:45:53 -08:00
Sahil Batra 4dd1676e96 settings_config: Add waiting_period_threshold_dropdown_values.
This list will be used in further commits in settings_org.js
code for waiting period threshold setting.
2023-01-20 12:45:53 -08:00