mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
UX: display 'merge' button in all non-staff user profiles.
This commit is contained in:
parent
c8fed90e4e
commit
e5c44f6dcf
@ -683,6 +683,9 @@
|
||||
icon="trash-alt"
|
||||
class="btn-danger"
|
||||
action=(action "destroy")}}
|
||||
{{/if}}
|
||||
|
||||
{{#if model.can_be_merged}}
|
||||
{{d-button label="admin.user.merge.transfer_and_delete"
|
||||
icon="trash-alt"
|
||||
class="btn-danger"
|
||||
|
@ -476,7 +476,7 @@ class Admin::UsersController < Admin::AdminController
|
||||
target_username = params.require(:target_username)
|
||||
target_user = User.find_by_username(target_username)
|
||||
|
||||
guardian.ensure_can_merge_user!(@user, target_user)
|
||||
guardian.ensure_can_merge_users!(@user, target_user)
|
||||
|
||||
if user = UserMerger.new(@user, target_user, current_user).merge!
|
||||
render json: success_json.merge(merged: true, user: user)
|
||||
|
@ -18,6 +18,7 @@ class AdminDetailedUserSerializer < AdminUserSerializer
|
||||
:can_delete_all_posts,
|
||||
:can_be_deleted,
|
||||
:can_be_anonymized,
|
||||
:can_be_merged,
|
||||
:full_suspend_reason,
|
||||
:suspended_till,
|
||||
:silence_reason,
|
||||
@ -74,6 +75,10 @@ class AdminDetailedUserSerializer < AdminUserSerializer
|
||||
scope.can_anonymize_user?(object)
|
||||
end
|
||||
|
||||
def can_be_merged
|
||||
scope.can_merge_user?(object)
|
||||
end
|
||||
|
||||
def topic_count
|
||||
object.topics.count
|
||||
end
|
||||
|
@ -76,8 +76,12 @@ module UserGuardian
|
||||
is_staff? && !user.nil? && !user.staff?
|
||||
end
|
||||
|
||||
def can_merge_user?(source_user, target_user)
|
||||
is_admin? && !source_user.nil? && !source_user.staff? && !target_user.nil?
|
||||
def can_merge_user?(user)
|
||||
is_admin? && !user.nil? && !user.staff?
|
||||
end
|
||||
|
||||
def can_merge_users?(source_user, target_user)
|
||||
can_merge_user?(source_user) && !target_user.nil?
|
||||
end
|
||||
|
||||
def can_reset_bounce_score?(user)
|
||||
|
Loading…
Reference in New Issue
Block a user