FEATURE: Replace existing badge owners when using the bulk award feature (#8770)

* FEATURE: Replace existing badge owners when using the bulk award feature

* Use ActiveRecord to sanitize title update query, Change replace checkbox text

Co-Authored-By: Robin Ward <robin.ward@gmail.com>

Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
Roman Rizzi
2020-01-23 14:14:58 -03:00
committed by GitHub
parent db5373a87c
commit 9eb622985a
6 changed files with 55 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
export default Controller.extend({
saving: false,
replaceBadgeOwners: false,
actions: {
massAward() {
@@ -18,6 +19,7 @@ export default Controller.extend({
};
options.data.append("file", file);
options.data.append("replace_badge_owners", this.replaceBadgeOwners);
this.set("saving", true);

View File

@@ -16,6 +16,12 @@
<h4>{{I18n 'admin.badges.mass_award.upload_csv'}}</h4>
<input type='file' id='massAwardCSVUpload' accept='.csv' />
</div>
<div>
<label>
{{input type="checkbox" checked=replaceBadgeOwners}}
{{i18n 'admin.badges.mass_award.replace_owners'}}
</label>
</div>
{{d-button
class="btn-primary"
action=(action 'massAward')