diff --git a/core/client/controllers/modals/delete-user.js b/core/client/controllers/modals/delete-user.js index 7d8652de4d..ed6ce9e1fe 100644 --- a/core/client/controllers/modals/delete-user.js +++ b/core/client/controllers/modals/delete-user.js @@ -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: { confirmAccept: function () { var self = this, diff --git a/core/client/templates/modals/delete-user.hbs b/core/client/templates/modals/delete-user.hbs index 7792078fc9..51cfc79807 100644 --- a/core/client/templates/modals/delete-user.hbs +++ b/core/client/templates/modals/delete-user.hbs @@ -1,7 +1,12 @@ {{#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}} -

All posts and associated data will also be deleted. There is no way to recover this data. -

+ {{#unless userPostCount.isPending}} + {{#if userPostCount.count}} + WARNING: This user is the author of {{userPostCount.count}} {{userPostCount.inflection}}. All posts and user data will be deleted. There is no way to recover this. + {{else}} + WARNING: All user data will be deleted. There is no way to recover this. + {{/if}} + {{/unless}} -{{/gh-modal-dialog}} \ No newline at end of file +{{/gh-modal-dialog}}