soft_deactivation: Add a helper for queuing soft_reactivation.

Signed-off-by: Zixuan James Li <359101898@qq.com>
This commit is contained in:
Zixuan James Li 2022-05-26 11:26:43 -04:00 committed by Tim Abbott
parent bb6bd900cd
commit 3e95b59f2e
1 changed files with 9 additions and 5 deletions

View File

@ -377,6 +377,14 @@ def get_soft_deactivated_users_for_catch_up(filter_kwargs: Any) -> List[UserProf
return users_to_catch_up return users_to_catch_up
def queue_soft_reactivation(user_profile_id: int) -> None:
event = {
"type": "soft_reactivate",
"user_profile_id": user_profile_id,
}
queue_json_publish("deferred_work", event)
def soft_reactivate_if_personal_notification( def soft_reactivate_if_personal_notification(
user_profile: UserProfile, unique_triggers: Set[str], mentioned_user_group_name: Optional[str] user_profile: UserProfile, unique_triggers: Set[str], mentioned_user_group_name: Optional[str]
) -> None: ) -> None:
@ -400,8 +408,4 @@ def soft_reactivate_if_personal_notification(
if not private_message and not personal_mention: if not private_message and not personal_mention:
return return
event = { queue_soft_reactivation(user_profile.id)
"type": "soft_reactivate",
"user_profile_id": user_profile.id,
}
queue_json_publish("deferred_work", event)