Bundled output for commit 91fd28c3192061727fcaf94b74690f9b00d00ff4

Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
This commit is contained in:
flarum-bot 2024-10-24 15:52:33 +00:00
parent 91fd28c319
commit eae355ddaf
40 changed files with 63 additions and 127 deletions

View File

@ -1,26 +0,0 @@
declare module '@askvortsov/rich-icu-message-formatter' {
type IValues = Record<string, any>;
type ITypeHandler = (
value: string,
matches: string,
locale: string,
values: IValues,
format: (message: string, values: IValues) => string
) => string;
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
type ValueOrArray<T> = T | ValueOrArray<T>[];
export type NestedStringArray = ValueOrArray<string>;
export class RichMessageFormatter {
locale: string | null;
constructor(locale: string | null, typeHandlers: Record<string, ITypeHandler>, richHandler: IRichHandler);
format(message: string, values: IValues): string;
process(message: string, values: IValues): NestedStringArray;
rich(message: string, values: IValues): NestedStringArray;
}
export function mithrilRichHandler(tag: any, values: IValues, contents: string): any;
}

View File

@ -1,17 +0,0 @@
declare module '@ultraq/icu-message-formatter' {
export function pluralTypeHandler(
value: string,
matches: string,
locale: string,
values: Record<string, any>,
format: (text: string, values: Record<string, any>) => string
): string;
export function selectTypeHandler(
value: string,
matches: string,
locale: string,
values: Record<string, any>,
format: (text: string, values: Record<string, any>) => string
): string;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';
import type Mithril from 'mithril';
@ -10,8 +9,8 @@ export default class AdvancedPage<CustomAttrs extends IPageAttrs = IPageAttrs> e
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
content(): JSX.Element[];
driverLocale(): Record<string, Record<string, string>>;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import ItemList from '../../common/utils/ItemList';
import type Mithril from 'mithril';
@ -6,8 +5,8 @@ export default class AppearancePage extends AdminPage {
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
content(): JSX.Element;
colorItems(): ItemList<Mithril.Children>;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';
@ -16,8 +15,8 @@ export default class BasicsPage<CustomAttrs extends IPageAttrs = IPageAttrs> ext
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
content(): JSX.Element[];
/**

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';
@ -40,7 +39,7 @@ export default class CreateUserModal<CustomAttrs extends ICreateUserModalAttrs =
bulkAdd: Stream<boolean>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
body(): JSX.Element;
fields(): ItemList<unknown>;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import type { Children } from 'mithril';
@ -6,8 +5,8 @@ export default class DashboardPage extends AdminPage {
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
content(): (Children & {
itemName: string;

View File

@ -1,9 +1,8 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomCssModal extends SettingsModal {
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
form(): JSX.Element[];
onsaved(): void;
}

View File

@ -1,9 +1,8 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomFooterModal extends SettingsModal {
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
form(): JSX.Element[];
onsaved(): void;
}

View File

@ -1,9 +1,8 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomHeaderModal extends SettingsModal {
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
form(): JSX.Element[];
onsaved(): void;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
export interface ILoadingModalAttrs extends IInternalModalAttrs {
}
@ -7,6 +6,6 @@ export default class LoadingModal<ModalAttrs extends ILoadingModalAttrs = ILoadi
protected static readonly isDismissibleViaEscKey: boolean;
protected static readonly isDismissibleViaBackdropClick: boolean;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): null;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';
import type { AlertIdentifier } from '../../common/states/AlertManagerState';
@ -26,8 +25,8 @@ export default class MailPage<CustomAttrs extends IPageAttrs = IPageAttrs> exten
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
refresh(): void;
content(): JSX.Element;

View File

@ -1,12 +1,11 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import AdminPage from './AdminPage';
export default class PermissionsPage extends AdminPage {
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
content(): JSX.Element;
static register(): void;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
import ExtensionReadme from '../models/ExtensionReadme';
import type Mithril from 'mithril';
@ -12,7 +11,7 @@ export default class ReadmeModal<CustomAttrs extends IReadmeModalAttrs = IReadme
protected readme: ExtensionReadme;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): any[];
content(): JSX.Element;
loadReadme(): Promise<void>;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Mithril from 'mithril';
import type User from '../../common/models/User';
import type { IPageAttrs } from '../../common/components/Page';
@ -72,8 +71,8 @@ export default class UserListPage extends AdminPage {
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title: string | any[];
description: string | any[];
};
/**
* Asynchronously fetch the next set of users to be rendered.

View File

@ -1,15 +1,16 @@
import type { Dayjs } from 'dayjs';
import { RichMessageFormatter, NestedStringArray } from '@askvortsov/rich-icu-message-formatter';
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
import formatMessage, { Translation } from 'format-message';
import ItemList from './utils/ItemList';
type Translations = Record<string, string>;
type Translations = {
[key: string]: string | Translation;
};
type TranslatorParameters = Record<string, unknown>;
type DateTimeFormatCallback = (id?: string) => string | void;
export default class Translator {
/**
* A map of translation keys to their translated values.
*/
translations: Translations;
get translations(): Translations;
/**
* A item list of date time format callbacks.
*/
@ -17,7 +18,7 @@ export default class Translator {
/**
* The underlying ICU MessageFormatter util.
*/
protected formatter: RichMessageFormatter;
protected formatter: typeof formatMessage;
/**
* Sets the formatter's locale to the provided value.
*/
@ -25,27 +26,19 @@ export default class Translator {
/**
* Returns the formatter's current locale.
*/
getLocale(): string | null;
getLocale(): string;
addTranslations(translations: Translations): void;
/**
* An extensible entrypoint for extenders to register type handlers for translations.
*/
protected formatterTypeHandlers(): {
plural: typeof pluralTypeHandler;
select: typeof selectTypeHandler;
};
/**
* A temporary system to preprocess parameters.
* Should not be used by extensions.
* TODO: An extender will be added in v1.x.
*
* @internal
*/
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
trans(id: string, parameters: TranslatorParameters): NestedStringArray;
trans(id: string, parameters: TranslatorParameters, extract: false): NestedStringArray;
protected preprocessParameters(parameters: TranslatorParameters, translation: string | Translation): TranslatorParameters;
trans(id: string, parameters: TranslatorParameters): any[];
trans(id: string, parameters: TranslatorParameters, extract: false): any[];
trans(id: string, parameters: TranslatorParameters, extract: true): string;
trans(id: string): NestedStringArray | string;
trans(id: string): any[] | string;
/**
* Formats the time.
*
@ -55,5 +48,13 @@ export default class Translator {
* - DayJS default format.
*/
formatDateTime(time: Dayjs, id: string): string;
/**
* Backwards compatibility for translations such as `<a href='{href}'>`, the old
* formatter supported that, but the new one doesn't, so attributes are auto dropped
* to avoid errors.
*
* @private
*/
private preprocessTranslation;
}
export {};

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../utils/ItemList';
import Stream from '../utils/Stream';
@ -17,7 +16,7 @@ export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEd
protected groups: Record<string, Stream<boolean>>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
fields(): ItemList<unknown>;
activate(): void;

View File

@ -2,7 +2,6 @@ import Component, { ComponentAttrs } from '../../common/Component';
import ItemList from '../../common/utils/ItemList';
import type Mithril from 'mithril';
import type AccessToken from '../../common/models/AccessToken';
import { NestedStringArray } from '@askvortsov/rich-icu-message-formatter';
export interface IAccessTokensListAttrs extends ComponentAttrs {
tokens: AccessToken[];
type: 'session' | 'developer_token';
@ -19,6 +18,6 @@ export default class AccessTokensList<CustomAttrs extends IAccessTokensListAttrs
tokenInfoItems(token: AccessToken): ItemList<Mithril.Children>;
tokenActionItems(token: AccessToken): ItemList<Mithril.Children>;
revoke(token: AccessToken): Promise<void>;
generateTokenTitle(token: AccessToken): NestedStringArray;
generateTokenTitle(token: AccessToken): any[] | string;
tokenValueDisplay(token: AccessToken): Mithril.Children;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import type Mithril from 'mithril';
@ -23,7 +22,7 @@ export default class ChangeEmailModal<CustomAttrs extends IFormModalAttrs = IFor
success: boolean;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
fields(): ItemList<Mithril.Children>;
onsubmit(e: SubmitEvent): void;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Mithril from 'mithril';
import ItemList from '../../common/utils/ItemList';
@ -8,7 +7,7 @@ import ItemList from '../../common/utils/ItemList';
*/
export default class ChangePasswordModal<CustomAttrs extends IFormModalAttrs = IFormModalAttrs> extends FormModal<CustomAttrs> {
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
fields(): ItemList<Mithril.Children>;
onsubmit(e: SubmitEvent): void;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Notification from './Notification';
/**
* The `DiscussionRenamedNotification` component displays a notification which
@ -7,6 +6,6 @@ import Notification from './Notification';
export default class DiscussionRenamedNotification extends Notification {
icon(): string;
href(): string;
content(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): any[];
excerpt(): null;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import Mithril from 'mithril';
@ -19,7 +18,7 @@ export default class ForgotPasswordModal<CustomAttrs extends IForgotPasswordModa
success: boolean;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
fields(): ItemList<unknown>;
onsubmit(e: SubmitEvent): void;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';
@ -25,7 +24,7 @@ export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginMod
remember: Stream<boolean>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element[];
body(): JSX.Element[];
fields(): ItemList<unknown>;

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import Mithril from 'mithril';
@ -16,7 +15,7 @@ export default class RenameDiscussionModal<CustomAttrs extends IRenameDiscussion
newTitle: Stream<string>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element;
onsubmit(e: SubmitEvent): Promise<void> | void;
}

View File

@ -1,4 +1,3 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';
@ -33,7 +32,7 @@ export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignup
password: Stream<string>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): string | any[];
content(): JSX.Element[];
isProvided(field: string): boolean;
body(): (false | JSX.Element)[];

2
framework/core/js/dist/admin.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[234],{422:(s,t,i)=>{i.r(t),i.d(t,{default:()=>A});var e=i(8805),r=i(5114),a=i(2855),n=i(7880),o=i(3550),d=i(4583),l=i(117),u=i(6064),h=i(4311),c=i(374);class A extends a.A{constructor(){super(...arguments),(0,e.A)(this,"username",void 0),(0,e.A)(this,"email",void 0),(0,e.A)(this,"isEmailConfirmed",void 0),(0,e.A)(this,"setPassword",void 0),(0,e.A)(this,"password",void 0),(0,e.A)(this,"groups",{})}oninit(s){super.oninit(s);const t=this.attrs.user;this.username=(0,h.A)(t.username()||""),this.email=(0,h.A)(t.email()||""),this.isEmailConfirmed=(0,h.A)(t.isEmailConfirmed()||!1),this.setPassword=(0,h.A)(!1),this.password=(0,h.A)(t.password()||"");const i=t.groups()||[];r.A.store.all("groups").filter((s=>![d.A.GUEST_ID,d.A.MEMBER_ID].includes(s.id()))).forEach((s=>this.groups[s.id()]=(0,h.A)(i.includes(s))))}className(){return"EditUserModal Modal--small"}title(){return r.A.translator.trans("core.lib.edit_user.title")}content(){const s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m(c.A,null,this.fields().toArray()):r.A.translator.trans("core.lib.edit_user.nothing_available"))}fields(){const s=new u.A;return this.attrs.user.canEditCredentials()&&(s.add("username",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),r.A.session.user!==this.attrs.user&&(s.add("email",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.email_heading")),m("input",{className:"FormControl",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()}),!this.isEmailConfirmed()&&this.userIsAdmin(r.A.session.user)&&m(n.A,{className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},r.A.translator.trans("core.lib.edit_user.activate_button"))),30),s.add("password",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:s=>{const t=s.target;this.setPassword(t.checked),m.redraw.sync(),t.checked&&this.$("[name=password]").select(),s.redraw=!1},disabled:this.nonAdminEditingAdmin()}),r.A.translator.trans("core.lib.edit_user.set_password_label"))),this.setPassword()&&m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()})),20))),this.attrs.user.canEditGroups()&&s.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,r.A.translator.trans("core.lib.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((s=>r.A.store.getById("groups",s))).filter(Boolean).map((s=>s&&m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.groups[s.id()],disabled:s.id()===d.A.ADMINISTRATOR_ID&&(this.attrs.user===r.A.session.user||!this.userIsAdmin(r.A.session.user))}),m(o.A,{group:s,label:null})," ",s.nameSingular()))))),10),s.add("submit",m("div",{className:"Form-group Form-controls"},m(n.A,{className:"Button Button--primary",type:"submit",loading:this.loading},r.A.translator.trans("core.lib.edit_user.submit_button"))),-10),s}activate(){this.loading=!0;const s={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(s,{errorHandler:this.onerror.bind(this)}).then((()=>{this.isEmailConfirmed(!0),this.loading=!1,m.redraw()})).catch((()=>{this.loading=!1,m.redraw()}))}data(){const s={},t={};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(s.username=this.username(),r.A.session.user!==this.attrs.user&&(s.email=this.email()),this.setPassword()&&(s.password=this.password())),this.attrs.user.canEditGroups()&&(t.groups=Object.keys(this.groups).filter((s=>this.groups[s]())).map((s=>r.A.store.getById("groups",s))).filter((s=>s instanceof d.A))),s.relationships=t,s}onsubmit(s){s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((()=>{this.loading=!1,m.redraw()}))}nonAdminEditingAdmin(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(r.A.session.user)}userIsAdmin(s){return!!(s?.groups()||[]).some((s=>s?.id()===d.A.ADMINISTRATOR_ID))}}flarum.reg.add("core","common/components/EditUserModal",A)}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[234],{422:(s,t,i)=>{i.r(t),i.d(t,{default:()=>A});var e=i(8805),r=i(5114),a=i(2855),n=i(3092),o=i(3550),d=i(4583),l=i(117),u=i(6064),h=i(4311),c=i(374);class A extends a.A{constructor(){super(...arguments),(0,e.A)(this,"username",void 0),(0,e.A)(this,"email",void 0),(0,e.A)(this,"isEmailConfirmed",void 0),(0,e.A)(this,"setPassword",void 0),(0,e.A)(this,"password",void 0),(0,e.A)(this,"groups",{})}oninit(s){super.oninit(s);const t=this.attrs.user;this.username=(0,h.A)(t.username()||""),this.email=(0,h.A)(t.email()||""),this.isEmailConfirmed=(0,h.A)(t.isEmailConfirmed()||!1),this.setPassword=(0,h.A)(!1),this.password=(0,h.A)(t.password()||"");const i=t.groups()||[];r.A.store.all("groups").filter((s=>![d.A.GUEST_ID,d.A.MEMBER_ID].includes(s.id()))).forEach((s=>this.groups[s.id()]=(0,h.A)(i.includes(s))))}className(){return"EditUserModal Modal--small"}title(){return r.A.translator.trans("core.lib.edit_user.title")}content(){const s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m(c.A,null,this.fields().toArray()):r.A.translator.trans("core.lib.edit_user.nothing_available"))}fields(){const s=new u.A;return this.attrs.user.canEditCredentials()&&(s.add("username",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),r.A.session.user!==this.attrs.user&&(s.add("email",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.email_heading")),m("input",{className:"FormControl",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()}),!this.isEmailConfirmed()&&this.userIsAdmin(r.A.session.user)&&m(n.A,{className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},r.A.translator.trans("core.lib.edit_user.activate_button"))),30),s.add("password",m("div",{className:"Form-group"},m("label",null,r.A.translator.trans("core.lib.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:s=>{const t=s.target;this.setPassword(t.checked),m.redraw.sync(),t.checked&&this.$("[name=password]").select(),s.redraw=!1},disabled:this.nonAdminEditingAdmin()}),r.A.translator.trans("core.lib.edit_user.set_password_label"))),this.setPassword()&&m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,l.A)(r.A.translator.trans("core.lib.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()})),20))),this.attrs.user.canEditGroups()&&s.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,r.A.translator.trans("core.lib.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((s=>r.A.store.getById("groups",s))).filter(Boolean).map((s=>s&&m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.groups[s.id()],disabled:s.id()===d.A.ADMINISTRATOR_ID&&(this.attrs.user===r.A.session.user||!this.userIsAdmin(r.A.session.user))}),m(o.A,{group:s,label:null})," ",s.nameSingular()))))),10),s.add("submit",m("div",{className:"Form-group Form-controls"},m(n.A,{className:"Button Button--primary",type:"submit",loading:this.loading},r.A.translator.trans("core.lib.edit_user.submit_button"))),-10),s}activate(){this.loading=!0;const s={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(s,{errorHandler:this.onerror.bind(this)}).then((()=>{this.isEmailConfirmed(!0),this.loading=!1,m.redraw()})).catch((()=>{this.loading=!1,m.redraw()}))}data(){const s={},t={};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(s.username=this.username(),r.A.session.user!==this.attrs.user&&(s.email=this.email()),this.setPassword()&&(s.password=this.password())),this.attrs.user.canEditGroups()&&(t.groups=Object.keys(this.groups).filter((s=>this.groups[s]())).map((s=>r.A.store.getById("groups",s))).filter((s=>s instanceof d.A))),s.relationships=t,s}onsubmit(s){s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((()=>{this.loading=!1,m.redraw()}))}nonAdminEditingAdmin(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(r.A.session.user)}userIsAdmin(s){return!!(s?.groups()||[]).some((s=>s?.id()===d.A.ADMINISTRATOR_ID))}}flarum.reg.add("core","common/components/EditUserModal",A)}}]);
//# sourceMappingURL=EditUserModal.js.map

File diff suppressed because one or more lines are too long

2
framework/core/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[948],{6296:(t,s,e)=>{e.d(s,{A:()=>h});var o=e(8805),r=e(5710),i=e(43);class n extends r.A{handler(){return this.attrs.when()||void 0}oncreate(t){super.oncreate(t),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(t){super.onremove(t),$(window).off("beforeunload",this.boundHandler)}view(t){return m("[",null,t.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",n);var a=e(1611),c=e(5673),d=e(6064),l=e(4268),u=e(7891);class h extends r.A{constructor(){super(...arguments),(0,o.A)(this,"loading",!1),(0,o.A)(this,"composer",void 0),(0,o.A)(this,"jumpToPreview",void 0)}oninit(t){super.oninit(t),this.composer=this.attrs.composer,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){return m(n,{when:this.hasChanges.bind(this)},m("div",{className:(0,l.A)("ComposerBody",this.attrs.className)},m(u.A,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,c.A)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(a.A,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:this.jumpToPreview?.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(i.A,{display:"unset",containerClassName:(0,l.A)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const t=this.composer.fields.content();return Boolean(t)&&t!==this.attrs.originalContent}headerItems(){return new d.A}loaded(){this.loading=!1,m.redraw()}}(0,o.A)(h,"focusOnSelector",null),flarum.reg.add("core","forum/components/ComposerBody",h)},4191:(t,s,e)=>{e.r(s),e.d(s,{default:()=>d});var o=e(3554),r=e(6296),i=e(7880),n=e(7709),a=e(7479);function c(t){o.A.composer.isFullScreen()&&(o.A.composer.minimize(),t.stopPropagation())}class d extends r.A{static initAttrs(t){super.initAttrs(t),t.submitLabel=t.submitLabel||o.A.translator.trans("core.forum.composer_edit.submit_button"),t.confirmExit=t.confirmExit||o.A.translator.trans("core.forum.composer_edit.discard_confirmation"),t.originalContent=t.originalContent||t.post.content(),t.user=t.user||t.post.user(),t.post.editedContent=t.originalContent}headerItems(){const t=super.headerItems(),s=this.attrs.post;return t.add("title",m("h3",null,m(a.A,{name:"fas fa-pencil-alt"})," ",m(n.A,{href:o.A.route.discussion(s.discussion(),s.number()),onclick:c},o.A.translator.trans("core.forum.composer_edit.post_link",{number:s.number(),discussion:s.discussion().title()})))),t}jumpToPreview(t){c(t),m.route.set(o.A.route.post(this.attrs.post))}data(){return{content:this.composer.fields.content()}}onsubmit(){const t=this.attrs.post.discussion();this.loading=!0;const s=this.data();this.attrs.post.save(s).then((s=>{if(o.A.viewingDiscussion(t))o.A.current.get("stream").goToNumber(s.number());else{const t=o.A.alerts.show({type:"success",controls:[m(i.A,{className:"Button Button--link",onclick:()=>{m.route.set(o.A.route.post(s)),o.A.alerts.dismiss(t)}},o.A.translator.trans("core.forum.composer_edit.view_button"))]},o.A.translator.trans("core.forum.composer_edit.edited_message"))}this.composer.hide()}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/EditPostComposer",d)}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[948],{6296:(t,s,e)=>{e.d(s,{A:()=>h});var o=e(8805),r=e(5710),i=e(43);class n extends r.A{handler(){return this.attrs.when()||void 0}oncreate(t){super.oncreate(t),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(t){super.onremove(t),$(window).off("beforeunload",this.boundHandler)}view(t){return m("[",null,t.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",n);var a=e(1611),c=e(5673),d=e(6064),l=e(4268),u=e(7891);class h extends r.A{constructor(){super(...arguments),(0,o.A)(this,"loading",!1),(0,o.A)(this,"composer",void 0),(0,o.A)(this,"jumpToPreview",void 0)}oninit(t){super.oninit(t),this.composer=this.attrs.composer,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){return m(n,{when:this.hasChanges.bind(this)},m("div",{className:(0,l.A)("ComposerBody",this.attrs.className)},m(u.A,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,c.A)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(a.A,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:this.jumpToPreview?.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(i.A,{display:"unset",containerClassName:(0,l.A)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const t=this.composer.fields.content();return Boolean(t)&&t!==this.attrs.originalContent}headerItems(){return new d.A}loaded(){this.loading=!1,m.redraw()}}(0,o.A)(h,"focusOnSelector",null),flarum.reg.add("core","forum/components/ComposerBody",h)},4191:(t,s,e)=>{e.r(s),e.d(s,{default:()=>d});var o=e(3554),r=e(6296),i=e(3092),n=e(7709),a=e(7479);function c(t){o.A.composer.isFullScreen()&&(o.A.composer.minimize(),t.stopPropagation())}class d extends r.A{static initAttrs(t){super.initAttrs(t),t.submitLabel=t.submitLabel||o.A.translator.trans("core.forum.composer_edit.submit_button"),t.confirmExit=t.confirmExit||o.A.translator.trans("core.forum.composer_edit.discard_confirmation"),t.originalContent=t.originalContent||t.post.content(),t.user=t.user||t.post.user(),t.post.editedContent=t.originalContent}headerItems(){const t=super.headerItems(),s=this.attrs.post;return t.add("title",m("h3",null,m(a.A,{name:"fas fa-pencil-alt"})," ",m(n.A,{href:o.A.route.discussion(s.discussion(),s.number()),onclick:c},o.A.translator.trans("core.forum.composer_edit.post_link",{number:s.number(),discussion:s.discussion().title()})))),t}jumpToPreview(t){c(t),m.route.set(o.A.route.post(this.attrs.post))}data(){return{content:this.composer.fields.content()}}onsubmit(){const t=this.attrs.post.discussion();this.loading=!0;const s=this.data();this.attrs.post.save(s).then((s=>{if(o.A.viewingDiscussion(t))o.A.current.get("stream").goToNumber(s.number());else{const t=o.A.alerts.show({type:"success",controls:[m(i.A,{className:"Button Button--link",onclick:()=>{m.route.set(o.A.route.post(s)),o.A.alerts.dismiss(t)}},o.A.translator.trans("core.forum.composer_edit.view_button"))]},o.A.translator.trans("core.forum.composer_edit.edited_message"))}this.composer.hide()}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/EditPostComposer",d)}}]);
//# sourceMappingURL=EditPostComposer.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[378],{6296:(s,e,t)=>{t.d(e,{A:()=>h});var o=t(8805),r=t(5710),i=t(43);class n extends r.A{handler(){return this.attrs.when()||void 0}oncreate(s){super.oncreate(s),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(s){super.onremove(s),$(window).off("beforeunload",this.boundHandler)}view(s){return m("[",null,s.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",n);var a=t(1611),c=t(5673),l=t(6064),d=t(4268),u=t(7891);class h extends r.A{constructor(){super(...arguments),(0,o.A)(this,"loading",!1),(0,o.A)(this,"composer",void 0),(0,o.A)(this,"jumpToPreview",void 0)}oninit(s){super.oninit(s),this.composer=this.attrs.composer,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){return m(n,{when:this.hasChanges.bind(this)},m("div",{className:(0,d.A)("ComposerBody",this.attrs.className)},m(u.A,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,c.A)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(a.A,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:this.jumpToPreview?.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(i.A,{display:"unset",containerClassName:(0,d.A)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const s=this.composer.fields.content();return Boolean(s)&&s!==this.attrs.originalContent}headerItems(){return new l.A}loaded(){this.loading=!1,m.redraw()}}(0,o.A)(h,"focusOnSelector",null),flarum.reg.add("core","forum/components/ComposerBody",h)},6349:(s,e,t)=>{t.r(e),t.d(e,{default:()=>d});var o=t(3554),r=t(6296),i=t(7880),n=t(7709),a=t(117),c=t(7479);function l(s){o.A.composer.isFullScreen()&&(o.A.composer.minimize(),s.stopPropagation())}class d extends r.A{static initAttrs(s){super.initAttrs(s),s.placeholder=s.placeholder||(0,a.A)(o.A.translator.trans("core.forum.composer_reply.body_placeholder")),s.submitLabel=s.submitLabel||o.A.translator.trans("core.forum.composer_reply.submit_button"),s.confirmExit=s.confirmExit||(0,a.A)(o.A.translator.trans("core.forum.composer_reply.discard_confirmation"))}headerItems(){const s=super.headerItems(),e=this.attrs.discussion;return s.add("title",m("h3",null,m(c.A,{name:"fas fa-reply"})," ",m(n.A,{href:o.A.route.discussion(e),onclick:l},e.title()))),s}jumpToPreview(s){l(s),m.route.set(o.A.route.discussion(this.attrs.discussion,"reply"))}data(){return{content:this.composer.fields.content(),relationships:{discussion:this.attrs.discussion}}}onsubmit(){const s=this.attrs.discussion;this.loading=!0,m.redraw();const e=this.data();o.A.store.createRecord("posts").save(e).then((e=>{if(o.A.viewingDiscussion(s)){const s=o.A.current.get("stream");s.update().then((()=>s.goToNumber(e.number())))}else{let s;const t=m(i.A,{className:"Button Button--link",onclick:()=>{m.route.set(o.A.route.post(e)),o.A.alerts.dismiss(s)}},o.A.translator.trans("core.forum.composer_reply.view_button"));s=o.A.alerts.show({type:"success",controls:[t]},o.A.translator.trans("core.forum.composer_reply.posted_message"))}this.composer.hide()}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/ReplyComposer",d)}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[378],{6296:(s,e,t)=>{t.d(e,{A:()=>h});var o=t(8805),r=t(5710),i=t(43);class n extends r.A{handler(){return this.attrs.when()||void 0}oncreate(s){super.oncreate(s),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(s){super.onremove(s),$(window).off("beforeunload",this.boundHandler)}view(s){return m("[",null,s.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",n);var a=t(1611),c=t(5673),l=t(6064),d=t(4268),u=t(7891);class h extends r.A{constructor(){super(...arguments),(0,o.A)(this,"loading",!1),(0,o.A)(this,"composer",void 0),(0,o.A)(this,"jumpToPreview",void 0)}oninit(s){super.oninit(s),this.composer=this.attrs.composer,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){return m(n,{when:this.hasChanges.bind(this)},m("div",{className:(0,d.A)("ComposerBody",this.attrs.className)},m(u.A,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,c.A)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(a.A,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:this.jumpToPreview?.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(i.A,{display:"unset",containerClassName:(0,d.A)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const s=this.composer.fields.content();return Boolean(s)&&s!==this.attrs.originalContent}headerItems(){return new l.A}loaded(){this.loading=!1,m.redraw()}}(0,o.A)(h,"focusOnSelector",null),flarum.reg.add("core","forum/components/ComposerBody",h)},6349:(s,e,t)=>{t.r(e),t.d(e,{default:()=>d});var o=t(3554),r=t(6296),i=t(3092),n=t(7709),a=t(117),c=t(7479);function l(s){o.A.composer.isFullScreen()&&(o.A.composer.minimize(),s.stopPropagation())}class d extends r.A{static initAttrs(s){super.initAttrs(s),s.placeholder=s.placeholder||(0,a.A)(o.A.translator.trans("core.forum.composer_reply.body_placeholder")),s.submitLabel=s.submitLabel||o.A.translator.trans("core.forum.composer_reply.submit_button"),s.confirmExit=s.confirmExit||(0,a.A)(o.A.translator.trans("core.forum.composer_reply.discard_confirmation"))}headerItems(){const s=super.headerItems(),e=this.attrs.discussion;return s.add("title",m("h3",null,m(c.A,{name:"fas fa-reply"})," ",m(n.A,{href:o.A.route.discussion(e),onclick:l},e.title()))),s}jumpToPreview(s){l(s),m.route.set(o.A.route.discussion(this.attrs.discussion,"reply"))}data(){return{content:this.composer.fields.content(),relationships:{discussion:this.attrs.discussion}}}onsubmit(){const s=this.attrs.discussion;this.loading=!0,m.redraw();const e=this.data();o.A.store.createRecord("posts").save(e).then((e=>{if(o.A.viewingDiscussion(s)){const s=o.A.current.get("stream");s.update().then((()=>s.goToNumber(e.number())))}else{let s;const t=m(i.A,{className:"Button Button--link",onclick:()=>{m.route.set(o.A.route.post(e)),o.A.alerts.dismiss(s)}},o.A.translator.trans("core.forum.composer_reply.view_button"));s=o.A.alerts.show({type:"success",controls:[t]},o.A.translator.trans("core.forum.composer_reply.posted_message"))}this.composer.hide()}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/ReplyComposer",d)}}]);
//# sourceMappingURL=ReplyComposer.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[559],{9509:(t,s,e)=>{e.r(s),e.d(s,{default:()=>h});var a=e(8805),r=e(3554),i=e(2855),o=e(7880),n=e(1005),l=e(117),d=e(6064),u=e(4311);class h extends i.A{constructor(){super(...arguments),(0,a.A)(this,"username",void 0),(0,a.A)(this,"email",void 0),(0,a.A)(this,"password",void 0)}oninit(t){super.oninit(t),this.username=(0,u.A)(this.attrs.username||""),this.email=(0,u.A)(this.attrs.email||""),this.password=(0,u.A)(this.attrs.password||"")}className(){return"Modal--small SignUpModal"}title(){return r.A.translator.trans("core.forum.sign_up.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}isProvided(t){return this.attrs.provided?.includes(t)??!1}body(){return[!this.attrs.token&&m(n.A,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const t=new d.A,s=(0,l.A)(r.A.translator.trans("core.forum.sign_up.username_placeholder")),e=(0,l.A)(r.A.translator.trans("core.forum.sign_up.email_placeholder")),a=(0,l.A)(r.A.translator.trans("core.forum.sign_up.password_placeholder"));return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:s,"aria-label":s,bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:e,"aria-label":e,bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"new-password",placeholder:a,"aria-label":a,bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(o.A,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},r.A.translator.trans("core.forum.sign_up.submit_button"))),-10),t}footer(){return[m("p",{className:"SignUpModal-logIn"},r.A.translator.trans("core.forum.sign_up.log_in_text",{a:m(o.A,{className:"Button Button--text Button--link",onclick:this.logIn.bind(this)})}))]}logIn(){const t={identification:this.email()||this.username()};r.A.modal.show((()=>e.e(226).then(e.bind(e,1793))),t)}onready(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()}onsubmit(t){t.preventDefault(),this.loading=!0;const s=this.submitData();r.A.request({url:r.A.forum.attribute("baseUrl")+"/register",method:"POST",body:s,errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}submitData(){const t=this.attrs.token?{token:this.attrs.token}:{password:this.password()};return{username:this.username(),email:this.email(),...t}}}flarum.reg.add("core","forum/components/SignUpModal",h)}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[559],{9509:(t,s,e)=>{e.r(s),e.d(s,{default:()=>h});var a=e(8805),r=e(3554),i=e(2855),o=e(3092),n=e(1005),l=e(117),d=e(6064),u=e(4311);class h extends i.A{constructor(){super(...arguments),(0,a.A)(this,"username",void 0),(0,a.A)(this,"email",void 0),(0,a.A)(this,"password",void 0)}oninit(t){super.oninit(t),this.username=(0,u.A)(this.attrs.username||""),this.email=(0,u.A)(this.attrs.email||""),this.password=(0,u.A)(this.attrs.password||"")}className(){return"Modal--small SignUpModal"}title(){return r.A.translator.trans("core.forum.sign_up.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}isProvided(t){return this.attrs.provided?.includes(t)??!1}body(){return[!this.attrs.token&&m(n.A,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const t=new d.A,s=(0,l.A)(r.A.translator.trans("core.forum.sign_up.username_placeholder")),e=(0,l.A)(r.A.translator.trans("core.forum.sign_up.email_placeholder")),a=(0,l.A)(r.A.translator.trans("core.forum.sign_up.password_placeholder"));return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:s,"aria-label":s,bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:e,"aria-label":e,bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"new-password",placeholder:a,"aria-label":a,bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(o.A,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},r.A.translator.trans("core.forum.sign_up.submit_button"))),-10),t}footer(){return[m("p",{className:"SignUpModal-logIn"},r.A.translator.trans("core.forum.sign_up.log_in_text",{a:m(o.A,{className:"Button Button--text Button--link",onclick:this.logIn.bind(this)})}))]}logIn(){const t={identification:this.email()||this.username()};r.A.modal.show((()=>e.e(226).then(e.bind(e,1793))),t)}onready(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()}onsubmit(t){t.preventDefault(),this.loading=!0;const s=this.submitData();r.A.request({url:r.A.forum.attribute("baseUrl")+"/register",method:"POST",body:s,errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}submitData(){const t=this.attrs.token?{token:this.attrs.token}:{password:this.password()};return{username:this.username(),email:this.email(),...t}}}flarum.reg.add("core","forum/components/SignUpModal",h)}}]);
//# sourceMappingURL=SignUpModal.js.map

File diff suppressed because one or more lines are too long