Merge branch 'feature/revision-history' of https://code.gab.com/gab/social/gab-social into develop

This commit is contained in:
Rob Colbert 2019-09-18 13:19:24 -04:00
commit 5135622fe2
3 changed files with 17 additions and 11 deletions

View File

@ -33,12 +33,17 @@ export default class DetailedStatus extends ImmutablePureComponent {
compact: PropTypes.bool,
showMedia: PropTypes.bool,
onToggleMediaVisibility: PropTypes.func,
onShowRevisions: PropTypes.func,
};
state = {
height: null,
};
handleShowRevisions = () => {
this.props.onShowRevisions(this.props.status);
}
handleOpenVideo = (media, startTime) => {
this.props.onOpenVideo(media, startTime);
}
@ -187,11 +192,12 @@ export default class DetailedStatus extends ImmutablePureComponent {
<DisplayName account={status.get('account')} localDomain={this.props.domain} />
</NavLink>
{status.get('group') && (
<div className='status__meta'>
Posted in <NavLink to={`/groups/${status.getIn(['group', 'id'])}`}>{status.getIn(['group', 'title'])}</NavLink>
</div>
)}
{(status.get('group') || status.get('revised_at') !== null) && (
<div className='status__meta'>
{status.get('group') && <React.Fragment>Posted in <NavLink to={`/groups/${status.getIn(['group', 'id'])}`}>{status.getIn(['group', 'title'])}</NavLink></React.Fragment>}
{status.get('revised_at') !== null && <a onClick={this.handleShowRevisions}> Edited</a>}
</div>
)}
<StatusContent status={status} expanded={!status.get('hidden')} onExpandedToggle={this.handleExpandedToggle} />

View File

@ -175,6 +175,10 @@ class Status extends ImmutablePureComponent {
}
}
handleShowRevisions = (status) => {
this.props.dispatch(openModal('STATUS_REVISION', { status }));
}
handleReplyClick = (status) => {
let { askReplyConfirmation, dispatch, intl } = this.props;
if (askReplyConfirmation) {
@ -504,6 +508,7 @@ class Status extends ImmutablePureComponent {
domain={domain}
showMedia={this.state.showMedia}
onToggleMediaVisibility={this.handleToggleMediaVisibility}
onShowRevisions={this.handleShowRevisions}
/>
<ActionBar

View File

@ -47,12 +47,7 @@ class EditStatusService < BaseService
end
def process_status!
# The following transaction block is needed to wrap the UPDATEs to
# the media attachments when the status is created
ApplicationRecord.transaction do
@status.update!(status_attributes)
end
@status.update!(status_attributes)
process_hashtags_service.call(@status)
process_mentions_service.call(@status)