2017-01-24 01:48:35 +01:00
|
|
|
from zerver.models import UserProfile, UserHotspot
|
|
|
|
|
2017-04-15 05:50:59 +02:00
|
|
|
from typing import List, Text, Dict
|
|
|
|
|
|
|
|
ALL_HOTSPOTS = {
|
|
|
|
'click_to_reply': 'Click anywhere on a message to reply.',
|
|
|
|
'new_topic_botton': 'Click the "New topic" button to start a new conversation.',
|
|
|
|
'stream_settings': 'Most discussion on Zulip happens in streams. Click here to create or join additional streams.',
|
|
|
|
}
|
2017-01-24 01:48:35 +01:00
|
|
|
|
|
|
|
def get_next_hotspots(user):
|
2017-04-15 05:50:59 +02:00
|
|
|
# type: (UserProfile) -> List[Dict[str, Text]]
|
2017-01-24 01:48:35 +01:00
|
|
|
seen_hotspots = frozenset(UserHotspot.objects.filter(user=user).values_list('hotspot', flat=True))
|
2017-04-15 05:50:59 +02:00
|
|
|
for hotspot in ['click_to_reply', 'new_topic_botton', 'stream_settings']:
|
2017-01-24 01:48:35 +01:00
|
|
|
if hotspot not in seen_hotspots:
|
2017-04-15 05:50:59 +02:00
|
|
|
return [{'name': hotspot, 'description': ALL_HOTSPOTS[hotspot]}]
|
2017-01-24 01:48:35 +01:00
|
|
|
return []
|