kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Post editing: Compose improvements
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>api-accept
rodzic
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) => {
|
return (dispatch, getState) => {
|
||||||
const { instance } = getState();
|
const { instance } = getState();
|
||||||
const { explicitAddressing } = getFeatures(instance);
|
const { explicitAddressing } = getFeatures(instance);
|
||||||
|
@ -106,7 +106,7 @@ export function setComposeToStatus(status, text, spoiler_text, content_type) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: COMPOSE_SET_STATUS,
|
type: COMPOSE_SET_STATUS,
|
||||||
status,
|
status,
|
||||||
text,
|
raw_text,
|
||||||
explicitAddressing,
|
explicitAddressing,
|
||||||
spoiler_text,
|
spoiler_text,
|
||||||
content_type,
|
content_type,
|
||||||
|
|
|
@ -34,6 +34,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
|
||||||
placement: PropTypes.string.isRequired,
|
placement: PropTypes.string.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
|
unavailable: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -244,9 +245,13 @@ class PrivacyDropdown extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { value, intl } = this.props;
|
const { value, intl, unavailable } = this.props;
|
||||||
const { open, placement } = this.state;
|
const { open, placement } = this.state;
|
||||||
|
|
||||||
|
if (unavailable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const valueOption = this.options.find(item => item.value === value);
|
const valueOption = this.options.find(item => item.value === value);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -16,6 +16,7 @@ class ScheduleButton extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
active: PropTypes.bool,
|
active: PropTypes.bool,
|
||||||
|
unavailable: PropTypes.bool,
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -25,7 +26,11 @@ class ScheduleButton extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, active, disabled } = this.props;
|
const { intl, active, unavailable, disabled } = this.props;
|
||||||
|
|
||||||
|
if (unavailable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ComposeFormButton
|
<ComposeFormButton
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { getFeatures } from 'soapbox/utils/features';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
changeCompose,
|
changeCompose,
|
||||||
submitCompose,
|
submitCompose,
|
||||||
|
@ -12,7 +10,9 @@ import {
|
||||||
changeComposeSpoilerText,
|
changeComposeSpoilerText,
|
||||||
insertEmojiCompose,
|
insertEmojiCompose,
|
||||||
uploadCompose,
|
uploadCompose,
|
||||||
} from '../../../actions/compose';
|
} from 'soapbox/actions/compose';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
import ComposeForm from '../components/compose_form';
|
import ComposeForm from '../components/compose_form';
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import PrivacyDropdown from '../components/privacy_dropdown';
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
isModalOpen: Boolean(state.get('modals').size && state.get('modals').last().modalType === 'ACTIONS'),
|
isModalOpen: Boolean(state.get('modals').size && state.get('modals').last().modalType === 'ACTIONS'),
|
||||||
value: state.getIn(['compose', 'privacy']),
|
value: state.getIn(['compose', 'privacy']),
|
||||||
|
unavailable: !!state.getIn(['compose', 'id']),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
|
@ -8,13 +8,8 @@ const makeMapStateToProps = () => {
|
||||||
const getStatus = makeGetStatus();
|
const getStatus = makeGetStatus();
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
let statusId = state.getIn(['compose', 'id'], null);
|
const statusId = state.getIn(['compose', 'in_reply_to']);
|
||||||
let editing = true;
|
const editing = !!state.getIn(['compose', 'id']);
|
||||||
|
|
||||||
if (statusId === null) {
|
|
||||||
statusId = state.getIn(['compose', 'in_reply_to']);
|
|
||||||
editing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: getStatus(state, { id: statusId }),
|
status: getStatus(state, { id: statusId }),
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ScheduleButton from '../components/schedule_button';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
active: state.getIn(['compose', 'schedule']) ? true : false,
|
active: state.getIn(['compose', 'schedule']) ? true : false,
|
||||||
|
unavailable: !!state.getIn(['compose', 'id']),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
Ładowanie…
Reference in New Issue