2018-08-28 13:44:36 +00:00
|
|
|
{#if pinnedStatuses.length }
|
|
|
|
<h1 class="sr-only">Pinned statuses</h1>
|
|
|
|
<div role="feed" aria-label="Pinned statuses" class="pinned-statuses">
|
|
|
|
{#each pinnedStatuses as status, index (status.id)}
|
|
|
|
<Status {status}
|
|
|
|
timelineType="pinned"
|
|
|
|
timelineValue={accountId}
|
|
|
|
{index}
|
|
|
|
length={pinnedStatuses.length}
|
|
|
|
/>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
{/if}
|
2018-02-11 18:35:25 +00:00
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import Status from '../status/Status.html'
|
|
|
|
import { updatePinnedStatusesForAccount } from '../../_actions/pinnedStatuses'
|
2018-04-29 19:28:44 +00:00
|
|
|
import { on } from '../../_utils/eventBus'
|
2018-02-11 18:35:25 +00:00
|
|
|
|
|
|
|
export default {
|
2018-04-20 04:38:01 +00:00
|
|
|
async oncreate () {
|
2018-04-29 19:28:44 +00:00
|
|
|
on('updatePinnedStatuses', this, () => this.updatePinnedStatuses())
|
|
|
|
await this.updatePinnedStatuses()
|
2018-02-11 18:35:25 +00:00
|
|
|
},
|
|
|
|
computed: {
|
2018-05-02 00:05:36 +00:00
|
|
|
pinnedStatuses: ({ $pinnedStatuses, $currentInstance, accountId }) => {
|
2018-04-29 19:28:44 +00:00
|
|
|
return ($pinnedStatuses[$currentInstance] && $pinnedStatuses[$currentInstance][accountId]) || []
|
2018-02-11 18:35:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
components: {
|
2018-02-12 07:10:07 +00:00
|
|
|
Status
|
2018-04-29 19:28:44 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async updatePinnedStatuses () {
|
|
|
|
let { accountId } = this.get()
|
|
|
|
await updatePinnedStatusesForAccount(accountId)
|
|
|
|
}
|
2018-02-11 18:35:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|