mirror of https://github.com/zulip/zulip.git
do_update_message_flags: Accept a Client object.
This is important for upcoming logging changes.
This commit is contained in:
parent
0e44010976
commit
c60f197fde
|
@ -3614,6 +3614,7 @@ def do_mark_stream_messages_as_read(user_profile: UserProfile,
|
|||
return count
|
||||
|
||||
def do_update_message_flags(user_profile: UserProfile,
|
||||
client: Client,
|
||||
operation: str,
|
||||
flag: str,
|
||||
messages: Optional[Sequence[int]]) -> int:
|
||||
|
|
|
@ -749,7 +749,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||
)
|
||||
user_profile = self.example_user('hamlet')
|
||||
events = self.do_test(
|
||||
lambda: do_update_message_flags(user_profile, 'add', 'starred', [message]),
|
||||
lambda: do_update_message_flags(user_profile, get_client("website"), 'add', 'starred', [message]),
|
||||
state_change_expected=False,
|
||||
)
|
||||
error = schema_checker('events[0]', events[0])
|
||||
|
@ -762,7 +762,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||
('operation', equals("remove")),
|
||||
])
|
||||
events = self.do_test(
|
||||
lambda: do_update_message_flags(user_profile, 'remove', 'starred', [message]),
|
||||
lambda: do_update_message_flags(user_profile, get_client("website"), 'remove', 'starred', [message]),
|
||||
state_change_expected=False,
|
||||
)
|
||||
error = schema_checker('events[0]', events[0])
|
||||
|
@ -781,7 +781,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||
)
|
||||
|
||||
self.do_test(
|
||||
lambda: do_update_message_flags(user_profile, 'add', 'read', [message]),
|
||||
lambda: do_update_message_flags(user_profile, get_client("website"), 'add', 'read', [message]),
|
||||
state_change_expected=True,
|
||||
)
|
||||
|
||||
|
|
|
@ -974,7 +974,7 @@ def update_message_flags(request: HttpRequest, user_profile: UserProfile,
|
|||
messages: List[int]=REQ(validator=check_list(check_int)),
|
||||
operation: str=REQ('op'), flag: str=REQ()) -> HttpResponse:
|
||||
|
||||
count = do_update_message_flags(user_profile, operation, flag, messages)
|
||||
count = do_update_message_flags(user_profile, request.client, operation, flag, messages)
|
||||
|
||||
target_count_str = str(len(messages))
|
||||
log_data_str = "[%s %s/%s] actually %s" % (operation, flag, target_count_str, count)
|
||||
|
|
Loading…
Reference in New Issue