This change introduces a new function, fetch_presence_user_setting,
to retrieve presence data of users. The function fetches data for a very
long duration by setting the `history_limit_days` parameter to 365*1000.
Fixes#31039.
If a participant is unsubscribed, we still want to show them in
the participants list, since users might expect them to be there
anyways. We also already calculate the count including the
unsubscribed participants, so this fixes a bug where the count
could be higher than the list of people.
We already have fetched all the groups that the user is
member of, so we can just check if can_invite_users_group
is included in that list of groups like we do for similar
fields like can_create_public_streams, etc.
This helps us in saving a DB query.
Fixes#32408.
Right now, the number of queries has remained the same, but when we add
more settings in the future, we won't be increasing the number of
queries when iterating over stream permission group settings.
We were using admins group as a hardcoded value for the default of
`can_remove_subscribers_group`, now we use a function to get the value
of the default group.
Previously, when a message was moved between two topics without
sending an automated notice, the ordering of these topics in the
left sidebar was not updated.
This is because the updated `max_message_id` of
`stream_topic_history` was always computed before the moved
message object's topic/channel were updated. This caused the
`max_message_id` of `stream_topic_history` which determines
the ordering of topics to always be the same.
This is fixed by making sure that the channel/topics of the objects
of the messages which were supposed to be moved were updated
before we compute this `max_message_id`
Co-authored-by: Rohan Gudimetla <rohan.gudimetla07@gmail.com>
Update the active status of new stream where the messages are moved
into, if appropriate.
Tested by deleting all messages in a stream. Running the command
to update stream status to mark it inactive. Then moving messages
into the stream to check if the status is updated correctly to active.
Quoting Alex:
This test came in during d6ef94f63f,
where the gross query was caused by a bare `select_related()`.
7d0c12aa3a
has enforced that we do not allow that construction anymore,
so IMHO this weird limit test should be removed,
rather than bumping it up every time we add something
useful to the query.
get_options_for_dropdown_widget returns an object with a stream:
StreamSubscription key, not the stream itself.
Introduced by commit fcac413138
(#26067).
Signed-off-by: Anders Kaseorg <anders@zulip.com>