hotspots: Add backend support for tutorial hotspots.

This commit adds the backend support for a new style of tutorial which
allows for highlighting of multiple areas of the page with hotspots that
disappear when clicked by the user.
This commit is contained in:
Amy Liu
2017-01-23 16:48:35 -08:00
committed by Tim Abbott
parent 33c130a603
commit 6f061beb46
16 changed files with 220 additions and 2 deletions

12
zerver/lib/hotspots.py Normal file
View File

@@ -0,0 +1,12 @@
from zerver.models import UserProfile, UserHotspot
from typing import List, Text
ALL_HOTSPOTS = ['welcome', 'streams', 'topics', 'narrowing', 'replying', 'get_started']
def get_next_hotspots(user):
# type: (UserProfile) -> List[Text]
seen_hotspots = frozenset(UserHotspot.objects.filter(user=user).values_list('hotspot', flat=True))
for hotspot in ALL_HOTSPOTS:
if hotspot not in seen_hotspots:
return [hotspot]
return []