Normalization, process quotes in importFetchedStatuses
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
67006fdc34
commit
fc0a5aea9c
5 changed files with 17 additions and 9 deletions
|
@ -124,6 +124,10 @@ export function importFetchedStatuses(statuses) {
|
|||
processStatus(status.reblog);
|
||||
}
|
||||
|
||||
if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) {
|
||||
processStatus(status.pleroma.quote);
|
||||
}
|
||||
|
||||
if (status.poll && status.poll.id) {
|
||||
pushUnique(polls, normalizePoll(status.poll));
|
||||
}
|
||||
|
|
|
@ -49,6 +49,10 @@ export function normalizeStatus(status, normalOldStatus, expandSpoilers) {
|
|||
normalStatus.poll = status.poll.id;
|
||||
}
|
||||
|
||||
if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) {
|
||||
normalStatus.quote = status.pleroma.quote.id;
|
||||
}
|
||||
|
||||
// Only calculate these values when status first encountered
|
||||
// Otherwise keep the ones already in the reducer
|
||||
if (normalOldStatus) {
|
||||
|
|
|
@ -458,7 +458,7 @@ class Status extends ImmutablePureComponent {
|
|||
</Bundle>
|
||||
);
|
||||
}
|
||||
} else if (status.get('spoiler_text').length === 0 && !status.getIn(['pleroma', 'quote']) && status.get('card')) {
|
||||
} else if (status.get('spoiler_text').length === 0 && !status.get('quote') && status.get('card')) {
|
||||
media = (
|
||||
<Card
|
||||
onOpenMedia={this.props.onOpenMedia}
|
||||
|
@ -476,8 +476,8 @@ class Status extends ImmutablePureComponent {
|
|||
|
||||
let quote;
|
||||
|
||||
if (status.getIn(['pleroma', 'quote'])) {
|
||||
quote = <QuotedStatus statusId={status.getIn(['pleroma', 'quote', 'id'])} />;
|
||||
if (status.get('quote')) {
|
||||
quote = <QuotedStatus statusId={status.get('quote')} />;
|
||||
}
|
||||
|
||||
if (otherAccounts && otherAccounts.size > 1) {
|
||||
|
|
|
@ -157,14 +157,14 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
/>
|
||||
);
|
||||
}
|
||||
} else if (status.get('spoiler_text').length === 0 && !status.getIn(['pleroma', 'quote'])) {
|
||||
} else if (status.get('spoiler_text').length === 0 && !status.get('quote')) {
|
||||
media = <Card onOpenMedia={this.props.onOpenMedia} card={status.get('card', null)} />;
|
||||
}
|
||||
|
||||
let quote;
|
||||
|
||||
if (status.getIn(['pleroma', 'quote'])) {
|
||||
quote = <QuotedStatus statusId={status.getIn(['pleroma', 'quote', 'id'])} />;
|
||||
if (status.get('quote')) {
|
||||
quote = <QuotedStatus statusId={status.get('quote')} />;
|
||||
}
|
||||
|
||||
if (status.get('visibility') === 'direct') {
|
||||
|
|
|
@ -7,11 +7,11 @@ import QuotedStatus from '../components/quoted_status';
|
|||
const makeMapStateToProps = () => {
|
||||
const getStatus = makeGetStatus();
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
status: getStatus(state, { id: props.statusId }),
|
||||
const mapStateToProps = (state, { statusId }) => ({
|
||||
status: getStatus(state, { id: statusId }),
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
};
|
||||
|
||||
export default connect(makeMapStateToProps)(QuotedStatus);
|
||||
export default connect(makeMapStateToProps)(QuotedStatus);
|
||||
|
|
Loading…
Reference in a new issue