mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 05:34:56 +08:00
FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
This commit is contained in:
@ -12,31 +12,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
refreshing: false,
|
||||
listFilter: null,
|
||||
selectAll: false,
|
||||
|
||||
queryNew: Ember.computed.equal("query", "new"),
|
||||
queryPending: Ember.computed.equal("query", "pending"),
|
||||
queryHasApproval: Ember.computed.or("queryNew", "queryPending"),
|
||||
showApproval: Ember.computed.and(
|
||||
"siteSettings.must_approve_users",
|
||||
"queryHasApproval"
|
||||
),
|
||||
searchHint: i18n("search_hint"),
|
||||
hasSelection: Ember.computed.gt("selectedCount", 0),
|
||||
|
||||
selectedCount: function() {
|
||||
var model = this.get("model");
|
||||
if (!model || !model.length) return 0;
|
||||
return model.filterBy("selected").length;
|
||||
}.property("model.@each.selected"),
|
||||
|
||||
selectAllChanged: function() {
|
||||
var val = this.get("selectAll");
|
||||
this.get("model").forEach(function(user) {
|
||||
if (user.get("can_approve")) {
|
||||
user.set("selected", val);
|
||||
}
|
||||
});
|
||||
}.observes("selectAll"),
|
||||
|
||||
title: function() {
|
||||
return I18n.t("admin.users.titles." + this.get("query"));
|
||||
@ -60,34 +36,8 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
},
|
||||
|
||||
actions: {
|
||||
approveUsers: function() {
|
||||
AdminUser.bulkApprove(this.get("model").filterBy("selected"));
|
||||
this._refreshUsers();
|
||||
},
|
||||
|
||||
rejectUsers: function() {
|
||||
var maxPostAge = this.siteSettings.delete_user_max_post_age;
|
||||
var controller = this;
|
||||
AdminUser.bulkReject(this.get("model").filterBy("selected")).then(
|
||||
function(result) {
|
||||
var message = I18n.t("admin.users.reject_successful", {
|
||||
count: result.success
|
||||
});
|
||||
if (result.failed > 0) {
|
||||
message +=
|
||||
" " +
|
||||
I18n.t("admin.users.reject_failures", { count: result.failed });
|
||||
message +=
|
||||
" " +
|
||||
I18n.t("admin.user.delete_forbidden", { count: maxPostAge });
|
||||
}
|
||||
bootbox.alert(message);
|
||||
controller._refreshUsers();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
toggleEmailVisibility: function() {
|
||||
toggleEmailVisibility() {
|
||||
this.toggleProperty("showEmails");
|
||||
this._refreshUsers();
|
||||
}
|
||||
|
Reference in New Issue
Block a user