mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
hotspots.py: Add SEND_ALL flag.
Used to view all hotspots in development.
This commit is contained in:
@@ -2,6 +2,8 @@ from zerver.models import UserProfile, UserHotspot
|
|||||||
|
|
||||||
from typing import List, Text, Dict
|
from typing import List, Text, Dict
|
||||||
|
|
||||||
|
SEND_ALL = False
|
||||||
|
|
||||||
ALL_HOTSPOTS = {
|
ALL_HOTSPOTS = {
|
||||||
# TODO: Tag these for translation once we've finalized the content.
|
# TODO: Tag these for translation once we've finalized the content.
|
||||||
'click_to_reply': {
|
'click_to_reply': {
|
||||||
@@ -20,6 +22,19 @@ ALL_HOTSPOTS = {
|
|||||||
|
|
||||||
def get_next_hotspots(user):
|
def get_next_hotspots(user):
|
||||||
# type: (UserProfile) -> List[Dict[str, object]]
|
# type: (UserProfile) -> List[Dict[str, object]]
|
||||||
|
|
||||||
|
if SEND_ALL:
|
||||||
|
result = []
|
||||||
|
for hotspot in ALL_HOTSPOTS:
|
||||||
|
result.append({
|
||||||
|
'name': hotspot,
|
||||||
|
'title': ALL_HOTSPOTS[hotspot]['title'],
|
||||||
|
'description': ALL_HOTSPOTS[hotspot]['description'],
|
||||||
|
'delay': 5,
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
seen_hotspots = frozenset(UserHotspot.objects.filter(user=user).values_list('hotspot', flat=True))
|
seen_hotspots = frozenset(UserHotspot.objects.filter(user=user).values_list('hotspot', flat=True))
|
||||||
for hotspot in ['click_to_reply', 'new_topic_button', 'stream_settings']:
|
for hotspot in ['click_to_reply', 'new_topic_button', 'stream_settings']:
|
||||||
if hotspot not in seen_hotspots:
|
if hotspot not in seen_hotspots:
|
||||||
@@ -29,5 +44,4 @@ def get_next_hotspots(user):
|
|||||||
'description': ALL_HOTSPOTS[hotspot]['description'],
|
'description': ALL_HOTSPOTS[hotspot]['description'],
|
||||||
'delay': 5,
|
'delay': 5,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user