actions: Split out zerver.actions.hotspots.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-04-14 14:33:30 -07:00
parent 975f5a3c2d
commit 12130da339
5 changed files with 13 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
from zerver.lib.hotspots import get_next_hotspots
from zerver.models import UserHotspot, UserProfile
from zerver.tornado.django_api import send_event
def do_mark_hotspot_as_read(user: UserProfile, hotspot: str) -> None:
UserHotspot.objects.get_or_create(user=user, hotspot=hotspot)
event = dict(type="hotspots", hotspots=get_next_hotspots(user))
send_event(user.realm, event, [user.id])