mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 17:35:28 +00:00
feat: Add setting to disable the nsfw channel prompt
This commit is contained in:
@@ -40,6 +40,20 @@ export default function AppearanceOptions() {
|
|||||||
<Text id="app.settings.pages.appearance.appearance_options.show_account_age_desc" />
|
<Text id="app.settings.pages.appearance.appearance_options.show_account_age_desc" />
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{/* Option to prevent being shown age gate. */}
|
||||||
|
<ObservedInputElement
|
||||||
|
type="checkbox"
|
||||||
|
value={() =>
|
||||||
|
settings.get("appearance:bypass_age_gate") ?? false
|
||||||
|
}
|
||||||
|
onChange={(v) => settings.set("appearance:bypass_age_gate", v)}
|
||||||
|
title={
|
||||||
|
<Text id="app.settings.pages.appearance.appearance_options.bypass_age_gate" />
|
||||||
|
}
|
||||||
|
description={
|
||||||
|
<Text id="app.settings.pages.appearance.appearance_options.bypass_age_gate_desc" />
|
||||||
|
}
|
||||||
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
<h3>
|
<h3>
|
||||||
<Text id="app.settings.pages.appearance.theme_options.title" />
|
<Text id="app.settings.pages.appearance.theme_options.title" />
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export interface ISettings {
|
|||||||
"appearance:transparency": boolean;
|
"appearance:transparency": boolean;
|
||||||
"appearance:show_send_button": boolean;
|
"appearance:show_send_button": boolean;
|
||||||
"appearance:show_account_age": boolean;
|
"appearance:show_account_age": boolean;
|
||||||
|
"appearance:bypass_age_gate": boolean;
|
||||||
|
|
||||||
"appearance:theme:base": "dark" | "light";
|
"appearance:theme:base": "dark" | "light";
|
||||||
"appearance:theme:overrides": Partial<Overrides>;
|
"appearance:theme:overrides": Partial<Overrides>;
|
||||||
@@ -37,8 +38,7 @@ export interface ISettings {
|
|||||||
* Manages user settings.
|
* Manages user settings.
|
||||||
*/
|
*/
|
||||||
export default class Settings
|
export default class Settings
|
||||||
implements Store, Persistent<ISettings>, Syncable
|
implements Store, Persistent<ISettings>, Syncable {
|
||||||
{
|
|
||||||
private data: ObservableMap<string, unknown>;
|
private data: ObservableMap<string, unknown>;
|
||||||
|
|
||||||
theme: STheme;
|
theme: STheme;
|
||||||
|
|||||||
@@ -180,13 +180,7 @@ const TextChannel = observer(({ channel }: { channel: ChannelI }) => {
|
|||||||
<AgeGate
|
<AgeGate
|
||||||
type="channel"
|
type="channel"
|
||||||
channel={channel}
|
channel={channel}
|
||||||
gated={
|
gated={ShowAgeGate({ channel })}>
|
||||||
!!(
|
|
||||||
(channel.channel_type === "TextChannel" ||
|
|
||||||
channel.channel_type === "Group") &&
|
|
||||||
channel.nsfw
|
|
||||||
)
|
|
||||||
}>
|
|
||||||
<ChannelHeader channel={channel} />
|
<ChannelHeader channel={channel} />
|
||||||
<ChannelMain>
|
<ChannelMain>
|
||||||
<ErrorBoundary section="renderer">
|
<ErrorBoundary section="renderer">
|
||||||
@@ -208,6 +202,17 @@ const TextChannel = observer(({ channel }: { channel: ChannelI }) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function ShowAgeGate({ channel }: { channel: ChannelI }) {
|
||||||
|
const settings = useApplicationState().settings;
|
||||||
|
|
||||||
|
if (settings.get("appearance:bypass_age_gate") ?? false) return false;
|
||||||
|
return !!(
|
||||||
|
(channel.channel_type === "TextChannel" ||
|
||||||
|
channel.channel_type === "Group") &&
|
||||||
|
channel.nsfw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function VoiceChannel({ channel }: { channel: ChannelI }) {
|
function VoiceChannel({ channel }: { channel: ChannelI }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user