mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Added method removeAllowedUser to topic_details.js
perform a request to /t/:id/remove-allowed-user, then delete the user from the local list
This commit is contained in:
parent
75a8dfc467
commit
b089805dc0
2 changed files with 15 additions and 1 deletions
|
@ -473,6 +473,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
|||
removeAllowedUser: function(username) {
|
||||
this.get('details').removeAllowedUser(username);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -49,6 +49,19 @@ Discourse.TopicDetails = Discourse.Model.extend({
|
|||
type: 'POST',
|
||||
data: { notification_level: v }
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
removeAllowedUser: function(username) {
|
||||
var users = this.get('allowed_users');
|
||||
Discourse.ajax("/t/" + this.get('topic.id') + "/remove-allowed-user", {
|
||||
type: 'PUT',
|
||||
data: { username: username }
|
||||
}).then(function(res) {
|
||||
users.forEach(function(user, i) {
|
||||
if (user.username === username) {
|
||||
users.removeAt(i);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue