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

Block/Close and wipe data for all accounts on local pod in admin UI #8249

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

tclaus
Copy link
Member

@tclaus tclaus commented Jun 7, 2021

It solves #7464 and #7463

  • It adds the SuperTux88 / JHass' script to close and wipe an account - even remote ones.
    For this function you now can search through all persons on your pod, not only the local user.
  • No external ruby code to remove spammers!
  • It changes the order of the lock/close buttons in Admin view by its severity.
  • It has some code refinements (Fixed Close / Lock/Unlock on Person and User classes)
  • It prevents an admin to remove its own admin status accidently.

Remote / Local user in users' search view
125693555-80872d90-6811-424b-9fbe-ed96cbb640d2

@tclaus
Copy link
Member Author

tclaus commented Jun 7, 2021

Uh.. "Green" with first commit!

@Flaburgan
Copy link
Member

Awesome work, thank you! One suggestion: use "Block" instead of "Close" when you're talking about remote account. Also, is the pub key of the user stored somewhere or definitely replaced? If the account is blocked indefinitely (can't be unblocked), I would warn about it in the confirm popup (you kept it for remote account, did you?).

@tclaus tclaus changed the title Close remote accounts in admin UI Close remote accounts on local pod in admin UI Jun 8, 2021
@tclaus
Copy link
Member Author

tclaus commented Jun 8, 2021

"Block" instead of "Close" when you're talking about remote account.

It was intended to 'block' external accounts and 'close' local ones. Do you think to change button names for local and remote accounts?

@tclaus tclaus changed the title Close remote accounts on local pod in admin UI Block/Close and wipe data for all accounts on local pod in admin UI Jun 8, 2021
@tclaus
Copy link
Member Author

tclaus commented Jun 9, 2021

Awesome work, thank you! One suggestion: use "Block" instead of "Close" when you're talking about remote account. Also, is the pub key of the user stored somewhere or definitely replaced? If the account is blocked indefinitely (can't be unblocked), I would warn about it in the confirm popup (you kept it for remote account, did you?).

Yes, I kept the confirmation.
About to change the buttons caption.

@tclaus
Copy link
Member Author

tclaus commented Jun 9, 2021

It is intended that the serialized_public_key is set to "BLOCKED" ( but it don't work now)

@Flaburgan
Copy link
Member

Yeah I would love confirmation on this by others @jhass @SuperTux88 what do you think, should we store the pub key somewhere in case the podmin wants to restore it, or can we go like this with irreversible block?

.label.label-danger
Closed
- else
-if person.locked_access?

Choose a reason for hiding this comment

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

  • Style/IfInsideElse: Convert if nested inside else to elsif.
  • The - symbol should have one space separating it from code

- if person.closed_account?
.label.label-danger
Closed
- else

Choose a reason for hiding this comment

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

Line contains trailing whitespace

admin_close_account_path(person.id),
method: :post, data: {confirm: t("admins.user_search.are_you_sure")},
class: "btn btn-danger btn-block"
= link_to person.owner.present? ? t("admins.user_search.wipe_and_close_account") : t("admins.user_search.wipe_and_block_account"),

Choose a reason for hiding this comment

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

Line is too long. [132/120]

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be ignored, I don't like to split the ternary into multiple lines. Other Ideas?

@@ -0,0 +1,4 @@
- if !person.closed_account?

Choose a reason for hiding this comment

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

Style/NegatedIf: Favor unless over if for negative conditions.

@tclaus
Copy link
Member Author

tclaus commented Jun 10, 2021

Changed the buttons label to "block" on external accounts and "close" for locals as it was before.
Moved the "Account Active" - label to the header. It now shows the states "Active", "Locked" and "Closed" in green, orange and red colors.

121474983-23b90380-c9c5-11eb-874c-e07a3e8527e7

121474987-2582c700-c9c5-11eb-9a68-131d0ea2112e

@SuperTux88
Copy link
Member

It is intended that the serialized_public_key is set to "BLOCKED" ( but it don't work now)

Don't do that. That's a hacky workaround from a manual script for people who know what they are doing and know how to fix it again when things breaks. It isn't guaranteed that manually changing keys won't cause problem in the future, so this is not something that should be done here (a similar hacky workaround with messing with the key in the past did break things eventually).

The clean solution would be just deny federation messages from closed accounts (maybe except AccountMigration messages, so you could still mark an account as merged even after it was closed?). And that way it then also could cleanly reject relayables (if a closed account tries to comment on a local post, like if the person is blocked).

And if the button closes an account it should say "close", not "block".

The federation blocking from closed accounts doesn't necessarily need to be done in the scope of this PR, but just don't modify the key here.

@Flaburgan
Copy link
Member

Flaburgan commented Jun 11, 2021

And if the button closes an account it should say "close", not "block".

But what does "Close" mean for a remote account?

@SuperTux88
Copy link
Member

Maybe "Close locally" or something?

The alternative would be to introduce a "blocked" state of a person and use that instead. The advantage of that would be, that it can be undone, and can be differentiated from the closed state (so people trying to visit a blocked account could get a "this account was blocked" message instead of the message that the account was closed), and we could still see when the account was closed for real (by either the user itself or the remote podmin) ... and we could even keep the "blocked" state when somebody migrates a previously blocked account to a new pod, which we probably want to block again.

@tclaus
Copy link
Member Author

tclaus commented Jun 12, 2021

@SuperTux88
Can you please give some more detailed answers on this: ?

  • Don't delete public Key,right? Remove: app/workers/wipe_account.rb:46 ?

  • The Text on button: "Close" (as before), but "Close locally" on remotes. Is is OK to name "Wipe and close". Look into the UI: it's clear which user is local or remote, so it might be redundant to name the button "close locally". See first screenshots here.

  • A "Block" state may come with a model change. Shouldn't be done in this PR.

  • Can you please give a line to

deny federation messages from closed accounts

"Closed" accounts still spill new posts or comments into the pod. But I am still not so deep into architecture to find the 'right' point in source.

@SuperTux88
Copy link
Member

Don't delete public Key,right? Remove: app/workers/wipe_account.rb:46 ?

Yes

The Text on button: "Close" (as before), but "Close locally" on remotes. Is is OK to name "Wipe and close". Look into the UI: it's clear which user is local or remote, so it might be redundant to name the button "close locally". See first screenshots here.

To people who know how diaspora works, it should be clear that "close" of a remote account doesn't allow to close the account on other pods. But people who are new to diaspora "close locally" maybe is cleaner.

A "Block" state may come with a model change. Shouldn't be done in this PR.

If a blocked state is added later, the button could be changed to use that then (and not close the account anymore) ... the button then can be renamed to "block" and blocking can also be undone then. But I think it's fine to first do it with closing in this PR and do the separate block state later (also I think this can then be merged to 0.7.x while the blocking then can go to 0.8.x because of model change ... but if it's separated the 0.7.x people can also already profit from it)

Can you please give a line to

See my comment here: #8228 (comment) (sorry, I accidentally submitted that comment too early, but it's now complete)

admin_close_account_path(person.id),
method: :post, data: {confirm: t("admins.user_search.are_you_sure")},
class: "btn btn-danger btn-block"
= link_to person.owner.present? ? t("admins.user_search.wipe_and_close_account") : t("admins.user_search.wipe_and_close_local_account"),

Choose a reason for hiding this comment

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

Line is too long. [138/120]

@tclaus
Copy link
Member Author

tclaus commented Jun 15, 2021

@SuperTux88
Changed UI facing texts.
Added person.closed_account? in Diaspora_federation.

To block receiving messages is mainly implemented in #8228 and will come into this code after merging. (Added a TODO on the lines) Will clean this lines while expecting merge conflicts then.

122005937-83911f00-cdb6-11eb-87aa-1f491c904814

@tclaus tclaus force-pushed the 7464_7463_close_remote_accounts branch from e14f182 to fea288e Compare July 14, 2021 19:36
@tclaus tclaus force-pushed the 7464_7463_close_remote_accounts branch from fea288e to 0ed7113 Compare July 14, 2021 20:19
@goobertron
Copy link

This looks very useful, and thanks for working on it, @tclaus. Just one question: are the user accounts in your screen-shots real accounts or did you invent them? If they're real accounts, would you mind blurring the personal details in your screenshots, or replacing them with invented ones? Just for personal privacy.

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.

None yet

5 participants