2018-08-28 15:44:36 +02: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 19:35:25 +01:00
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import Status from '../status/Status.html'
|
|
|
|
import { updatePinnedStatusesForAccount } from '../../_actions/pinnedStatuses'
|
2018-04-29 21:28:44 +02:00
|
|
|
import { on } from '../../_utils/eventBus'
|
2018-02-11 19:35:25 +01:00
|
|
|
|
|
|
|
export default {
|
2018-04-20 06:38:01 +02:00
|
|
|
async oncreate () {
|
2018-04-29 21:28:44 +02:00
|
|
|
on('updatePinnedStatuses', this, () => this.updatePinnedStatuses())
|
|
|
|
await this.updatePinnedStatuses()
|
2018-02-11 19:35:25 +01:00
|
|
|
},
|
|
|
|
computed: {
|
2018-05-02 02:05:36 +02:00
|
|
|
pinnedStatuses: ({ $pinnedStatuses, $currentInstance, accountId }) => {
|
2018-04-29 21:28:44 +02:00
|
|
|
return ($pinnedStatuses[$currentInstance] && $pinnedStatuses[$currentInstance][accountId]) || []
|
2018-02-11 19:35:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
components: {
|
2018-02-12 08:10:07 +01:00
|
|
|
Status
|
2018-04-29 21:28:44 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async updatePinnedStatuses () {
|
|
|
|
let { accountId } = this.get()
|
|
|
|
await updatePinnedStatusesForAccount(accountId)
|
|
|
|
}
|
2018-02-11 19:35:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|