A prep PR to 34308.
Explicitly pass the fields to be updated,
This increases performance but most importantly
prevents overwriting the db-saved value of
"subscriber_count" field (added in an upcoming PR)
with the in-memory default value of 0,
since "subscriber_count" will only be updted
via the db.
Migrate some tests to use do_ functions instead of
direclty modifying the state.
Opening settings and stream settings UI was not working for guests
if they could not access all users. This was because is_person_active
did not handle inaccessible users correctly, if they were not added in
the users data, when being called in get_group_members to render
group pills.
Previously, we showed confirmation modal when user was unsubscribing
themselves from the private stream from "Unsubscribe" button in
subscribers list, even when user had the permission to subscribe
to the stream again.
This commit fixes it to not show the confirmation modal if user
has permission to subscribe again. We already have same behavior
when user tries to unsubscribe from the button present at the
right of tabs.
We no longer archive the stream when private stream becomes
vacant, so removed that part from the warning.
When a private stream becomes vacant, everyone in the organization
can lose content access to it if no one has permission to subscribe
themselves or others to the stream. So, the warning is updated to
mention this.
It wasn't clear enough the stated cause behind the following error:
"django.db.utils.OperationalError:
cannot ALTER TABLE "table_name" because it has pending trigger events"
So I add the detailed cause.
If we're in the feed for a channel and it is visibly empty
because all of the messages are in topics that have been
muted by the user, we now show an empty narrow banner that
informs the user about why the feed is empty, how to view
muted topics and links to the help center article on muting
and unmuting topics.
If the channel feed is empty and there are no messages in
muted topics, then we show the default empty narrow banner.
Fixes#31601.
Co-authored-by: Lauryn Menard <lauryn@zulip.com>
This commit updates the connection error banner label to
"Unable to connect to Zulip. Trying to reconnect soon…" when the user
manually retries the connection via the "Try now" button and when the
retry time is less than 5 seconds. And updates the countdown label of
the same banner to "Unable to connect to Zulip. Trying to reconnect in
{retry_delay_secs} seconds…".
We have filtered the group in the get_user_groups argument of
set_up_pill_typeahead. We could have done it in `set_up_combined` but
that would have made that function non-generic and specific to these two
settings. We could also have filtered it in get_all_realm_user_groups by
adding an argument on whether to exclude it or not, but that would have
been very hard to read and track. This seemed like the better of the
options we had.
Fixes https://chat.zulip.org/#narrow/channel/9-issues/topic/.22Nobody.22.20group.20in.20UI.20to.20add.20subscribers.2Fgroup.20members
This commit updates code to not prefetch can_access_all_users_group
and can_access_all_users_group__named_user_group fields using
select_related. We can just use get_realm_system_groups_name_dict
function to check if setting is set to "Everyone" group when
needed and can avoid unnecessarily fetching groups for every user
query.
This commit refactors user_has_permission_for_group_setting
to accept setting group ID instead of UserGroup object.
We only need ID in checking the permission and this helps in
further commit to avoid prefetching can_access_all_users_group
setting.
This commit removes a misleading comment regarding
'zerver_message_edit_history_id' index.
We added the index in 0679 to use in 0680 but later the 0680 migration
was reworked resulting in the index not being used in 0680.
We didn't drop the index as we expect it to be helpful for other
things.
The comment was misleading hence removed.
This works around tus/tusd#322, which in turn is caused by
aws/aws-sdk-go-v2#1816. This requires separate authentication via
service account key.
Fixes: #34186.
The tusd protocol allows DELETE requests ("terminations") at any
point, including after a file has successfully been uploaded. This
can allow tusd to remove a file from the bucket, out from under Zulip.
We use the new-in-2.7.0 pre-terminate hook to look up the file which
the client is requesting to terminate, and reject the termination if
it is a file that the Zulip database is already aware of.
These were introduced in #34340, but removing them does not seem
to affect sidebar display--and it also restores the specifity of
selectors for hiding the grouping brackets in the zoomed-in view.
To avoid restore tooltip of message from being displayed outside
the overlay, we define a boundary, outside which the tooltip
cannot exist. Popper library is smart enough to render the tooltip
correctly by respecting the provided boundary and flipping the
tooltip placement if required.
The margin doesn't scale with font size, so it looks
extra weird at small font sizes, and also the text
is already being centered with flex so we don't need
margin.
In a future commit in (#34125) we'll add a classname for the
subheader and use that to scope these rules.
This commit has no changes in CSS rules. It only moves them around.
Display a warning banner in the desktop notifications settings
when browser permissions are not granted.
Hide "Send test notification" button unless permissions are granted.
Fixes: #33222.
Earlier, we used to check whether the length of altered_user_ids was 1
and then create a dict of that user id and the streams that they were
added/removed to/from, and optimise our event sending that way. But that
was making the code harder to read.
Now, we just keep the key of user_streams as a concanated list of
user_ids and then add streams accordingly to user_streams.
Furthermore we do not check for peer_user_ids before modifying
user_streams anymore, since it is very highly unlikely that it will be
empty and if it is, send_event can handle it just fine.
Earlier, we used to send a single event for all web-public and public
streams. But public streams can have guests, which means the peer user
ids for each of them can be different based on which guests are
subscribed to which channel.
In the previous code, we were using the last stream id from another loop
to get subscribers, which was causing a lot of non-deterministic
failures in our test, since that stream id could keep on changing.
Moreover, it doesn't make much sense to use that id here.
This commit still keeps around the optimisation for public channels with
non-guest users. It will send one event for all public channels with
non-guest users, one for web public channels and for the rest of the
channels it will send an event for each channel with a different set of
peer user ids.
This seems to be required for webpack-dev-server 5.2.1, for reasons
that have not yet been made public. This relies on the
Access-Control-Allow-Origin: * header that we already set for static
content in both development and production.
Signed-off-by: Anders Kaseorg <anders@zulip.com>