mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 23:42:59 +08:00
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 { extractError } from "discourse/lib/ajax-error";
|
||||||
import { canNativeShare, nativeShare } from "discourse/lib/pwa-utils";
|
import { canNativeShare, nativeShare } from "discourse/lib/pwa-utils";
|
||||||
import { sanitize } from "discourse/lib/text";
|
import { sanitize } from "discourse/lib/text";
|
||||||
|
import { applyValueTransformer } from "discourse/lib/transformer";
|
||||||
import { emailValid, hostnameValid } from "discourse/lib/utilities";
|
import { emailValid, hostnameValid } from "discourse/lib/utilities";
|
||||||
import Group from "discourse/models/group";
|
import Group from "discourse/models/group";
|
||||||
import Invite from "discourse/models/invite";
|
import Invite from "discourse/models/invite";
|
||||||
|
@ -248,11 +249,17 @@ export default class CreateInvite extends Component {
|
||||||
@action
|
@action
|
||||||
async createLink() {
|
async createLink() {
|
||||||
this.sendEmail = false;
|
this.sendEmail = false;
|
||||||
|
|
||||||
|
const topicId = applyValueTransformer("invite-simple-mode-topic", null, {
|
||||||
|
invite: this.invite,
|
||||||
|
});
|
||||||
|
|
||||||
await this.save({
|
await this.save({
|
||||||
max_redemptions_allowed: this.defaultRedemptionsAllowed,
|
max_redemptions_allowed: this.defaultRedemptionsAllowed,
|
||||||
expires_at: moment()
|
expires_at: moment()
|
||||||
.add(this.siteSettings.invite_expiry_days, "days")
|
.add(this.siteSettings.invite_expiry_days, "days")
|
||||||
.format(DATE_INPUT_FORMAT),
|
.format(DATE_INPUT_FORMAT),
|
||||||
|
...(topicId != null && { topic_id: topicId }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
||||||
"header-notifications-avatar-size",
|
"header-notifications-avatar-size",
|
||||||
"home-logo-href",
|
"home-logo-href",
|
||||||
"home-logo-image-url",
|
"home-logo-image-url",
|
||||||
|
"invite-simple-mode-topic",
|
||||||
"mentions-class",
|
"mentions-class",
|
||||||
"more-topics-tabs",
|
"more-topics-tabs",
|
||||||
"post-menu-buttons",
|
"post-menu-buttons",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user