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

User list pagination & Deactivate multiple accounts based on regex #93

Merged
merged 12 commits into from
Mar 9, 2023

Conversation

JacksonChen666
Copy link
Collaborator

@JacksonChen666 JacksonChen666 commented Feb 19, 2023

Resolves #56

Note: This PR contains more than one change:

  • User list pagination
  • (Main) Deactivate multiple accounts based on regex (depends on user list pagination)

I don't suggest squashing this.

@JacksonChen666 JacksonChen666 requested a review from JOJ0 February 19, 2023 16:43
@JacksonChen666 JacksonChen666 marked this pull request as draft February 19, 2023 16:44
@JacksonChen666 JacksonChen666 force-pushed the deactivate-regex branch 2 times, most recently from 83f23af to 394f123 Compare February 19, 2023 16:58
it's advanced because most people (or even everyone) is unlikely going
to need that option. however, it could improve the amount of time spent
on looking for something to no avail (code is faster than my SQLite
synapse API requests for listing users)
@JacksonChen666 JacksonChen666 marked this pull request as ready for review February 19, 2023 17:10
Copy link
Owner

@JOJ0 JOJ0 left a comment

Choose a reason for hiding this comment

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

Great addition to synadm and I'm very happy we finally have a neat implementation for pagination ourselves. It will come in handy in the future often!! Thanks! Great work!

synadm/api.py Show resolved Hide resolved
synadm/cli/user.py Outdated Show resolved Hide resolved
synadm/cli/user.py Outdated Show resolved Hide resolved
synadm/cli/user.py Outdated Show resolved Hide resolved
synadm/cli/user.py Outdated Show resolved Hide resolved
synadm/api.py Outdated Show resolved Hide resolved
@JacksonChen666 JacksonChen666 requested a review from JOJ0 February 22, 2023 17:00
synadm/api.py Outdated Show resolved Hide resolved
synadm/api.py Show resolved Hide resolved
@JacksonChen666
Copy link
Collaborator Author

...not sure how this PR stalled

@JOJ0
Copy link
Owner

JOJ0 commented Mar 4, 2023

...not sure how this PR stalled

Some change requests here: #93 (comment)

Also unanswered questions around how the streamlining with --paginate (notice send cmd) and --batch-size should be solved: #93 (comment)

Two ways: Use your idea of option name or use that one of notice send command. Either way, I'd like to streamline behaviour between synadm commands. It is still one software that should follow similar usability principles. That's one of the main goals of the project. -> Yes, will be added to contributing.md as well ;-)

Thanks!

@JacksonChen666
Copy link
Collaborator Author

JacksonChen666 commented Mar 4, 2023

Also unanswered questions around how the streamlining with --paginate (notice send cmd) and --batch-size should be solved.

--paginate is not super obvious about what is does. --batch-size is a little more obvious (to me) which is why I chose it.

(Are we discussion option names and assuming the user won't use the help function? Maybe)

open marathons is then new line, new line then closing parenthesis.
@JOJ0
Copy link
Owner

JOJ0 commented Mar 4, 2023

Also unanswered questions around how the streamlining with --paginate (notice send cmd) and --batch-size should be solved.

--paginate is not super obvious about what is does. --batch-size is a little more obvious (to me) which is why I chose it.

(Are we discussion option names and assuming the user won't use the help function? Maybe)

We are discussing that it is bad UI design if the same thing is named differently throughout the project.

Certainly we assume that our valued users will use --help.

We at least try to achieve a "cohesive experience" when it is possible. Certainly there will be places where we were not able to follow that rule or we just missed the opportunity. In that case: Let's try harder.

makes it consistent with notice send
@JacksonChen666
Copy link
Collaborator Author

JacksonChen666 commented Mar 4, 2023

I'm not sure what the option is suggested to be, so I changed batch-size to paginate to be consistent with the notice send command. Feel free to git revert that commit if you don't want it like that but instead as batch-size.

@JOJ0
Copy link
Owner

JOJ0 commented Mar 5, 2023

I'm not sure what the option is suggested to be, so I changed batch-size to paginate to be consistent with the notice send command. Feel free to git revert that commit if you don't want it like that but instead as batch-size.

Honestly, I would prefer option --batch-size because as you say it definitely is very self-explanatory and thus a perfect choice IMO but I would leave the final choice to you since if we go down that route of strealining, there is some things to consider:

  • The original submitter of the notice send command, IIRC correctly, decided for --paginate. IIRC there was some discussion around easily being confusable with the global option --batch if it would be used for something like batch size of messages to send out at once. It was in the very early "design phase" where not even a PR was existing yet and it was brainstormed how a command for sending "server notices" could look like. It was a lively and productive discussion but probably hard to follow for reading through it. Just in case you're interested: https://matrix.to/#/!mLATeUxylgHiofUzHJ:peek-a-boo.at/$wEevQ52VnvV7idh8H-WMsIhu5g4Ge3gLIBsVjaUA0kY?via=jacksonchen666.com&via=matrix.org&via=envs.net
  • Anyway, the submitter decided for --paginate, while in the meantime I decided following those thoughts of the submitter, that alternative names for --batch would be good, which I brought in with Add aliases to --batch global flag and #77
  • As I see it now the confusion of a global --batch/--non-interactive option with a subcommand-dedicated --batch-size option is not too big. Only thing to be careful is probably to not name something just batch in the subcommand's code since we use that for the global flag often.

So long story short I would appreciate if you would go down the road of naming it --batch-size but not forget to change this in subsequent PR for notice send as well.

I would like to start a discussion in #synadm:peek-a-boo.at whether or not people think that such a change would be appreciated or worthwhile, that is a good idea too. I can assist with that if you want.

An alternative way would be to just pragmatically add both options --batch-size as well as --paginate. In a subsequent PR or actually probably it would work if just being added to this one: Add --batch-size as an alias to the notice send command as well.

Also to further reduce the confusion of our global --batch flag with something in the furture using the word batch I suggest we open an issue reminding us to rename all the variables named self.batch, batch, ... to something more distinctive. I suggest: non_interactive or no_confirm. I'm opting to do that change but please help me by leaving a note in an issue! Thanks a lot!

There you have some backstory and I hope it helps moving on in the right direction. Streamlining is not always easy, at least not as easy as it sometimes seems, but it definitely is, that was my experience in the past, much appreciated by users.

@JOJ0 JOJ0 self-assigned this Mar 8, 2023
@JOJ0
Copy link
Owner

JOJ0 commented Mar 8, 2023

Hi @JacksonChen666, is it ok for you if I hijack this PR/branch? I would like to have both options: --batch-size and --paginate.

I have a pending change that tries to reduce a possible confusion with what we called "batch mode" so far in PR #102

@JacksonChen666
Copy link
Collaborator Author

JacksonChen666 commented Mar 8, 2023 via email

command definition.

Also add a short option `-p` and a tiny formatting fix.
Copy link
Owner

@JOJ0 JOJ0 left a comment

Choose a reason for hiding this comment

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

Alright, I'm just reviewing this quickly myself. Die some playing around / testing with the commands. Hope I didn't miss anything but I think we are good to go.

synadm/cli/user.py Show resolved Hide resolved
@JOJ0 JOJ0 merged commit bc25adf into JOJ0:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deactivating multiple users at once
2 participants