[Glitch] Add editing for published statuses

Port 63002cde03 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Eugen Rochko
2022-02-10 00:15:30 +01:00
committed by Claire
parent abd113167b
commit 5e67858fbc
11 changed files with 170 additions and 71 deletions

View File

@ -51,6 +51,7 @@ function mapStateToProps (state) {
focusDate: state.getIn(['compose', 'focusDate']),
caretPosition: state.getIn(['compose', 'caretPosition']),
isSubmitting: state.getIn(['compose', 'is_submitting']),
isEditing: state.getIn(['compose', 'id']) !== null,
isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
isUploading: state.getIn(['compose', 'is_uploading']),
layout: state.getIn(['local_settings', 'layout']),

View File

@ -1,14 +1,24 @@
import { connect } from 'react-redux';
import { cancelReplyCompose } from 'flavours/glitch/actions/compose';
import { makeGetStatus } from 'flavours/glitch/selectors';
import ReplyIndicator from '../components/reply_indicator';
function makeMapStateToProps (state) {
const inReplyTo = state.getIn(['compose', 'in_reply_to']);
const makeMapStateToProps = () => {
const mapStateToProps = state => {
let statusId = state.getIn(['compose', 'id'], null);
let editing = true;
return {
status: inReplyTo ? state.getIn(['statuses', inReplyTo]) : null,
if (statusId === null) {
statusId = state.getIn(['compose', 'in_reply_to']);
editing = false;
}
return {
status: state.getIn(['statuses', statusId]),
editing,
};
};
return mapStateToProps;
};
const mapDispatchToProps = dispatch => ({