mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Change user deletion warning to be more explicit.
Issue #4583 - If a user has posts, show the count in the deletion warning.
This commit is contained in:
parent
5cfebb3e50
commit
90043cd28d
@ -1,4 +1,24 @@
|
|||||||
var DeleteUserController = Ember.Controller.extend({
|
var DeleteUserController = Ember.ObjectController.extend({
|
||||||
|
userPostCount: Ember.computed('id', function () {
|
||||||
|
var promise,
|
||||||
|
query = {
|
||||||
|
author: this.get('slug'),
|
||||||
|
status: 'all'
|
||||||
|
};
|
||||||
|
|
||||||
|
promise = this.store.find('post', query).then(function (results) {
|
||||||
|
return results.meta.pagination.total;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Ember.Object.extend(Ember.PromiseProxyMixin, {
|
||||||
|
count: Ember.computed.alias('content'),
|
||||||
|
|
||||||
|
inflection: Ember.computed('count', function () {
|
||||||
|
return this.get('count') > 1 ? 'posts' : 'post';
|
||||||
|
})
|
||||||
|
}).create({promise: promise});
|
||||||
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
confirmAccept: function () {
|
confirmAccept: function () {
|
||||||
var self = this,
|
var self = this,
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade"
|
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade"
|
||||||
title="Are you sure you want to delete this user?" confirm=confirm}}
|
title="Are you sure you want to delete this user?" confirm=confirm}}
|
||||||
|
|
||||||
<p>All posts and associated data will also be deleted. There is no way to recover this data.
|
{{#unless userPostCount.isPending}}
|
||||||
</p>
|
{{#if userPostCount.count}}
|
||||||
|
<strong>WARNING:</strong> <span class="red">This user is the author of {{userPostCount.count}} {{userPostCount.inflection}}.</span> All posts and user data will be deleted. There is no way to recover this.
|
||||||
|
{{else}}
|
||||||
|
<strong>WARNING:</strong> All user data will be deleted. There is no way to recover this.
|
||||||
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{/gh-modal-dialog}}
|
{{/gh-modal-dialog}}
|
Loading…
Reference in New Issue
Block a user