zulip-terminal icon indicating copy to clipboard operation
zulip-terminal copied to clipboard

Sets current narrow marker for empty narrows.

Open sumanthvrao opened this issue 6 years ago • 6 comments

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. new_stream_message

  • [x] In PM with no previous messages. post2

Fixes : #259, #266

sumanthvrao avatar Jan 26 '19 11:01 sumanthvrao

NOTE: The 'enable dummy messagebox' commit appears to fail pytest (at least individually).

neiljp avatar Feb 16 '19 03:02 neiljp

NOTE: The 'enable dummy messagebox' commit appears to fail pytest (at least individually).

Fixed it. An indentation error went unnoticed, causing test failure.

sumanthvrao avatar Feb 18 '19 12:02 sumanthvrao

@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.

sumanthvrao avatar Mar 25 '19 14:03 sumanthvrao

@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_messages for 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:
  1. Login as Iago from web-app.
  2. Login as Cordelia from ZT.
  3. Ensure there is no convo between Cordelia and Iago. Dummy message should be present
  4. 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  ...

sumanthvrao avatar May 27 '19 11:05 sumanthvrao

@neiljp I rebased this and resolved the conflicts. Its now good for a review. :)

sumanthvrao avatar Jun 07 '19 16:06 sumanthvrao

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.

zulipbot avatar Apr 17 '20 00:04 zulipbot