mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 18:15: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" />
|
||||
}
|
||||
/>
|
||||
{/* 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 />
|
||||
<h3>
|
||||
<Text id="app.settings.pages.appearance.theme_options.title" />
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface ISettings {
|
||||
"appearance:transparency": boolean;
|
||||
"appearance:show_send_button": boolean;
|
||||
"appearance:show_account_age": boolean;
|
||||
"appearance:bypass_age_gate": boolean;
|
||||
|
||||
"appearance:theme:base": "dark" | "light";
|
||||
"appearance:theme:overrides": Partial<Overrides>;
|
||||
@@ -37,8 +38,7 @@ export interface ISettings {
|
||||
* Manages user settings.
|
||||
*/
|
||||
export default class Settings
|
||||
implements Store, Persistent<ISettings>, Syncable
|
||||
{
|
||||
implements Store, Persistent<ISettings>, Syncable {
|
||||
private data: ObservableMap<string, unknown>;
|
||||
|
||||
theme: STheme;
|
||||
|
||||
@@ -180,13 +180,7 @@ const TextChannel = observer(({ channel }: { channel: ChannelI }) => {
|
||||
<AgeGate
|
||||
type="channel"
|
||||
channel={channel}
|
||||
gated={
|
||||
!!(
|
||||
(channel.channel_type === "TextChannel" ||
|
||||
channel.channel_type === "Group") &&
|
||||
channel.nsfw
|
||||
)
|
||||
}>
|
||||
gated={ShowAgeGate({ channel })}>
|
||||
<ChannelHeader channel={channel} />
|
||||
<ChannelMain>
|
||||
<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 }) {
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user