Commit Graph

52198 Commits

Author SHA1 Message Date
Ujjawal Modi a361c23aac alert_words: Refactor the code to flush alert_words cache.
Subsequent commits will add "on_delete=models.RESTRICT"
relationships, which will result in the AlertWord
objects being deleted after Realm has been deleted from
the database.

In order to handle this, we update realm_alert_words_cache_key,
realm_alert_words_automaton_cache_key, and flush_realm_alert_words
functions to accept realm_id as parameter instead of realm
object, so that  the code for flushing the cache works even
after the realm is deleted. This change is fine because
eventually only realm_id is used by these functions and there
is no need of the complete realm object.
2023-06-28 18:03:32 -07:00
Ujjawal Modi f7346f36fc attachments: Refactor code for flushing used_upload_space cache.
Subsequent commits will add "on_delete=models.RESTRICT"
relationships, which will result in the Attachment
objects being deleted after Realm has been deleted from
the database.

In order to handle this, we update
get_realm_used_upload_space_cache_key function to accept
realm_id as parameter instead of realm object, so that
the code for flushing the cache works even after the
realm is deleted. This change is fine because eventually
only realm_id is used by this function and there is no
need of the complete realm object.
2023-06-28 18:03:32 -07:00
Ujjawal Modi 535a088d0b bots: Refactor code for flushing bots cache.
Subsequent commits will add "on_delete=models.RESTRICT"
relationships, which will result in the UserProfile
objects being deleted after Realm has been deleted from
the database.

In order to handle this, we update bot_dicts_in_realm_cache_key
function to accept realm_id as parameter instead of realm
object, so that  the code for flushing the cache works even
after the realm is deleted. This change is fine because
eventually only realm_id is used by this function and there is
no need of the complete realm object.
2023-06-28 18:03:32 -07:00
Ujjawal Modi fd0434a052 realm_emoji: Refactor code for flushing realm_emoji cache.
Subsequent commits will add "on_delete=models.RESTRICT"
relationships, which will result in the RealmEmoji
objects being deleted after Realm has been deleted from
the database.

In order to handle this, we update get_realm_emoji_dicts,
get_realm_emoji_cache_key, get_active_realm_emoji_cache_key,
get_realm_emoji_uncached and get_active_realm_emoji_uncached
functions to accept realm_id as parameter instead of realm
object, so that the code for flushing the cache works even
after the realm is deleted. This change is fine because
eventually only realm_id is used by these functions and
there is no need of the complete realm object.
2023-06-28 18:03:32 -07:00
Ujjawal Modi 1be30d85ce import_realm: Create Stream, UserGroup and Realm in a transaction.
Make the import of `Realm`, `Stream` and `UserGroup` objects be
done in single transaction, to make the import process in general
more atomic.

This also removes the need to temporarily unset the Stream references
on the Realm object.  Since Django creates foreign key constraints
with `DEFERRABLE INITIALLY DEFERRED`, an insertion of a Realm row can
reference not-yet-existing Stream rows as long as the row is created
before the transaction commits.

Discussion - https://chat.zulip.org/#narrow/stream/101-design/topic/New.20permissions.20model/near/1585274.
2023-06-28 18:03:32 -07:00
Sahil Batra 74af803ec3 tests: Use check_add_user_group to create groups.
This commit changes the code in test_user_groups.py to use
check_add_user_group function to create user groups instead
of directly using django ORM to make sure that settings
would be set to the correct defaults in further commits.
2023-06-28 18:03:32 -07:00
Sahil Batra 138a67d97e types: Add default_group_name field to GroupPermissionSetting type.
This commit adds default_group_name field to GroupPermissionSetting
type which will be used to store the name of the default group for
that setting which would in most cases be one of the role-based
system groups. This will be helpful when we would have multiple
settings and we would need to set the defaults while creating
realm and streams.
2023-06-28 18:03:32 -07:00
Zixuan James Li b6d1e56cac queue_processors: Avoid queue worker timeouts in tests.
For tests that use the dev server, like test-api, test-js-with-puppeteer,
we don't have the consumers for the queues. As they eventually timeout,
we get unnecessary error messages. This adds a new flag, disable_timeout,
to disable this behavior for the test cases.
2023-06-28 11:06:24 -07:00
Lalit a686c0cc02 docs: Add documentation for delete emoji endpoint.
This endpoint was previously marked as `intentionally_undocumented`
but that was mistake.

Removed `intentionally_undocumented` and added proper documentation
with valid `python_example` for this Endpoint.

Fixes: #24084
2023-06-28 10:23:47 -07:00
Lauryn Menard 0d1c43d1d9 server-events: Remove unused home_view_loaded.zulip event trigger.
In commit 92ad988144, we removed the local echo code that tried
to re-render locally echoed messages that were rendered right before
a server/browser restart. These changes removed the only event
triggered by `"home_view_loaded.zulip"`.

This removes the remaining `"home_view_loaded.zulip"` event trigger
in web/src/server_events.js since it no longer triggers any events.
2023-06-27 18:04:04 -07:00
Alex Vandiver bc3c2476d2 stripe: Nicknames are optional on plans. 2023-06-27 18:02:50 -07:00
Zixuan James Li 8b42f7ccfa test_user_groups: Check for updates/deletion of the user groups.
This verifies that updates of the user group name/description are
correctly done by doing additional queries. This also empathsizes on
checking that the state before and after API calls are indeed different.
2023-06-27 18:02:05 -07:00
Zixuan James Li 8493440049 test_user_groups: Check for subgroup membership changes.
This extracts a helper to test if changes are actually made to the
subgroups via the API.
2023-06-27 18:02:05 -07:00
Zixuan James Li d37f309a3c test_user_groups: Extract user memberships helper.
We extract the checks needed for user membership changes into a method,
verifying that the members of the user group are matching the expected
values exactly.
2023-06-27 18:02:05 -07:00
Zixuan James Li 4adb9dd2bc test_user_groups: Clean up typos. 2023-06-27 18:02:05 -07:00
evykassirer c4de46d910 navbar: Fix background-color inconsistency in dark theme. 2023-06-27 11:28:49 -07:00
Lauryn Menard 6f58994ef4 openapi-tests: Add coverage for validating example events.
Adds testing coverage for validating the documented examples for
each event in the `api/get-events` endpoint documentation.

This will help us catch basic typos / mistakes when adding new
event examples. And if fields / objects are removed or modified
for existing events in the API, then failing to update the
examples for those changes will also be caught by this additional
test coverage.

Adding new fields / objects to existing event schemas without
updating the example will not be caught unless the new field
is marked as required in the documentation.
2023-06-27 11:27:38 -07:00
Lauryn Menard b1b0296a21 api-docs: Update subscription peer_add and peer_remove events.
Updates the example for both of these events in the documentation
to be the current version. These were missed when the feature
level 35 updates were made to the API specification for these
events, see commit noted below.

Also, for completeness, adds Changes notes for feature level 35
and feature level 19, for these events.

The feature level 35 changes were made in commit 7ff3859136.
The feature level 19 changes were made in commit 00e60c0c91.
2023-06-27 11:27:38 -07:00
Lauryn Menard a810b58418 api-docs: Correct example for drafts remove event.
Corrects what seems to have been a typo when the documentation was
added for drafts in commit 6fee946a43.
2023-06-27 11:27:38 -07:00
Lauryn Menard 5ac37a9f75 api-docs: Correct example for realm_bot delete event.
Updates the example for the realm_bot delete event so that it does
not have a full_name field.

This was a pre-existing error in the documentation when the remove
and delete events shared the same event documentation. They were
separated in the documentation in commit fae3f1ca53.

The difference between these two events was noted when they were
added to `event_schema.py` in commit 385050de20.
2023-06-27 11:27:38 -07:00
Lauryn Menard 5939ffffee api-docs: Correct example/description for update_message_flags remove.
Updates the documented example for the update_message_flags remove
event so that the message ID that is the key for the object is
correctly shown as a string.

Also updates the description of these objects so that it is
rendered correctly in the documentation.
2023-06-27 11:27:38 -07:00
Lauryn Menard 2edcfb65bb api-docs: Remove sender_short_name from message event example.
Removes the `sender_short_name` from the example for the message
event in `/get-events`.

Also, to make this complete, adds Changes notes for the feature
level 26 changes that were made to the message objects returned
in the message events for `/get-events` and in the messages
array for the `/get-messages` response.

The field was originally removed from message objects in
commit b375581f58.
2023-06-27 11:27:38 -07:00
Lauryn Menard 89794ce47c api-docs: Update mute and unmute user endpoint documentation.
Updates the main descriptions for the mute a user and unmute a
user endpoint documentation. Also, revises the `muted_user_id`
parameter description and changes note for feature level 188.

The original feature level changes were made in #26005.
2023-06-27 11:24:30 -07:00
Daniil Fadeev 74c8852233 giphy: Set focus to the query input after clearing it.
These changes improve keyboard navigation in the Giphy popover.

Fixes: #26096.
2023-06-27 11:06:28 -07:00
Alex Vandiver 21aeb4a040 slack: Handle the special case of permissions denied on team.info call.
This is a follow-up to 4c8915c8e4, for
the case when the `team:read` permission is missing, which causes the
`team.info` call itself to fail.  The error message supplies
information about the provided and missing permissions -- but it also
still sends the `X-OAuth-Scopes` header which we normall read, so we can
use that as normal.
2023-06-27 11:04:41 -07:00
Lauryn Menard 0d16683c5f rendered-markdown: Update reference to "private message" in comment.
Updates a code comment to use "direct message" instead of "private
message".
2023-06-27 11:03:17 -07:00
Karl Stolley 0b596159c1 docs: Adjust wording and phrasing for clarity. 2023-06-27 09:43:22 -05:00
Karl Stolley 2720e0e35a docs: Correct minor wording and mechanics. 2023-06-27 09:43:22 -05:00
Lauryn Menard e1c809a71e api-docs: Clarify what topics are returned by `get-stream-topics`.
Updates the main description for the `get-stream-topics` endpoint
so that it is clear that the topics for private streams with protected
history are limited to the topics / messages the user has access to.

And updates that documentation and the help center documentation for
bot permissions / abilities, to clarify that bots have the same
restriction and can only access messages / topics that are sent after
the bot (not the bot's owner) subscribed to the stream.
2023-06-26 20:26:30 -07:00
Satyam Bansal 92a1e3464d
integrations: Allow null pull request review body in GitHub Integration.
There are instances in which the pull request review body
can be null.

Fixes #26055.
2023-06-26 11:35:14 -07:00
Evy Kassirer adcf088740
filter: Rename describe to search_description_as_html.
Changing this since wobbly naming on HTML variables is dangerous.
2023-06-26 11:11:17 -07:00
Matthew Volpe 466db56118
docs: Fix missing space in setup-recommended.md.
Previously, there was a missing space in setup-recommended.md that I noticed when reading it.
2023-06-26 11:10:29 -07:00
Lauryn Menard c8b04fc562 web-shared: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/shared`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 85096cfb4d web-styles: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/styles`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 73e5812831 node-tests: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/tests`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 7c47616ffa web-e2e-tests: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/e2e-tests`
directory to instead use "direct messages" or "DM".
2023-06-26 11:07:28 -07:00
Lauryn Menard 4d3d9bcefa web-src: Update comments with "private message" or "PM".
Updates comments in files the `web/src` directory to use "direct
message" instead of "private message" or "PM".
2023-06-26 11:07:28 -07:00
Lauryn Menard 5be0f80135 recent-topics-ui: Rename constant for direct message columns.
Renames constant for the number of direct message columms from
`MAX_SELECTABLE_PM_COLS` to `MAX_SELECTABLE_DIRECT_MESSAGE_COLS`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 842623c294 unread: Update class name for unread direct message counter.
Renames the class name in `web/src/unread.js` from `UnreadPMCounter`
to `UnreadDirectMessageCounter` and renames the associated instance
of `unread_pm_counter` to `unread_direct_message_counter`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 4b2b278a53 dm-conversations: Update direct message data structure name.
Updates data structure class name in `web/src/pm_conversations.js`
from `RecentPrivateMessages` to `RecentDirectMessages`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 3c6d283aa9 compose-actions: Update trigger for composing a new direct message.
Updates the trigger in the compose box from "new private message"
to "new direct message".
2023-06-26 11:07:28 -07:00
Satyam Bansal 0945f2dee6 integrations: Separate issue labeled events in GitHub Integration.
This commit creates separate events for issue labeled and
unlabeled notifications. This allows the end-users to choose
whether they want these notifications or not.

Fixes #25789.
2023-06-26 11:04:32 -07:00
Satyam Bansal 842e9d1aca integrations: Improve GitHub issue labeled and unlabeled notifications.
Earlier, the notifications had no information about the labels
being added or removed.
2023-06-26 11:04:32 -07:00
Satyam Bansal 8fc28be8ca integrations: Add issue unlabeled fixture to GitHub Integration. 2023-06-26 11:04:32 -07:00
Satyam Bansal b4674892a4 integrations: Add issue labeled fixture to GitHub Integration. 2023-06-26 11:04:32 -07:00
David Rosa ca4e73b663 docs: Rename private message -> direct message in Spanish style guide.
- Updates instances of "private message" and "PM", improving wording
  and translating to Spanish where needed.
2023-06-26 11:02:34 -07:00
Zixuan James Li dd3fad4b30 mute users: Remove leftover check for muting bot users.
This was missed in #26005. The user popover button does not appear
for bot users. We complete the TODO here and simplify the
calculation for show_manage_menu so that we always show it if not in
spectator view and not showing the popover for self.
2023-06-26 11:01:40 -07:00
evykassirer 87649ddbab condense: Replace $.fn.height with using the DOM API.
This increases performance by at least 10x. See discussion
on CZO for more details:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/resize.20undo.20redo.20condense/near/1581598
2023-06-26 10:59:53 -07:00
evykassirer ca6e93ac7d condense: Remove _message_content_height_cache.
Since `scrollHeight` is very quick, we don't need
the cache anymore, and the code is easier to reason
about without it.

Profiling checks described on CZO here:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/resize.20undo.20redo.20condense/near/1581520
2023-06-26 10:59:53 -07:00
evykassirer 43b18eabf1 condense: Avoid layout thrashing.
More information on layout thrashing
[here](https://web.dev/avoid-large-complex-layouts-and-layout-thrashing/#avoid-layout-thrashing).
2023-06-26 10:59:53 -07:00