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
|
<Modal
|
||||||
width="70%"
|
width="70%"
|
||||||
title="Enable Social Features"
|
title="Enable Social Features"
|
||||||
visible
|
open
|
||||||
onCancel={cancelPressed}
|
onCancel={cancelPressed}
|
||||||
footer={
|
footer={
|
||||||
<div>
|
<div>
|
||||||
@@ -125,6 +125,17 @@ const ConfigFederation = () => {
|
|||||||
|
|
||||||
const handleEnabledSwitchChange = (value: boolean) => {
|
const handleEnabledSwitchChange = (value: boolean) => {
|
||||||
if (!value) {
|
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({
|
setFormDataValues({
|
||||||
...formDataValues,
|
...formDataValues,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -153,6 +164,17 @@ const ConfigFederation = () => {
|
|||||||
|
|
||||||
function federationInfoModalCancelPressed() {
|
function federationInfoModalCancelPressed() {
|
||||||
setIsInfoModalOpen(false);
|
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({
|
setFormDataValues({
|
||||||
...formDataValues,
|
...formDataValues,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -161,6 +183,17 @@ const ConfigFederation = () => {
|
|||||||
|
|
||||||
function federationInfoModalOkPressed() {
|
function federationInfoModalOkPressed() {
|
||||||
setIsInfoModalOpen(false);
|
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({
|
setFormDataValues({
|
||||||
...formDataValues,
|
...formDataValues,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ export const FIELD_PROPS_ENABLE_FEDERATION = {
|
|||||||
configPath: 'federation',
|
configPath: 'federation',
|
||||||
label: 'Enable Social Features',
|
label: 'Enable Social Features',
|
||||||
tip: 'Send and receive activities on the Fediverse.',
|
tip: 'Send and receive activities on the Fediverse.',
|
||||||
useSubmit: true,
|
useSubmit: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FIELD_PROPS_FEDERATION_IS_PRIVATE = {
|
export const FIELD_PROPS_FEDERATION_IS_PRIVATE = {
|
||||||
|
|||||||
Reference in New Issue
Block a user