-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Allow admins to "pause" a user's account #3163
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good. A few things:
- I've added some text on how to improve the wording of your messages.
- You'll need to check the users paused status in the timescale writer as well: https://github.com/metabrainz/listenbrainz-server/blob/master/listenbrainz/timescale_writer/timescale_writer.py
- How does an admin set/unset the admin flag? Right now that doesn't seem possible in the admin interface, so I think more work needs to be done there.
def _notify_user_email(db_conn, user_id,paused): | ||
user = get(db_conn, user_id, fetch_email=True) | ||
if user["email"] is None: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should log an error here, just in case.
listenbrainz/db/user.py
Outdated
return | ||
url = current_app.config['SERVER_ROOT_URL'] | ||
template = 'emails/id_paused.txt' if paused else 'emails/id_unpaused.txt' | ||
subject = 'ListenBrainz UserID Paused' if paused else 'ListenBrainz UserID Unpaused' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the strings here should say:
"Your ListenBrainz account has been paused and is not accepting incoming listens"
and
"Your ListenBrainz account has been unpaused and is accepting incoming listens"
Options: Add the account name: "Your ListenBrainz accout ([account_name]) has been..."
@@ -0,0 +1,7 @@ | |||
Hi {{ username }}! | |||
|
|||
We have paused your listenbrainz ID due to sus activities, you wont be able to import new listens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sus, lol. :)
Lets go with:
"We have paused your ListenBrainz account ([user name]) because of a problem with your account. Our community manager will reach out to you with the details as to why we took this step. Feel free to [Contact Us] if you have any questions about this."
and
"Your ListenBrainz account ([account name]) has been restore and is now accepting listens again."
listenbrainz/webserver/views/api.py
Outdated
@@ -76,6 +76,9 @@ def submit_listen(): | |||
if mb_engine and current_app.config["REJECT_LISTENS_WITHOUT_USER_EMAIL"] and not user["email"]: | |||
raise APIUnauthorized(REJECT_LISTENS_WITHOUT_EMAIL_ERROR) | |||
|
|||
if user['is_paused']: | |||
raise APIUnauthorized("user_id is paused.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" ... is paused and is currently not accepting listens. Feel free to [Contact Us] if you have any questions about this."
Problem
Right now when we see users spamming their LB feeds, the only thing we can do is delete their account, which is pretty harsh. Admins should have the ability to "pause" an account, so that is stops accepting listens and then sends the user an email about this pause.
https://tickets.metabrainz.org/browse/LB-1730
Solution