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

Made acting_user a mandatory keyword argument where present. #15958

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arpit551
Copy link
Collaborator

Made acting_user a mandatory keyword argument by using
(*, acting_user) in the functions.
Passed acting user as a kwarg while calling these functions.

Tested using ./tools/test-backend.

Made acting_user a mandatory keyword argument by using
(*, acting_user) in the functions.
Passed acting user as a kwarg while calling these functions.
@@ -862,7 +862,7 @@ def do_scrub_realm(realm: Realm, acting_user: Optional[UserProfile]=None) -> Non
event_type=RealmAuditLog.REALM_SCRUBBED)

def do_deactivate_user(user_profile: UserProfile,
acting_user: Optional[UserProfile]=None,
*, acting_user: Optional[UserProfile]=None,
Copy link
Member

Choose a reason for hiding this comment

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

So, I think if we want to make this actually mandatory, we need to remove the =None. We can also remove the Optional[ in cases where we don't expect code to need to pass None.

Copy link
Collaborator Author

@arpit551 arpit551 Jul 28, 2020

Choose a reason for hiding this comment

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

@timabbott Then I think we would have to pass acting_user=None in all the tests?. Should we have to record acting_user while running test cases?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, well, we should be thoughtful. For do_deactivate_user in particular, probably it doesn't make sense to make this change because we have a lot of tests that need to deactivate a user. But for any of the do_ functions that are only called in at most 5 places total, we should make the change I suggest.

@zulipbot
Copy link
Member

zulipbot commented Aug 7, 2020

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

@timabbott
Copy link
Member

@arpit551 quick ping on updating this.

@timabbott timabbott force-pushed the main branch 2 times, most recently from 4ec3636 to 88b200c Compare August 18, 2023 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants