mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
hotspots: Rename and update click_to_reply.
This commit is contained in:
@@ -14,9 +14,8 @@ for discussion.
|
||||
### Step 1: Create hotspot content
|
||||
|
||||
In `zerver/lib/hotspots.py`, add your content to the `ALL_HOTSPOTS` dictionary.
|
||||
Each key-value pair in `ALL_HOTSPOTS` associates the name of the hotspot - e.g.
|
||||
`click_to_reply`, `new_topic_button`, `stream_settings` - with content
|
||||
displayed to the user.
|
||||
Each key-value pair in `ALL_HOTSPOTS` associates the name of the hotspot with the
|
||||
content displayed to the user.
|
||||
|
||||
```
|
||||
ALL_HOTSPOTS = {
|
||||
|
||||
@@ -12,10 +12,11 @@ var VIEWPORT_CENTER = 'viewport_center';
|
||||
// popover orientation can optionally be fixed here (property: popover),
|
||||
// otherwise popovers.compute_placement is used to compute orientation
|
||||
var HOTSPOT_LOCATIONS = {
|
||||
click_to_reply: {
|
||||
intro_reply: {
|
||||
element: '.selected_message .messagebox-content',
|
||||
offset_x: 0.5,
|
||||
offset_y: 0.5,
|
||||
offset_x: 0.85,
|
||||
offset_y: 0.7,
|
||||
popover: BOTTOM,
|
||||
},
|
||||
new_topic_button: {
|
||||
element: '#left_bar_compose_stream_button_big',
|
||||
|
||||
@@ -6,8 +6,8 @@ SEND_ALL = False
|
||||
|
||||
ALL_HOTSPOTS = {
|
||||
# TODO: Tag these for translation once we've finalized the content.
|
||||
'click_to_reply': {
|
||||
'title': 'Respond to a message',
|
||||
'intro_reply': {
|
||||
'title': 'Reply to a message',
|
||||
'description': 'Click anywhere on a message to reply.',
|
||||
},
|
||||
'new_topic_button': {
|
||||
@@ -36,7 +36,7 @@ def get_next_hotspots(user):
|
||||
return result
|
||||
|
||||
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 ['intro_reply', 'new_topic_button', 'stream_settings']:
|
||||
if hotspot not in seen_hotspots:
|
||||
return [{
|
||||
'name': hotspot,
|
||||
|
||||
@@ -1388,7 +1388,7 @@ class EventsRegisterTest(ZulipTestCase):
|
||||
('delay', check_int),
|
||||
]))),
|
||||
])
|
||||
events = self.do_test(lambda: do_mark_hotspot_as_read(self.user_profile, 'click_to_reply'))
|
||||
events = self.do_test(lambda: do_mark_hotspot_as_read(self.user_profile, 'intro_reply'))
|
||||
error = schema_checker('events[0]', events[0])
|
||||
self.assert_on_error(error)
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ class TestGetNextHotspots(ZulipTestCase):
|
||||
user = self.example_user('hamlet')
|
||||
hotspots = get_next_hotspots(user)
|
||||
self.assertEqual(len(hotspots), 1)
|
||||
self.assertEqual(hotspots[0]['name'], 'click_to_reply')
|
||||
self.assertEqual(hotspots[0]['name'], 'intro_reply')
|
||||
|
||||
def test_some_done_some_not(self):
|
||||
# type: () -> None
|
||||
user = self.example_user('hamlet')
|
||||
do_mark_hotspot_as_read(user, 'click_to_reply')
|
||||
do_mark_hotspot_as_read(user, 'intro_reply')
|
||||
do_mark_hotspot_as_read(user, 'stream_settings')
|
||||
hotspots = get_next_hotspots(user)
|
||||
self.assertEqual(len(hotspots), 1)
|
||||
@@ -49,13 +49,13 @@ class TestHotspots(ZulipTestCase):
|
||||
user = self.example_user('hamlet')
|
||||
self.login(user.email)
|
||||
result = self.client_post('/json/users/me/hotspots',
|
||||
{'hotspot': ujson.dumps('click_to_reply')})
|
||||
{'hotspot': ujson.dumps('intro_reply')})
|
||||
self.assert_json_success(result)
|
||||
self.assertEqual(list(UserHotspot.objects.filter(user=user)
|
||||
.values_list('hotspot', flat=True)), ['click_to_reply'])
|
||||
.values_list('hotspot', flat=True)), ['intro_reply'])
|
||||
|
||||
result = self.client_post('/json/users/me/hotspots',
|
||||
{'hotspot': ujson.dumps('invalid')})
|
||||
self.assert_json_error(result, "Unknown hotspot: invalid")
|
||||
self.assertEqual(list(UserHotspot.objects.filter(user=user)
|
||||
.values_list('hotspot', flat=True)), ['click_to_reply'])
|
||||
.values_list('hotspot', flat=True)), ['intro_reply'])
|
||||
|
||||
Reference in New Issue
Block a user