mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
UX: improve user delete error message & return correct post count. (#13282)
Post count was incorrect on admin page causing confusion when admins attempted to delete users.
This commit is contained in:
@ -420,7 +420,7 @@ class Admin::UsersController < Admin::AdminController
|
||||
rescue UserDestroyer::PostsExistError
|
||||
render json: {
|
||||
deleted: false,
|
||||
message: "User #{user.username} has #{user.post_count} posts, so they can't be deleted."
|
||||
message: I18n.t("user.cannot_delete_has_posts", username: user.username, post_count: user.posts.joins(:topic).count),
|
||||
}, status: 403
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user