zulip-terminal
zulip-terminal copied to clipboard
Sets current narrow marker for empty narrows.
This PR address setting labels in narrow's with no previous message. A dummy message is created for such narrows with Welcome-Bot as the author and a suitable content, This message gets discarded when the first message arrives. Further, it contains tests for the added features.
-
[x] In streams with no previous messages.

-
[x] In PM with no previous messages.

Fixes : #259, #266
NOTE: The 'enable dummy messagebox' commit appears to fail pytest (at least individually).
NOTE: The 'enable dummy messagebox' commit appears to fail pytest (at least individually).
Fixed it. An indentation error went unnoticed, causing test failure.
@neiljp FYI.
We had misunderstood the fact that create_msg_box was called when
assert(message_list != [] or not model.narrow or(
(stream_details is not None and pm_details is None) or
(pm_details is not None and stream_details is None)))
was true. Hence the above assertion made sense initially. But upon testing further I got quite a few regressions with this assert statement. Eg:
w_list = create_msg_box_list(self.model, msg_id_list)
of narrow_to_topic in core.py and
message_list = create_msg_box_list(self.model, new_ids, last_message=last_message)
of load_new_message in views.py... and some more call create_msg_box with message_list = []. This was the reason I decided to remove the assert statement.
@neiljp Thanks for patiently reviewing this again. I apologise for the delay. Here is a small CHANGELOG from the previous iteration:
- 's' and 'S' for dummy messages have been handled.
- Extra assert has been added for commit #1 tests.
- Extra assert to commit #4, to test no of times MessageBox is called.
- Re-worded the code surrounding
load_new_messagesfor dummy messages. - Added Ids for test -
test_append_message_with_dummy_previous_message - The 'Append Message' is now much simpler. (#362, #364, #365)
- The last commit is a fix for a bug which can be reproduced by sending a message:
- Login as Iago from web-app.
- Login as Cordelia from ZT.
- Ensure there is no convo between Cordelia and Iago. Dummy message should be present
- Send a message from webapp to Cordelia. Observe 'M' being marked on 'All Messages', 'All Private Messages', 'Iago user'.
Need clarification on : Change requested for commit #2
The commit flow looks pretty good, though I'm marginally wary of the 2nd commit ...
@neiljp I rebased this and resolved the conflicts. Its now good for a review. :)
Heads up @sumanthvrao, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.