Skip to content

Commit

Permalink
#24 Fix editing circle post icon
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Sep 26, 2023
1 parent 13c5113 commit 28ab1ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ class ComposeForm extends ImmutablePureComponent {
};

canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia, privacy, circleId } = this.props;
const { isSubmitting, isChangingUpload, isUploading, anyMedia, privacy, circleId, isEditing } = this.props;
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia) || (privacy === 'circle' && !circleId));
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia) || (privacy === 'circle' && !isEditing && !circleId));
};

handleSubmit = (e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { changeCircle } from '../../../actions/compose';
import CircleSelect from '../components/circle_select';

const mapStateToProps = state => ({
unavailable: state.getIn(['compose', 'privacy']) !== 'circle',
unavailable: state.getIn(['compose', 'privacy']) !== 'circle' || !!state.getIn(['compose', 'id']),
circles: state.get('circles'),
circleId: state.getIn(['compose', 'circle_id']),
});
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/mastodon/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,11 @@ export default function compose(state = initialState, action) {
map.set('id', action.status.get('id'));
map.set('text', action.text);
map.set('in_reply_to', action.status.get('in_reply_to_id'));
map.set('privacy', action.status.get('visibility_ex'));
if (action.status.get('visibility_ex') !== 'limited') {
map.set('privacy', action.status.get('visibility_ex'));
} else {
map.set('privacy', action.status.get('limited_scope') === 'mutual' ? 'mutual' : 'circle');
}
map.set('media_attachments', action.status.get('media_attachments'));
map.set('focusDate', new Date());
map.set('caretPosition', null);
Expand Down

0 comments on commit 28ab1ca

Please sign in to comment.