refactor status some more

This commit is contained in:
Nolan Lawson 2018-02-04 10:55:10 -08:00
parent 76e78e70e5
commit 835a9a5b28
2 changed files with 6 additions and 9 deletions

View File

@ -13,12 +13,8 @@
{{#if !originalStatus.spoiler_text || spoilerShown}} {{#if !originalStatus.spoiler_text || spoilerShown}}
<StatusContent status="{{originalStatus}}" /> <StatusContent status="{{originalStatus}}" />
{{/if}} {{/if}}
{{#if originalStatusMediaAttachments && originalStatusMediaAttachments.length}} {{#if hasMedia}}
<StatusMediaAttachments <StatusMediaAttachments status="{{originalStatus}}" on:recalculateHeight />
status="{{originalStatus}}"
mediaAttachments="{{originalStatusMediaAttachments}}"
on:recalculateHeight
/>
{{/if}} {{/if}}
<StatusToolbar :status /> <StatusToolbar :status />
</article> </article>
@ -74,11 +70,11 @@
}, },
store: () => store, store: () => store,
computed: { computed: {
isStatusInContext: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId,
originalStatus: (status) => status.reblog ? status.reblog : status, originalStatus: (status) => status.reblog ? status.reblog : status,
originalAccount: (originalStatus) => originalStatus.account,
originalStatusMediaAttachments: (originalStatus) => originalStatus.media_attachments,
statusId: (originalStatus) => originalStatus.id, statusId: (originalStatus) => originalStatus.id,
hasMedia: (originalStatus) => originalStatus.media_attachments && originalStatus.media_attachments.length,
isStatusInContext: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId,
originalAccount: (originalStatus) => originalStatus.account,
spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId] spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId]
} }
} }

View File

@ -119,6 +119,7 @@
}, },
store: () => store, store: () => store,
computed: { computed: {
mediaAttachments: (status) => status.media_attachments,
sensitiveShown: ($sensitivesShown, $currentInstance, statusId) => { sensitiveShown: ($sensitivesShown, $currentInstance, statusId) => {
return $sensitivesShown && $sensitivesShown[$currentInstance] && $sensitivesShown[$currentInstance][statusId] return $sensitivesShown && $sensitivesShown[$currentInstance] && $sensitivesShown[$currentInstance][statusId]
}, },