Skip to content

Commit b2a5683

Browse files
author
Subhasish-Behera
committed
model: Add alert_words to initial_data_to_fetch.Tests adapted.
1 parent 7819dab commit b2a5683

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ def initial_data(
653653
}
654654
],
655655
"result": "success",
656+
"alert_words": [],
656657
"queue_id": "1522420755:786",
657658
"realm_users": users_fixture,
658659
"cross_realm_bots": [

tests/model/test_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def test_register_initial_desired_events(self, mocker, initial_data):
254254
"user_settings",
255255
"realm_emoji",
256256
"zulip_version",
257+
"alert_words",
257258
]
258259
model.client.register.assert_called_once_with(
259260
event_types=event_types,

zulipterminal/model.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def __init__(self, controller: Any) -> None:
138138
# zulip_version and zulip_feature_level are always returned in
139139
# POST /register from Feature level 3.
140140
"zulip_version",
141+
"alert_words",
141142
]
142143

143144
# Events desired with their corresponding callback
@@ -177,6 +178,8 @@ def __init__(self, controller: Any) -> None:
177178

178179
self._subscribe_to_streams(self.initial_data["subscriptions"])
179180

181+
self._alert_words: List[str] = self.initial_data["alert_words"]
182+
180183
# NOTE: The date_created field of stream has been added in feature
181184
# level 30, server version 4. For consistency we add this field
182185
# on server iterations even before this with value of None.
@@ -334,6 +337,9 @@ def set_search_narrow(self, search_query: str) -> None:
334337
self.unset_search_narrow()
335338
self.narrow.append(["search", search_query])
336339

340+
def get_alert_words(self) -> List[str]:
341+
return self._alert_words.copy()
342+
337343
def unset_search_narrow(self) -> None:
338344
# If current narrow is a result of a previous started search,
339345
# we pop the ['search', 'text'] term in the narrow, before

0 commit comments

Comments
 (0)