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

This commit is contained in:
Neil Lalonde
2013-08-08 12:34:42 -04:00
parent 86246a64eb
commit ce05b43c1d
4 changed files with 7 additions and 5 deletions

View File

@@ -202,12 +202,12 @@ Discourse.AdminUser = Discourse.User.extend({
},
deleteForbidden: function() {
return (this.get('post_count') > 0);
return (!this.get('can_be_deleted') || this.get('post_count') > 0);
}.property('post_count'),
deleteButtonTitle: function() {
if (this.get('deleteForbidden')) {
return I18n.t('admin.user.delete_forbidden');
return I18n.t('admin.user.delete_forbidden', {count: Discourse.SiteSettings.delete_user_max_age});
} else {
return null;
}