Fix composer offering to edit federation settings for an existing post

This commit is contained in:
Claire 2024-02-23 17:34:11 +01:00
parent 23dc650596
commit e62cd93650
2 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import { IconButton } from 'flavours/glitch/components/icon_button';
import DropdownMenu from './dropdown_menu';
export const DropdownIconButton = ({ value, icon, onChange, iconComponent, title, options }) => {
export const DropdownIconButton = ({ value, disabled, icon, onChange, iconComponent, title, options }) => {
const containerRef = useRef(null);
const [activeElement, setActiveElement] = useState(null);
@ -39,6 +39,7 @@ export const DropdownIconButton = ({ value, icon, onChange, iconComponent, title
return (
<div ref={containerRef}>
<IconButton
disabled={disabled}
icon={icon}
onClick={handleToggle}
iconComponent={iconComponent}
@ -68,6 +69,7 @@ export const DropdownIconButton = ({ value, icon, onChange, iconComponent, title
DropdownIconButton.propTypes = {
value: PropTypes.string.isRequired,
disabled: PropTypes.bool,
icon: PropTypes.string,
onChange: PropTypes.func.isRequired,
iconComponent: PropTypes.func.isRequired,

View File

@ -20,6 +20,7 @@ const messages = defineMessages({
export const FederationButton = () => {
const intl = useIntl();
const isEditing = useAppSelector((state) => state.getIn(['compose', 'id']) !== null);
const do_not_federate = useAppSelector((state) => state.getIn(['compose', 'advanced_options', 'do_not_federate']));
const dispatch = useAppDispatch();
@ -34,6 +35,7 @@ export const FederationButton = () => {
return (
<DropdownIconButton
disabled={isEditing}
icon={do_not_federate ? 'link-slash' : 'link'}
iconComponent={do_not_federate ? ShareOffIcon : ShareIcon}
onChange={handleChange}