Skip to content

Commit ce05b43

Browse files
committed
Fix delete user button on admin/user page so it's enabled at the right times, and update its title attribute to be more helpful
1 parent 86246a6 commit ce05b43

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

app/assets/javascripts/admin/models/admin_user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ Discourse.AdminUser = Discourse.User.extend({
202202
},
203203

204204
deleteForbidden: function() {
205-
return (this.get('post_count') > 0);
205+
return (!this.get('can_be_deleted') || this.get('post_count') > 0);
206206
}.property('post_count'),
207207

208208
deleteButtonTitle: function() {
209209
if (this.get('deleteForbidden')) {
210-
return I18n.t('admin.user.delete_forbidden');
210+
return I18n.t('admin.user.delete_forbidden', {count: Discourse.SiteSettings.delete_user_max_age});
211211
} else {
212212
return null;
213213
}

app/models/site_setting.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class SiteSetting < ActiveRecord::Base
236236

237237
client_setting(:relative_date_duration, 14)
238238

239-
setting(:delete_user_max_age, 7)
239+
client_setting(:delete_user_max_age, 7)
240240
setting(:delete_all_posts_max, 10)
241241

242242

config/locales/client.en.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,9 @@ en:
12651265
and notified."
12661266
time_read: "Read Time"
12671267
delete: "Delete User"
1268-
delete_forbidden: "This user can't be deleted because there are posts. Delete all this user's posts first."
1268+
delete_forbidden:
1269+
one: "Users can't be deleted if they registered more than %{count} day ago, or if they have posts. Delete all posts before trying to delete a user."
1270+
other: "Users can't be deleted if they registered more than %{count} days ago, or if they have posts. Delete all posts before trying to delete a user."
12691271
delete_confirm: "Are you SURE you want to permanently delete this user from the site? This action is permanent!"
12701272
delete_and_block: "<b>Yes</b>, and <b>block</b> signups with the same email address"
12711273
delete_dont_block: "<b>Yes</b>, and <b>allow</b> signups with the same email address"

test/javascripts/fixtures/site_settings_fixtures.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)