mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Add way to create a user notice via config.json (#9559)
This commit is contained in:
parent
985119dcfe
commit
848adfdc10
@ -183,6 +183,12 @@ export interface IConfigOptions {
|
|||||||
// length per voice chunk in seconds
|
// length per voice chunk in seconds
|
||||||
chunk_length?: number;
|
chunk_length?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
user_notice?: {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
show_once?: boolean;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISsoRedirectOptions {
|
export interface ISsoRedirectOptions {
|
||||||
|
@ -139,6 +139,8 @@ import { isLocalRoom } from '../../utils/localRoom/isLocalRoom';
|
|||||||
import { SdkContextClass, SDKContext } from '../../contexts/SDKContext';
|
import { SdkContextClass, SDKContext } from '../../contexts/SDKContext';
|
||||||
import { viewUserDeviceSettings } from '../../actions/handlers/viewUserDeviceSettings';
|
import { viewUserDeviceSettings } from '../../actions/handlers/viewUserDeviceSettings';
|
||||||
import { VoiceBroadcastResumer } from '../../voice-broadcast';
|
import { VoiceBroadcastResumer } from '../../voice-broadcast';
|
||||||
|
import GenericToast from "../views/toasts/GenericToast";
|
||||||
|
import { Linkify } from "../views/elements/Linkify";
|
||||||
|
|
||||||
// legacy export
|
// legacy export
|
||||||
export { default as Views } from "../../Views";
|
export { default as Views } from "../../Views";
|
||||||
@ -1332,6 +1334,28 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||||||
// check if it has been dismissed before, etc.
|
// check if it has been dismissed before, etc.
|
||||||
showMobileGuideToast();
|
showMobileGuideToast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userNotice = SdkConfig.get("user_notice");
|
||||||
|
if (userNotice) {
|
||||||
|
const key = "user_notice_" + userNotice.title;
|
||||||
|
if (!userNotice.show_once || !localStorage.getItem(key)) {
|
||||||
|
ToastStore.sharedInstance().addOrReplaceToast({
|
||||||
|
key,
|
||||||
|
title: userNotice.title,
|
||||||
|
props: {
|
||||||
|
description: <Linkify>{ userNotice.description }</Linkify>,
|
||||||
|
acceptLabel: _t("OK"),
|
||||||
|
onAccept: () => {
|
||||||
|
ToastStore.sharedInstance().dismissToast(key);
|
||||||
|
localStorage.setItem(key, "1");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
component: GenericToast,
|
||||||
|
className: "mx_AnalyticsToast",
|
||||||
|
priority: 100,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private initPosthogAnalyticsToast() {
|
private initPosthogAnalyticsToast() {
|
||||||
|
Loading…
Reference in New Issue
Block a user