Commit Graph

49072 Commits

Author SHA1 Message Date
Lauryn Menard c4d407e992 api-docs: Update 'construct-narrow' article.
Fixes small error in the example at the top of the article, and
adds a short statement about narrows searching the current user's
personal message history with a link to the help center article.

Gives the final section a subheader and adds the two other narrow
operators that take an ID.
2022-11-08 11:07:00 -08:00
David Rosa 81f3307da0 help center: Mention stream section labels.
Updates the relevant help center articles to reflect that the
sections for Pinned and Inactive streams in the left sidebar
now have labels.

Fixes #23423.
2022-11-08 10:44:57 -08:00
David Rosa 2eaff50a59 help center: Document viewing read receipts on mobile.
Adds instructions for viewing read receipts in the mobile app.

Fixes #23479.
2022-11-08 10:43:50 -08:00
Mateusz Mandera 34a0139c2b rate_limit: Add interface to override rate limiting rules. 2022-11-08 08:56:42 -08:00
Sahil Batra 7c4da60b53 message: Don't create historical UserMessage rows when marking as read.
We do not create historical UserMessage rows, for messages that didn't
have one, while marking messages as read and simply ignore those messages.
We do so because there is no user of creating UserMessage rows and it just
wastes storage.

Note that we still allow to mark messages from unsubscribed streams as
read but only those which have UserMessage rows for them to handle the
case when the unread messages were not marked as read while unsubscribing
from the stream due to some race condition. In such cases, messages
will not be included in the unread count shown in "All messages" menu
(and stream is anyways not present in the left sidebar), but the message
border on the left is green if viewing the stream after unsusbcribing it.
So, to avoid the confusion for users, the messages will be marked as read
when user scrolls down.
2022-11-08 08:50:17 -08:00
Zixuan James Li 390e2a12e5 webhooks: Use get_short_sha to get shortened sha.
This unifies the length of the shortened SHA our integrations generate,
and ensures that they are long enough for projects of various sizes with
a chosen value defined in get_short_sha.

Fixes #23475

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-11-08 08:20:51 -08:00
Zixuan James Li 4e46899494 webhooks: Pick a more reasonable length for short sha.
7 characters are not enough for large projects, so we change
it to reasonably longer. As an example, The Linux kernel needs
at least 11 characters of sha in its shortened form to identify
a revision. We pick 11 so it should work for most of the projects.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-11-08 08:20:51 -08:00
Lauryn Menard 2a1ceb58d9 api-docs: Return 404 for direct `/api-doc-template` call.
We use `templates/zerver/api/api-doc-template.md` as a base template
for the documented API endpoints in `zerver/openapi/zulip.yaml`.

Previously, if this template was called as an endpoint, then it
would fail an assertion check and send server error. Now we check
for specifically for that potential path and return a 404 error
response for no existing article.

Fixes #21876.
2022-11-08 08:10:15 -08:00
Alya Abbott 04dcca370b help center: Drop extraneous Desktop/Web tab from /help/emoji-reactions.
It is better not to use a tab in the instructions for how to
"Toggle whether names of reacting users are displayed", as this setting
applies to both web/desktop and mobile apps.

The instructions themselves still indicate that the setting is controlled
via the web/desktop app.
2022-11-08 08:09:04 -08:00
Anders Kaseorg fc9f23a85f scripts: Pass --retry 3 to curl.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-08 08:07:36 -08:00
Anders Kaseorg c2cbc57bc4 ruff: Specify all selected errors.
extend-select may be removed upstream.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-07 22:17:40 -08:00
Anders Kaseorg 66393640a8 ruff: Configure target-version.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-07 22:17:40 -08:00
Matt Keller 8aa7ff4bbb slack: Parse emoji skin tone variants.
Fixes part of #23276.
2022-11-07 14:25:49 -08:00
Lauryn Menard 2dd3f29c32 api-docs: Update example response header for potential plural.
The documentation for various API endpoints gives multiple response
examples. Update the headers to reflect this fact.
2022-11-07 12:31:55 -08:00
Lauryn Menard fbe2ef9431 api-docs: Remove unused description in get-subscription-status. 2022-11-07 12:31:55 -08:00
Lauryn Menard 566a6823af api-docs: Use default example response description for get-messages. 2022-11-07 12:31:55 -08:00
Lauryn Menard 6f44681354 api-docs: Use default response example description for create-drafts. 2022-11-07 12:31:55 -08:00
Alya Abbott 9ce484e267 portico: Add a page about our values. 2022-11-07 12:27:09 -08:00
Alya Abbott 1ef94cc2b4 portico: Update /history page. 2022-11-07 12:27:09 -08:00
Lauryn Menard 19a4c3907f decorator: Put back check for dev env in `ignore_unhashable_lru_cache`.
Prior to 53231aa, the `ignore_unhashable_lru_cache` decorator had
a check for the development environment so that changes could be
seen on refresh.

Puts that check back in IgnoreUnhashableLruCacheWrapper class.
2022-11-07 12:17:59 -08:00
Lauryn Menard 66e607cf4c tests: Remove ignored `message_id` parameter in message edit tests.
For PATCH requests to edit messages, the message ID is in the URL
and does not need to be passed as part of the data in tests.
2022-11-07 12:16:28 -08:00
Javier González 63355c2a34 popovers: Add bottom margin to input.
Fixes: #23114
2022-11-07 11:31:37 -08:00
David Rosa 69bf8193a0 help center: Mention "Scroll to bottom" to mark Topics and PMs as read.
Updates "Reading Topics" and "Reading PMs" where only the keyboard
shortcut for this action is mentioned.

Fixes #23425.
2022-11-07 10:49:55 -08:00
Tim Abbott b3e1f546f3 Revert "help-docs: Revise the article on searching for messages."
This reverts commit 8410990c42.

We'd like to rework this article more substantially.
2022-11-07 10:40:28 -08:00
m-e-l-u-h-a-n 06f0634ca5 css: Fix height issue for stream and user group creation forms.
Due to incorrect heights set for user-group creation and stream
creation body we had a UI bug because of which bottom part of
user group and stream creation forms were slightly visible
through the bottom.

It was due to somewhat fussy css height rules and incorrect
height calculations for that UI.
2022-11-06 22:02:41 -08:00
Aman Agrawal 244be5b71b resize: Increase minimum height for left sidebar blocks.
This function is only called to calculate the size of stream and
user list. Using 250px as minimum height for these blocks gives
them enough space to be usable regardless of their height ratio.
2022-11-05 15:15:44 -07:00
Aman Agrawal b6a9819395 resize: Update buddy list height when resizing streams list.
If the buddy list is displayed in the left sidebar, height of
both these blocks needs to be changed to accommodate for the
changes.

The fixes the bug that stream list and user list don't fill
left sidebar and have 80px height regardless of viewport height.
2022-11-05 15:15:42 -07:00
Aman Agrawal b8f7293dba resize: Use scroll element get the scroll height for streams.
Since streams and PMS now use left_sidebar_scroll_container
for scrolling, use it get the correct scroll height.
2022-11-05 15:15:25 -07:00
Anders Kaseorg 55342efd33 scim: Upgrade django-scim2; remove request.user monkey patching.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-05 15:13:50 -07:00
Anders Kaseorg 7e8ebd18b6 test_scim: Add test for missing or wrong authentication.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-05 15:13:46 -07:00
Lauryn Menard cba8738eea search: Check if user can access stream topics before fetching history.
When building search suggestions for stream topics, instead of
assuming that the user has access to the stream's topic history
from the server, we check whether the user has access to the
stream's topics.
2022-11-05 15:09:49 -07:00
Eric Smith c4823bfd03
docs: Remove unnecessary type annotations from tutorial.
In 4c3c976174, we removed the need
to explicitly declare types for Django model fields. Here, we update that detail 
in our documentation.
2022-11-04 15:31:42 -07:00
Tim Abbott 426c806a87 docs: Document docker-zulip postgres upgrade requirement.
Since this is a hard requirement for upgrading the Docker image, it's
worth highlighting here.
2022-11-04 15:19:57 -07:00
Alex Vandiver d8ebbedbbb outgoing_webhook: Ignore the exception on failure if the stream is gone.
In the outgoing webhook handler, there is potentially several seconds
of trying between when a message triggering an outgoing webhook
arrives, and when it fails.  In the meantime, the stream the
triggering message was on may have been deleted, causing the
"Failure!" message to have no valid stream to be sent to.

Rather than raise an exception in the outgoing webhook worker, ignore
the exception and move on.
2022-11-04 14:46:17 -07:00
Alex Vandiver eb7a2f2c38 queue: Do test retries in tests.
The lambda passed to `queue_json_publish` is used if
`settings.USING_RABBITMQ` is unset -- which is only true in tests.  As
such, this pattern causes failures to never actually retry within
tests.

This behaviour has existed ever since the outgoing webhook code was
introduced in 53a8b2ac87, with no explanation.  Not passing that
argument allows tests to verify the retry behaviour when webhooks
fail.
2022-11-04 14:46:17 -07:00
Zixuan James Li 7dbd98d25c rest: Restrict access to json views via basic auth.
Previously, test cases or clients accessing /json/ views using HTTP
Basic Auth would be accepted, while we intended to only allow clients
authenticated with a session cookie to access these views.

This adds a check on the accessed path to avoid this possibility.

It seems unlikely that any API clients clients were taking advantage
of this unintended quirk; so we're not going to bother documenting
this bug fix as an API change. In any case, it should be trivial for
anyone affected to consult the documentation and then switch their
/json/foo URL to a correct /api/v1/foo URL.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-11-04 14:44:07 -07:00
Anders Kaseorg 51d1ccb064 build_emoji: Guard mutable default with read-only type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-04 14:42:33 -07:00
Alya Abbott 4316f47f8d help center: Update list of fields in full profile.
Also add documentation on what fields are shown in the mobile app.
2022-11-04 14:41:09 -07:00
Lauryn Menard f17030a802 compose-validate: Use settings config value for policy check.
Updates the check in compose validate for the organization's
policy on sending private messages to use the code/value in
settings_config, instead of the number value.
2022-11-04 14:37:45 -07:00
Lauryn Menard 6b4ab21562 narrow-banner: Exclude bots when checking org sending pms policy.
Private messages between a user and a bot are not restricted by
the organization's policy setting for sending private messages.
So, for the empty banner text, we set the default title for
a single bot for the "pm-with" narrow.

Group private messages that include a bot are restricted by
this policy setting, so those messages stay the same.

Also, since bot's aren't people, we update the text for valid
"pm-with", "sender" and "group-pm-with" operands to include the
user's full name in the title.

When there are multiple people in the "pm-with" narrow, we still
send a generic "these people" message instead of listing all the
users in the narrow.

Finally, we make the default message end in a period instead of
an exclamation mark.
2022-11-04 14:37:45 -07:00
Lauryn Menard f06143bc7c narrow-banner: Check private message policy for empty narrow title.
For narrows that focus on private messages ("is:private", "pm-with",
"group-pm-with"), we want to check the organization private message
policy and set an empty narrow title that matches that policy.

For these narrows with invalid users, we prioritize that message
for the empty narrow title, instead of the private message policy
message.

Fixes #21889.
2022-11-04 14:37:45 -07:00
Sahil Batra 1fce1c3c73 register: Handle "Pronouns" type fields for older mobile clients.
Mobile clients older than v27.192 do not support PRONOUNS type
custom profile fields, so we instead change the type of it to
SHORT_TEXT in the data sent with register response and also in
the events sent to those clients.
2022-11-04 14:31:18 -07:00
Sahil Batra b2737b0878 migrations: Add migration to migrate pronouns custom profile fields.
This commit adds a migration to migrate SHORT_TEXT type profile
fields for pronouns to recently added PRONOUNS type.
2022-11-04 14:31:18 -07:00
Julia Bichler 16bed8ef42 stream settings: Hide email portion if unsubscribed.
This hides the stream email portion in the general settings
if the user is not subscribed to the stream.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Julia Bichler 74f2d8ca7f stream settings: Allow modifying of email address.
This allows the user to modify the stream email address
by adding or removing tags before copying.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Julia Bichler 6e163bb042 stream settings: Add copy email address modal.
This moves the stream email address to a modal
and adds a copy button.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Lauryn Menard 54ad2f5266 compose-actions: Stop compose box load for invalid users with any trigger.
A user could trigger a "pm-with" narrow with an invalid user by moving
back/forward in the session, which would trigger the compose box to
open via a hash change. Updates the check to pass in any "pm-with"
narrow with an invalid user.

Also, if the compose box was active/started in the previous view, but
without any content, then we want to actively cancel/close it in the
invalid user "pm-with" narrow.
2022-11-04 14:08:25 -07:00
Lauryn Menard 09c4e2f662 compose-actions: Load compose box for PMs based on org policy.
If an organization has disabled sending private messages, we do not
want to load the compose box automatically for "pm-with" narrows.

We still open the compose box for private messages narrows with a
single bot user as this is not limited by this organization setting.

Also, if the compose box was active/started in a narrow with a bot
user, but had no content, then we want to close/cancel that in a
new narrow with a person or group.
2022-11-04 14:08:25 -07:00
Aman Agrawal 836db701aa recent: Fix cursor position after muting a topic above a PM row.
Fixes #23332

Check if col we are trying to focus exists for the row inside
`set_table_focus`.

We call `revive_current_focus` after `topics_widget` is defined
since it can be used inside it.
2022-11-04 13:59:22 -07:00
Aman Agrawal 4bd46f1cb4 recent: Simplify down arrow navigation.
Fixes #23331

Combine checks for last row between `vim_dowm` and `down_arrow`.

Check for the presence of unread counter in `set_table_focus`
directly so that it can be used in other cases as well. This is
especially useful when marking the last row in the table as read.
2022-11-04 13:59:22 -07:00