Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display 'Message sent outside current narrow' when narrowing from all_messages and all_PMs. #1204

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

srdeotarse
Copy link
Collaborator

Follow up PR #1194

What does this PR do?
This PR displays Message sent outside current narrow even if narrowing from all_messages or all_PMs

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • New tests added (for any new behavior)
  • Passed linting & tests (each commit)

Commit flow

Notes & Questions

Interactions

CZO - https://chat.zulip.org/#narrow/stream/206-zulip-terminal/topic/.E2.9C.94.20Support.20'Narrow.20to.20current.20compose.20box.20recipient'.20.23T1194

Cases for showing success message - #1194 (comment)

Visual changes

@zulipbot zulipbot added the size: S [Automatic label added by zulipbot] label Apr 17, 2022
@srdeotarse srdeotarse changed the title Follow up - Support 'Narrow to current compose box recipient'. Display 'Message sent outside current narrow' when narrowing from all_messages and all_PMs. Apr 17, 2022
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Apr 17, 2022
@neiljp
Copy link
Collaborator

neiljp commented Apr 17, 2022

From #1194:

However, my remaining query here is whether we want to customize this logic/message a little further:
- in all-messages narrow, we never see this, but may still want to go to the conversation
- in stream (or all-PM) narrows which hold the message, we may also still want to go to the conversation
- if a message is outside the narrow, we always want to show this

I may not have been clear in this comment, but what I meant is that the two messages are not necessarily correlated since the conditions vary:

  • we still want the 'outside of narrow' behavior to stay the same
  • we want to also show the hint if not fully narrowed, ie. what the shortcut would do (though this could become too much, we'll see)

@@ -664,7 +660,6 @@ def check_narrow_and_notify(
def notify_if_message_sent_outside_narrow(
message: Composition, controller: Any
) -> None:
current_narrow = controller.model.narrow
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears a valid one-off tidy-up, but if it's not related to the bulk of the code then it's good to note it in the commit text body. More tidies => maybe it belongs in it's own commit.

@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs review PR requires feedback to proceed labels Apr 17, 2022
@srdeotarse srdeotarse force-pushed the issue-1182-followup-support-Narrow-to-current-compose-box-recipient branch from f4df59c to c4bba4f Compare April 20, 2022 16:25
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Apr 21, 2022
@neiljp
Copy link
Collaborator

neiljp commented Apr 21, 2022

@srdeotarse Left messages in stream for discussion. Also please address comments in a PR via changes or comments, or discuss in stream and reach a conclusion, before requesting review again :)

@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Apr 21, 2022
@srdeotarse srdeotarse force-pushed the issue-1182-followup-support-Narrow-to-current-compose-box-recipient branch from c4bba4f to e31d5af Compare May 5, 2022 17:13
@zulipbot zulipbot added size: M [Automatic label added by zulipbot] and removed size: S [Automatic label added by zulipbot] labels May 5, 2022
@srdeotarse srdeotarse added the PR needs review PR requires feedback to proceed label May 5, 2022
@srdeotarse srdeotarse force-pushed the issue-1182-followup-support-Narrow-to-current-compose-box-recipient branch from e31d5af to 4c48ed0 Compare May 11, 2022 17:59
@zulipbot zulipbot added size: L [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels May 11, 2022
Also applicable to title_write_box and to_write_box.
@srdeotarse srdeotarse force-pushed the issue-1182-followup-support-Narrow-to-current-compose-box-recipient branch from 4c48ed0 to af52470 Compare May 11, 2022 18:19
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srdeotarse The extra commit here looks interesting, but I'd be inclined to split it out into another PR since it's really extending the "random" help to be more contextual.

The first commit doesn't quite address one of my original points; I referenced that inline, and it likely requires the test structure to be slightly updated to indicate the output. Hopefully you'll find that easier after working on that other PR.

self.check_stream_topic_edit_txt(self.check_stream_topic_edit_txt_flag)

@asynch
def check_stream_topic_edit_txt(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor perhaps, but this handles private cases too.

Comment on lines +424 to +426
("footer", "Help(?): "),
("footer_contrast", f" {narrow_key} "),
("footer", " Narrow to conversation."),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This styling (and below) is extracted from the other location. It would be better to use a common functionality.

("footer_contrast", f" {send_key} "),
("footer", " Send a message."),
]
while check_stream_topic_edit_txt_flag:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to use a busy loop for this, if we do take this approach. This sends the zulip-term CPU usage to 100%+.

An urwid on-change signal may be better, though note that while potentially helpful, alt . will not (or shouldn't) do anything if the recipients aren't valid, so we can avoid showing the notice in that case.

and current_narrow != outer_narrow
and current_narrow != inner_narrow
):
if current_narrow != inner_narrow:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the correct condition for the narrowing hint, but please see #1204 (comment)

There are two separate conditions; one handles the 'outside of narrow' part of the message (doesn't need updating), another separate one handles the showing of the second (hint) part.

Comment on lines +342 to 343
True,
id="all_private__pm__not_notified",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to update either the test or the ids, to represent what we're expecting here.

At the very least, this change is now inconsistent: True => notified :)

However, there are different aspects being notified here, so a boolean doesn't fully encapsulate the results any more.

@neiljp neiljp removed the PR needs review PR requires feedback to proceed label May 15, 2022
@zulipbot
Copy link
Member

Heads up @srdeotarse, we just merged some commits that conflict with the changes you 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/main branch and resolve your pull request's merge conflicts accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has conflicts PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants