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

model: Highlight stream name in reporting of moving/splitting topics. #1196

Conversation

srdeotarse
Copy link
Collaborator

@srdeotarse srdeotarse commented Apr 11, 2022

What does this PR do?
This PR highlights stream names in reporting of moving/splitting topic in footer text.

Partially fixes #1172

CZO - https://chat.zulip.org/#narrow/stream/206-zulip-terminal/topic/.E2.9C.94.20Improve.20reporting.20on.20moving.2Fsplitting.20topics.20.23T1172.20.23T1178

New CZO - https://chat.zulip.org/#narrow/stream/206-zulip-terminal/topic/Highlight.20text.20of.20reporting.20on.20moving.2Fsplitting.20topics

Tested?

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

Commit flow

Notes & Questions

Interactions

Visual changes

Screenshot (66)

@zulipbot zulipbot added size: XL area: message editing area: UI General user interface update enhancement New feature or request labels Apr 11, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from 2fba636 to e96594c Compare April 12, 2022 03:18
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 This achieves the formatting fine, but there are many ways to style text in urwid, so passing ["some string", ("named_style", " another string"), ...] is going to be simpler.

This has been discussed in the past in terms of better defining an actual type for this 'styled text' in other topics and open PRs, which you may find informative - it's rather complex due to what is possible!

One followup aspect to this is that we're casually passing in a list to report_success and this is not being flagged by mypy! We may well want to change the type of the function, but I'd like to know why mypy is not warning about this - tests appear to be passing.

zulipterminal/model.py Outdated Show resolved Hide resolved
zulipterminal/model.py Outdated Show resolved Hide resolved
@neiljp neiljp added the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Apr 14, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from e96594c to 32b0717 Compare April 14, 2022 12:09
@zulipbot zulipbot added size: L and removed size: XL labels Apr 14, 2022
@srdeotarse
Copy link
Collaborator Author

@neiljp report_success function is passing the string list to set_footer_text whose argument type is Optional[List[Any]]. Maybe that's why mypy is not showing type error.
Also, about changing the type of function report_success to Optional[List[Any]], is this what you intend?
Because passing stream_name and topic_name as a string doesn't display highlighting.

@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from 32b0717 to 28b5f9f Compare April 14, 2022 14:34
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

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

neiljp commented Apr 15, 2022

report_success function is passing the string list to set_footer_text whose argument type is Optional[List[Any]]

This doesn't explain why it wasn't showing the error previously. As per my stream comment just now, I suspect this is due to lack of typing between major modules, and we have a few options to what this 'should' be.

@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Apr 15, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from 28b5f9f to c0bbffd Compare April 16, 2022 06:07
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Apr 16, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from c0bbffd to b44090a Compare April 16, 2022 06:27
@neiljp
Copy link
Collaborator

neiljp commented Apr 20, 2022

@srdeotarse The second commit looks fine to merge, but I'm a little concerned the first does not take into account all the call sites?

@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Apr 20, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from b44090a to 8530f4e Compare April 20, 2022 01:15
@zulipbot zulipbot added size: XL and removed size: L labels Apr 20, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from 8530f4e to c2e644b Compare April 20, 2022 01:17
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Apr 20, 2022
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch 2 times, most recently from 2662ae7 to d14f51d Compare April 20, 2022 14:52
@srdeotarse srdeotarse force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from d14f51d to 648b188 Compare April 20, 2022 15:52
@srdeotarse
Copy link
Collaborator Author

@zulipbot add "PR needs review".

@zulipbot
Copy link
Member

ERROR: Label "PR needs review" already exists and was thus not added to this pull request.

Change argument type of report_success from text: str to
text: List[Union[str, Tuple[Literal["footer_contrast"], str]]].

Tests updated.
Change argument type of report_warning from text: str to
text: List[Union[str, Tuple[Literal["footer_contrast"], str]]].

Tests updated.
Change argument type of report_error from text: str to
text: List[Union[str, Tuple[Literal["footer_contrast"], str]]].

Tests updated.
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 There were a few minor points here which I've addressed myself in a quick tidy and pushed back:

  • the blacken is in an incorrect commit (but passed overall)
  • some strings had been combined (and were overly long)
  • in one case the text was already a list, that was passed to report_error

As long as this passes, which I don't expect any problems with, I'll merge shortly after :)

@@ -329,7 +329,7 @@ def _tidy_valid_recipients_and_notify_invalid_ones(
),
" to autocomplete.",
]
self.view.controller.report_error(invalid_recipients_error)
self.view.controller.report_error([invalid_recipients_error])
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 already a list.

Comment on lines 434 to 436
[f"Message is sent outside of current narrow. Press [{key}] to narrow to conversation."],
[
f"Message is sent outside of current narrow. Press [{key}] to 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 is a blacken.

@neiljp neiljp force-pushed the issue-1172-followup-highlight-moving/spliting-topic-reporting branch from 648b188 to dc5ba6b Compare April 21, 2022 20:47
@zulipbot
Copy link
Member

Hello @srdeotarse, it seems like you have referenced #1172 in your pull request description, but you have not referenced them in your commit message description(s). When you reference an issue in a commit message, it automatically closes the corresponding issue when the commit is merged.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #1172..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

Thank you for your contributions to Zulip!

@neiljp neiljp merged commit 5b43ca5 into zulip:main Apr 21, 2022
@neiljp
Copy link
Collaborator

neiljp commented Apr 21, 2022

@srdeotarse Thanks for the followup here! 🎉

@neiljp neiljp removed PR needs review PR requires feedback to proceed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Apr 21, 2022
@neiljp neiljp added this to the Next Release milestone Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: message editing area: UI General user interface update enhancement New feature or request size: XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve reporting upon moving/splitting topics
3 participants