Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Add option to grant badge multiple times to users using Bulk…
… Award (#13571) Currently when bulk-awarding a badge that can be granted multiple times, users in the CSV file are granted the badge once no matter how many times they're listed in the file and only if they don't have the badge already. This PR adds a new option to the Badge Bulk Award feature so that it's possible to grant users a badge even if they already have the badge and as many times as they appear in the CSV file.
- Loading branch information
1 parent
0109edb
commit 31aa701
Showing
14 changed files
with
548 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
acceptance, | ||
exists, | ||
query, | ||
} from "discourse/tests/helpers/qunit-helpers"; | ||
import { click, visit } from "@ember/test-helpers"; | ||
import { test } from "qunit"; | ||
import I18n from "I18n"; | ||
|
||
acceptance("Admin - Badges - Mass Award", function (needs) { | ||
needs.user(); | ||
test("when the badge can be granted multiple times", async function (assert) { | ||
await visit("/admin/badges/award/new"); | ||
await click( | ||
'.admin-badge-list-item span[data-badge-name="Both image and icon"]' | ||
); | ||
assert.equal( | ||
query("label.grant-existing-holders").textContent.trim(), | ||
I18n.t("admin.badges.mass_award.grant_existing_holders"), | ||
"checkbox for granting existing holders is displayed" | ||
); | ||
}); | ||
|
||
test("when the badge can not be granted multiple times", async function (assert) { | ||
await visit("/admin/badges/award/new"); | ||
await click('.admin-badge-list-item span[data-badge-name="Only icon"]'); | ||
assert.ok( | ||
!exists(".grant-existing-holders"), | ||
"checkbox for granting existing holders is not displayed" | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.