FIX: call UserBadge.grant with badgeReason in admin interface (#23753)

Regression from https://github.com/discourse/discourse/pull/23668 where we stopped passing in `this.badgeReason` to the badge granting function. This PR fixes that and adds a unit test to cover that code path.
This commit is contained in:
Kelv
2023-10-05 13:08:09 +08:00
committed by GitHub
parent 790f6b1121
commit bfe078c520
2 changed files with 60 additions and 1 deletions

View File

@@ -73,8 +73,13 @@ export default class AdminUserBadgesController extends Controller {
@action
performGrantBadge() {
UserBadge.grant(this.selectedBadgeId, this.get("user.username")).then(
UserBadge.grant(
this.selectedBadgeId,
this.get("user.username"),
this.badgeReason
).then(
(newBadge) => {
this.set("badgeReason", "");
this.userBadges.pushObject(newBadge);
next(() => {
// Update the selected badge ID after the combobox has re-rendered.