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

Stream info view #1127

Closed
wants to merge 1 commit into from
Closed

Stream info view #1127

wants to merge 1 commit into from

Conversation

kingjuno
Copy link
Collaborator

@kingjuno kingjuno commented Aug 22, 2021

What does this PR do?
Include more elements to StreamInfo View like :

  • Stream id
  • Type of the stream (Public/Private)
  • Posting policy
  • Availability of history
  • User's role within the stream

image

Also fixed convert-unicode-emoji-data from displaying wrong file name when zulipterminal.unicode_emoji_dict isn't downloaded.

Tested?

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

@zulipbot zulipbot added the size: M [Automatic label added by zulipbot] label Aug 22, 2021
@zee-bit
Copy link
Member

zee-bit commented Aug 22, 2021

@kingjuno The second commit seems unrelated to the title of the PR. Could you please extract that commit into a new PR?

Copy link
Member

@zee-bit zee-bit left a comment

Choose a reason for hiding this comment

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

@kingjuno Thanks for working on this. This is a nice addition to our StreamInfo view and it works fine. 👍

I've mostly focused on the code for this review and below are a few points for the first iteration. When working on features that leverage a new field from API responses, it's always important to check if that field was added sometimes later in the server, in which case, you'd need to gracefully handle it for older server versions too. Other than that, rest are minor points, and considering this is your first PR in this repo, Great work! 🎉

zulipterminal/ui_tools/views.py Outdated Show resolved Hide resolved
Comment on lines 1335 to 1341
stream_posting_policy = {
1: "Any user can post",
2: "Only administrators can post",
3: "Only full members can post",
4: "Only moderators can post",
}
posting_policy = stream_posting_policy[stream["stream_post_policy"]]
Copy link
Member

Choose a reason for hiding this comment

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

As per API docs, the stream_post_policy field was added in Server version 3.0; there's no feature level mentioned there, so you can either query that in the #api-design stream in chat.zulip.org or you could just check if the field is absent so use the older is_announcement_only field.

tests/ui_tools/test_popups.py Outdated Show resolved Hide resolved
zulipterminal/ui_tools/views.py Outdated Show resolved Hide resolved
zulipterminal/ui_tools/views.py Outdated Show resolved Hide resolved
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.

@kingjuno This looks good - thanks for giving this a go 👍

As @zee-bit mentions, some of these fields are dependent on the server version, so may fail badly depending on which server one uses (we claim to support 2.1+ if you check the README). Due to that you may want to limit this first PR to those which are fully backwards compatible to that point, to avoid needing to get into version/feature detection initially.

For tests, as I note, you've made the existing tests (and parts of tests - "case"s) pass, but there are not yet new ones which cover the range of new values which are being output. It's true that the existing test only examines the height, which doesn't give much detail, but perhaps we can improve upon that.

Comment on lines 1335 to 1340
stream_posting_policy = {
1: "Any user can post",
2: "Only administrators can post",
3: "Only full members can post",
4: "Only moderators can post",
}
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 want to extract this into ui_mappings.py when we add this feature - which is dependent upon server version.

tests/ui_tools/test_popups.py Outdated Show resolved Hide resolved
Comment on lines 226 to 228
"stream_post_policy": 1,
"history_public_to_subscribers": True,
"role": 20,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This updates the data for the general stream, but not for other similar test data - which we likely should do too.

@neiljp neiljp added area: UI General user interface update missing feature: user A missing feature for all users, present in another Zulip client PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Aug 22, 2021
@kingjuno kingjuno force-pushed the StreamInfo_view branch 3 times, most recently from 0fc646b to a707463 Compare August 25, 2021 06:03
@zulipbot zulipbot added size: XL [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels Aug 25, 2021
@zulipbot zulipbot added size: M [Automatic label added by zulipbot] and removed size: XL [Automatic label added by zulipbot] labels Aug 25, 2021
@kingjuno kingjuno force-pushed the StreamInfo_view branch 2 times, most recently from 1e88d7a to 8ee1e89 Compare August 25, 2021 15:09
@neiljp
Copy link
Collaborator

neiljp commented Aug 26, 2021

@kingjuno Thanks for working on this 👍 I just made some very slight alterations to your commit and merged it manually as 4509d26 🎉

You're welcome to continue with the other aspects we discussed and that you started including here.
Another aspect is whether we could simplify the popup info into multiple sections, a little like the web app does, which we can discuss in the stream if you like :)

@zulipbot
Copy link
Member

Heads up @kingjuno, 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/main branch and resolve your pull request's merge conflicts accordingly.

@neiljp neiljp closed this Aug 26, 2021
@neiljp neiljp added this to the Next Release milestone Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UI General user interface update has conflicts missing feature: user A missing feature for all users, present in another Zulip client PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback size: M [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants