Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

soft_deactivation: Our user list filter already checks long_term_idle.

Alex Vandiver3b9b34eadc56
diff --git a/zerver/lib/soft_deactivation.py b/zerver/lib/soft_deactivation.py
index eac83ec951f..8ef93e9902e 100644
--- a/zerver/lib/soft_deactivation.py
+++ b/zerver/lib/soft_deactivation.py
@@ -151,6 +151,7 @@ def add_missing_messages(user_profile: UserProfile) -> None:
"""
assert user_profile.last_active_message_id is not None
+ assert user_profile.long_term_idle
all_stream_subs = list(
Subscription.objects.filter(
user_profile=user_profile, recipient__type=Recipient.STREAM
@@ -368,17 +369,16 @@ def do_catch_up_soft_deactivated_users(users: QuerySet[UserProfile]) -> None:
users_caught_up = 0
failures = []
for user_profile in users.iterator():
- if user_profile.long_term_idle:
- with sentry_sdk.isolation_scope() as scope:
- scope.set_user({"id": str(user_profile.id)})
- try:
- add_missing_messages(user_profile)
- users_caught_up += 1
- except Exception: # nocoverage
- logger.exception(
- "Failed to catch up %d@%s", user_profile.id, user_profile.realm.string_id
- )
- failures.append(user_profile)
+ with sentry_sdk.isolation_scope() as scope:
+ scope.set_user({"id": str(user_profile.id)})
+ try:
+ add_missing_messages(user_profile)
+ users_caught_up += 1
+ except Exception: # nocoverage
+ logger.exception(
+ "Failed to catch up %d@%s", user_profile.id, user_profile.realm.string_id
+ )
+ failures.append(user_profile)
logger.info("Caught up %d soft-deactivated users", users_caught_up)
if failures:
logger.error("Failed to catch up %d soft-deactivated users", len(failures)) # nocoverage