fix(social): set federation enabled state after confirmation (#4038)
* feat(integerations): add route to get user details * Commit updated API documentation * test(integrations): implement unit test for get user details * fix(social): set federation enabled state after confirmation set federation enabled state only after confirmation in modal * Javascript formatting autofixes * chore(social): use variable instead of explicitly setting path value * Javascript formatting autofixes --------- Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
@@ -37,7 +37,7 @@ const FederationInfoModal: FC<FederationInfoModalProps> = ({ cancelPressed, okPr
|
||||
<Modal
|
||||
width="70%"
|
||||
title="Enable Social Features"
|
||||
visible
|
||||
open
|
||||
onCancel={cancelPressed}
|
||||
footer={
|
||||
<div>
|
||||
@@ -125,6 +125,17 @@ const ConfigFederation = () => {
|
||||
|
||||
const handleEnabledSwitchChange = (value: boolean) => {
|
||||
if (!value) {
|
||||
postConfigUpdateToAPI({
|
||||
apiPath: FIELD_PROPS_ENABLE_FEDERATION.apiPath,
|
||||
data: { value: false },
|
||||
onSuccess: () => {
|
||||
setFieldInConfigState({
|
||||
fieldName: 'enabled',
|
||||
value: false,
|
||||
path: FIELD_PROPS_ENABLE_FEDERATION.configPath,
|
||||
});
|
||||
},
|
||||
});
|
||||
setFormDataValues({
|
||||
...formDataValues,
|
||||
enabled: false,
|
||||
@@ -153,6 +164,17 @@ const ConfigFederation = () => {
|
||||
|
||||
function federationInfoModalCancelPressed() {
|
||||
setIsInfoModalOpen(false);
|
||||
postConfigUpdateToAPI({
|
||||
apiPath: FIELD_PROPS_ENABLE_FEDERATION.apiPath,
|
||||
data: { value: false },
|
||||
onSuccess: () => {
|
||||
setFieldInConfigState({
|
||||
fieldName: 'enabled',
|
||||
value: false,
|
||||
path: FIELD_PROPS_ENABLE_FEDERATION.configPath,
|
||||
});
|
||||
},
|
||||
});
|
||||
setFormDataValues({
|
||||
...formDataValues,
|
||||
enabled: false,
|
||||
@@ -161,6 +183,17 @@ const ConfigFederation = () => {
|
||||
|
||||
function federationInfoModalOkPressed() {
|
||||
setIsInfoModalOpen(false);
|
||||
postConfigUpdateToAPI({
|
||||
apiPath: FIELD_PROPS_ENABLE_FEDERATION.apiPath,
|
||||
data: { value: false },
|
||||
onSuccess: () => {
|
||||
setFieldInConfigState({
|
||||
fieldName: 'enabled',
|
||||
value: true,
|
||||
path: FIELD_PROPS_ENABLE_FEDERATION.configPath,
|
||||
});
|
||||
},
|
||||
});
|
||||
setFormDataValues({
|
||||
...formDataValues,
|
||||
enabled: true,
|
||||
|
||||
@@ -313,7 +313,7 @@ export const FIELD_PROPS_ENABLE_FEDERATION = {
|
||||
configPath: 'federation',
|
||||
label: 'Enable Social Features',
|
||||
tip: 'Send and receive activities on the Fediverse.',
|
||||
useSubmit: true,
|
||||
useSubmit: false,
|
||||
};
|
||||
|
||||
export const FIELD_PROPS_FEDERATION_IS_PRIVATE = {
|
||||
|
||||
Reference in New Issue
Block a user