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

Added stream_post_policy to the streaminfo view #1165

Merged
merged 2 commits into from
Mar 27, 2022

Conversation

mounilKshah
Copy link
Collaborator

What does this PR do?
This PR contains commit which add the stream_post_policy to the streaminfo view. Test case for the same have been added under tests/ui_tools/test_popups.py
Partial fix for #1119.

Link to discussion on chat.zulip.org:
#zulip-terminal>Adding elements to stream info

Tested?

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

Commit flow

  • Contains code for adding stream_post_policy and the updated test_popup_height function

Visual changes

Before the commt:

image

After the commit:

image

@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Mar 14, 2022
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.

@mounilKshah Good start, with lots of overlap with the other PR.

One thing we can do in these situations is, where appropriate, extract things like functions we use (or will use) in separate earlier commits in one of these PRs. If we're only adjusting existing code with no behavioral change, this is a refactor: commit. Myself or someone else with merge rights can push a few commits using git cherry-pick, making multiple PRs which depend on it easier to handle as they can both then be rebased against the new main branch. Or, of course, you could just make another PR for that and rebase once that is merged.

Comment on lines 1316 to 1322
if stream.get("stream_post_policy") is None:
if stream.get("is_announcement_only"):
stream_policy = "Only admins can post"
else:
stream_policy = "Any user can post"
else:
stream_policy = stream_posting_policy[stream.get("stream_post_policy")]
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 what I meant about the start of the other PR code, where there is something simpler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will go through it once again and make the required changes.

@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback area: UI General user interface update missing feature: user A missing feature for all users, present in another Zulip client labels Mar 18, 2022
@mounilKshah mounilKshah force-pushed the add-stream-info-elements branch from 4b2aa0a to e86548a Compare March 21, 2022 02:55
@zulipbot zulipbot added size: S [Automatic label added by zulipbot] size: L [Automatic label added by zulipbot] and removed size: L [Automatic label added by zulipbot] size: S [Automatic label added by zulipbot] labels Mar 21, 2022
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.

@mounilKshah This looks close 👍

At some point I think it'd be good to migrate to modern versions when we get the data itself like we do with some other data, but this version works well for now.

I'm unclear if the final part of #1119 is functional on the server at this point (or will be replaced by a new implementation instead), but I suspect this can be extracted into a separate issue once we know what's happening there.

As a follow-up to this it might be useful to discuss if we want to group/combine the related stream visibility properties to make it clearer.
(we could also add a way to copy a link to the stream for web usage)

@neiljp neiljp changed the title [WIP] Added stream_post_policy to the streaminfo view Added stream_post_policy to the streaminfo view Mar 22, 2022
@mounilKshah
Copy link
Collaborator Author

I'm unclear if the final part of #1119 is functional on the server at this point (or will be replaced by a new implementation instead), but I suspect this can be extracted into a separate issue once we know what's happening there.

Putting it under a separate issue seems to be a good idea to me. As you had mentioned here, we can have a separate section for the user details in the stream. Apart from the user role, we can also add details like average number of messages sent by user in the stream, number of topics the user has posted on (out of total topics in the stream), etc.

As a follow-up to this it might be useful to discuss if we want to group/combine the related stream visibility properties to make it clearer. (we could also add a way to copy a link to the stream for web usage)

This can be a good addition to the stream info!

@mounilKshah mounilKshah force-pushed the add-stream-info-elements branch from 3e6d039 to cd983d2 Compare March 23, 2022 01:50
@zulipbot zulipbot added size: S [Automatic label added by zulipbot] and removed size: L [Automatic label added by zulipbot] labels Mar 23, 2022
@mounilKshah mounilKshah force-pushed the add-stream-info-elements branch from cd983d2 to 36eb8af Compare March 23, 2022 01:56
@zulipbot zulipbot added size: L [Automatic label added by zulipbot] and removed size: S [Automatic label added by zulipbot] labels Mar 23, 2022
@neiljp
Copy link
Collaborator

neiljp commented Mar 24, 2022

@mounilKshah While I think in principal we could improve these tests, I'll be happy to merge my local slightly adjusted version if we can agree on the text for the 3 policy value, as per my message in the stream.

@neiljp neiljp added PR ready to be merged PR has been reviewed & is ready to be merged and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Mar 24, 2022
@mounilKshah mounilKshah force-pushed the add-stream-info-elements branch from 36eb8af to 80b6b50 Compare March 24, 2022 04:04
This commit adds a STREAM_POST_POLICY dictionary which maps API ids to
descriptions of who can send messages on the respective stream.
Tests modified in test_popups.py

Partial fix towards zulip#1119.
@neiljp neiljp force-pushed the add-stream-info-elements branch from 80b6b50 to d108f2d Compare March 27, 2022 01:40
@neiljp
Copy link
Collaborator

neiljp commented Mar 27, 2022

@mounilKshah Thanks for this! Merging now after some minor commit text adjustments 🎉

@neiljp neiljp merged commit 818885b into zulip:main Mar 27, 2022
@neiljp neiljp added this to the Next Release milestone May 5, 2022
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 missing feature: user A missing feature for all users, present in another Zulip client PR ready to be merged PR has been reviewed & is ready to be merged size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants