Add admin support for established user mode. https://github.com/owncast/owncast/issues/1587 (#430)
This commit is contained in:
parent
d6604300e1
commit
181a7c3431
@ -16,6 +16,7 @@ import {
|
||||
API_CHAT_FORBIDDEN_USERNAMES,
|
||||
API_CHAT_SUGGESTED_USERNAMES,
|
||||
FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED,
|
||||
CHAT_ESTABLISHED_USER_MODE,
|
||||
FIELD_PROPS_DISABLE_CHAT,
|
||||
postConfigUpdateToAPI,
|
||||
RESET_TIMEOUT,
|
||||
@ -39,6 +40,7 @@ export default function ConfigChat() {
|
||||
forbiddenUsernames,
|
||||
instanceDetails,
|
||||
suggestedUsernames,
|
||||
chatEstablishedUserMode,
|
||||
} = serverConfig;
|
||||
const { welcomeMessage } = instanceDetails;
|
||||
|
||||
@ -57,6 +59,10 @@ export default function ConfigChat() {
|
||||
handleFieldChange({ fieldName: 'chatJoinMessagesEnabled', value: enabled });
|
||||
}
|
||||
|
||||
function handleEstablishedUserModeChange(enabled: boolean) {
|
||||
handleFieldChange({ fieldName: 'chatEstablishedUserMode', value: enabled });
|
||||
}
|
||||
|
||||
function resetForbiddenUsernameState() {
|
||||
setForbiddenUsernameSaveState(null);
|
||||
}
|
||||
@ -146,6 +152,7 @@ export default function ConfigChat() {
|
||||
forbiddenUsernames,
|
||||
suggestedUsernames,
|
||||
welcomeMessage,
|
||||
chatEstablishedUserMode,
|
||||
});
|
||||
}, [serverConfig]);
|
||||
|
||||
@ -170,6 +177,12 @@ export default function ConfigChat() {
|
||||
checked={formDataValues.chatJoinMessagesEnabled}
|
||||
onChange={handleChatJoinMessagesEnabledChange}
|
||||
/>
|
||||
<ToggleSwitch
|
||||
fieldName="establishedUserMode"
|
||||
{...CHAT_ESTABLISHED_USER_MODE}
|
||||
checked={formDataValues.chatEstablishedUserMode}
|
||||
onChange={handleEstablishedUserModeChange}
|
||||
/>
|
||||
<TextFieldWithSubmit
|
||||
fieldName="welcomeMessage"
|
||||
{...TEXTFIELD_PROPS_SERVER_WELCOME_MESSAGE}
|
||||
|
@ -115,5 +115,6 @@ export interface ConfigDetails {
|
||||
suggestedUsernames: string[];
|
||||
chatDisabled: boolean;
|
||||
chatJoinMessagesEnabled: boolean;
|
||||
chatEstablishedUserMode: boolean;
|
||||
federation: Federation;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ export const API_WEB_PORT = '/webserverport';
|
||||
export const API_YP_SWITCH = '/directoryenabled';
|
||||
export const API_CHAT_DISABLE = '/chat/disable';
|
||||
export const API_CHAT_JOIN_MESSAGES_ENABLED = '/chat/joinmessagesenabled';
|
||||
export const API_CHAT_ESTABLISHED_MODE = '/chat/establishedusermode';
|
||||
export const API_CHAT_FORBIDDEN_USERNAMES = '/chat/forbiddenusernames';
|
||||
export const API_CHAT_SUGGESTED_USERNAMES = '/chat/suggestedusernames';
|
||||
export const API_EXTERNAL_ACTIONS = '/externalactions';
|
||||
@ -212,6 +213,13 @@ export const FIELD_PROPS_CHAT_JOIN_MESSAGES_ENABLED = {
|
||||
configPath: '',
|
||||
label: 'Join Messages',
|
||||
tip: 'Show when a viewer joins the chat.',
|
||||
};
|
||||
|
||||
export const CHAT_ESTABLISHED_USER_MODE = {
|
||||
apiPath: API_CHAT_ESTABLISHED_MODE,
|
||||
configPath: '',
|
||||
label: 'Established users only',
|
||||
tip: 'Only users who have previously been established for some time may chat.',
|
||||
useSubmit: true,
|
||||
};
|
||||
|
||||
|
@ -61,6 +61,7 @@ export const initialServerConfigState: ConfigDetails = {
|
||||
suggestedUsernames: [],
|
||||
chatDisabled: false,
|
||||
chatJoinMessagesEnabled: true,
|
||||
chatEstablishedUserMode: false,
|
||||
};
|
||||
|
||||
const initialServerStatusState = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user