Post editing: Compose improvements

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
api-accept
marcin mikołajczak 2 years ago
parent 236a76e4ef
commit b8be588b60

@ -98,7 +98,7 @@ export const ensureComposeIsVisible = (getState, routerHistory) => {
}
};
export function setComposeToStatus(status, text, spoiler_text, content_type) {
export function setComposeToStatus(status, raw_text, spoiler_text, content_type) {
return (dispatch, getState) => {
const { instance } = getState();
const { explicitAddressing } = getFeatures(instance);
@ -106,7 +106,7 @@ export function setComposeToStatus(status, text, spoiler_text, content_type) {
dispatch({
type: COMPOSE_SET_STATUS,
status,
text,
raw_text,
explicitAddressing,
spoiler_text,
content_type,

@ -34,6 +34,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
placement: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
unavailable: PropTypes.bool,
};
state = {
@ -244,9 +245,13 @@ class PrivacyDropdown extends React.PureComponent {
}
render() {
const { value, intl } = this.props;
const { value, intl, unavailable } = this.props;
const { open, placement } = this.state;
if (unavailable) {
return null;
}
const valueOption = this.options.find(item => item.value === value);
return (

@ -16,6 +16,7 @@ class ScheduleButton extends React.PureComponent {
static propTypes = {
disabled: PropTypes.bool,
active: PropTypes.bool,
unavailable: PropTypes.bool,
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
@ -25,7 +26,11 @@ class ScheduleButton extends React.PureComponent {
}
render() {
const { intl, active, disabled } = this.props;
const { intl, active, unavailable, disabled } = this.props;
if (unavailable) {
return null;
}
return (
<ComposeFormButton

@ -1,8 +1,6 @@
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { getFeatures } from 'soapbox/utils/features';
import {
changeCompose,
submitCompose,
@ -12,7 +10,9 @@ import {
changeComposeSpoilerText,
insertEmojiCompose,
uploadCompose,
} from '../../../actions/compose';
} from 'soapbox/actions/compose';
import { getFeatures } from 'soapbox/utils/features';
import ComposeForm from '../components/compose_form';
const mapStateToProps = state => {

@ -8,6 +8,7 @@ import PrivacyDropdown from '../components/privacy_dropdown';
const mapStateToProps = state => ({
isModalOpen: Boolean(state.get('modals').size && state.get('modals').last().modalType === 'ACTIONS'),
value: state.getIn(['compose', 'privacy']),
unavailable: !!state.getIn(['compose', 'id']),
});
const mapDispatchToProps = dispatch => ({

@ -8,13 +8,8 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = state => {
let statusId = state.getIn(['compose', 'id'], null);
let editing = true;
if (statusId === null) {
statusId = state.getIn(['compose', 'in_reply_to']);
editing = false;
}
const statusId = state.getIn(['compose', 'in_reply_to']);
const editing = !!state.getIn(['compose', 'id']);
return {
status: getStatus(state, { id: statusId }),

@ -5,6 +5,7 @@ import ScheduleButton from '../components/schedule_button';
const mapStateToProps = state => ({
active: state.getIn(['compose', 'schedule']) ? true : false,
unavailable: !!state.getIn(['compose', 'id']),
});
const mapDispatchToProps = dispatch => ({

Loading…
Cancel
Save