FEATURE: add transformer to pass topic ID to simple invite generation (#29861)
This commit is contained in:
parent
23a7f00524
commit
9db6bd08a2
|
@ -14,6 +14,7 @@ import FutureDateInput from "discourse/components/future-date-input";
|
|||
import { extractError } from "discourse/lib/ajax-error";
|
||||
import { canNativeShare, nativeShare } from "discourse/lib/pwa-utils";
|
||||
import { sanitize } from "discourse/lib/text";
|
||||
import { applyValueTransformer } from "discourse/lib/transformer";
|
||||
import { emailValid, hostnameValid } from "discourse/lib/utilities";
|
||||
import Group from "discourse/models/group";
|
||||
import Invite from "discourse/models/invite";
|
||||
|
@ -248,11 +249,17 @@ export default class CreateInvite extends Component {
|
|||
@action
|
||||
async createLink() {
|
||||
this.sendEmail = false;
|
||||
|
||||
const topicId = applyValueTransformer("invite-simple-mode-topic", null, {
|
||||
invite: this.invite,
|
||||
});
|
||||
|
||||
await this.save({
|
||||
max_redemptions_allowed: this.defaultRedemptionsAllowed,
|
||||
expires_at: moment()
|
||||
.add(this.siteSettings.invite_expiry_days, "days")
|
||||
.format(DATE_INPUT_FORMAT),
|
||||
...(topicId != null && { topic_id: topicId }),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
|||
"header-notifications-avatar-size",
|
||||
"home-logo-href",
|
||||
"home-logo-image-url",
|
||||
"invite-simple-mode-topic",
|
||||
"mentions-class",
|
||||
"more-topics-tabs",
|
||||
"post-menu-buttons",
|
||||
|
|
Loading…
Reference in New Issue