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

subs: Limit editing subscribers for waiting period users. #10106

Closed
wants to merge 2 commits into from

Conversation

shubham-padia
Copy link
Member

@shubham-padia shubham-padia commented Jul 29, 2018

Commit 1:
This is a preparatory refactor for adding
UserProfile.can_subscribe_other_users.
Although there existed a test for limiting users from creating
streams at test_subs.test_user_settings_for_adding_streams,
it did not test the logic inside can_add_streams, tests have
been added to solve that issue.

Commit 2:
Does not let you subscribe other users if you are a guest or a
waiting period user.

zerver/models.py Outdated
if diff >= self.realm.waiting_period_threshold:
return True
return False

def can_create_streams(self) -> bool:
if self.realm.create_stream_by_admins_only:
return False
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This part of the commit is wrong; we need to check if the user is an admin before we check this.

Copy link
Member Author

Choose a reason for hiding this comment

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

@timabbott Made the required changes.

This is a preparatory refactor for adding
UserProfile.can_subscribe_other_users.
Although there existed a test for limiting users from creating
streams at `test_subs.test_user_settings_for_adding_streams`,
it did not test the logic inside can_add_streams, tests have
been added to solve that issue.
Does not let you subscribe other users if you are a guest or a
waiting period user.

Co-authored-by: Shubham Padia <shubhamapadia@gmail.com>
@timabbott
Copy link
Sponsor Member

Looks great, merged, thanks @shubham-padia!

@timabbott timabbott closed this Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants