This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/review-settings.js.es6
Robin Ward 62956003c3 FEATURE: Allow users to customize bonuses for reviewable types
A new settings section in the review queue allows admins to specify that
certain types of flags should be weighted higher than others.
2019-04-03 11:18:34 -04:00

25 lines
623 B
JavaScript

import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Ember.Controller.extend({
saving: false,
saved: false,
actions: {
save() {
let bonuses = {};
this.get("settings.reviewable_score_types").forEach(st => {
bonuses[st.id] = parseFloat(st.score_bonus);
});
this.set("saving", true);
ajax("/review/settings", { method: "PUT", data: { bonuses } })
.then(() => {
this.set("saved", true);
})
.catch(popupAjaxError)
.finally(() => this.set("saving", false));
}
}
});