#468 - pin/unpin status
This commit is contained in:
parent
b491e6acbe
commit
1aa0e8d7e0
@ -353,6 +353,16 @@ const Status = {
|
|||||||
this.expandingSubject = true
|
this.expandingSubject = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
pinStatus () {
|
||||||
|
this.$store.state.api.backendInteractor.pinOwnStatus(this.status.id).then((status) => {
|
||||||
|
this.$store.dispatch('updatePinned', status)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
unpinStatus () {
|
||||||
|
this.$store.state.api.backendInteractor.unpinOwnStatus(this.status.id).then((status) => {
|
||||||
|
this.$store.dispatch('updatePinned', status)
|
||||||
|
})
|
||||||
|
},
|
||||||
replyEnter (id, event) {
|
replyEnter (id, event) {
|
||||||
this.showPreview = true
|
this.showPreview = true
|
||||||
const targetId = id
|
const targetId = id
|
||||||
|
@ -52,12 +52,18 @@
|
|||||||
<a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source">
|
<a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source">
|
||||||
<i class="button-icon icon-link-ext-alt"></i>
|
<i class="button-icon icon-link-ext-alt"></i>
|
||||||
</a>
|
</a>
|
||||||
<template v-if="expandable && !isPreview">
|
<div class="button-icon button-action-icon" v-if="!status.pinned" @click.prevent="pinStatus" title="Pin">
|
||||||
<a href="#" @click.prevent="toggleExpanded" title="Expand">
|
<i class="fa icon-pin"></i>
|
||||||
<i class="button-icon icon-plus-squared"></i>
|
</div>
|
||||||
</a>
|
<div class="button-icon button-action-icon" v-else @click.prevent="unpinStatus" title="Unpin">
|
||||||
</template>
|
<i class="fa icon-cancel"></i>
|
||||||
<a href="#" @click.prevent="toggleMute" v-if="unmuted"><i class="button-icon icon-eye-off"></i></a>
|
</div>
|
||||||
|
<div class="button-icon button-action-icon" v-if="expandable && !isPreview" @click.prevent="toggleExpanded" title="Expand">
|
||||||
|
<i class="button-icon icon-plus-squared"></i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon button-action-icon" v-if="unmuted" @click.prevent="toggleMute" title="Toggle Mute">
|
||||||
|
<i class="button-icon icon-eye-off"></i>
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -678,6 +684,10 @@ a.unmute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-action-icon {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
@media all and (max-width: 800px) {
|
@media all and (max-width: 800px) {
|
||||||
.status-el {
|
.status-el {
|
||||||
.retweet-info {
|
.retweet-info {
|
||||||
|
@ -424,6 +424,10 @@ export const mutations = {
|
|||||||
newStatus.favoritedBy.push(user)
|
newStatus.favoritedBy.push(user)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setPinned (state, { status }) {
|
||||||
|
const newStatus = state.allStatusesObject[status.id]
|
||||||
|
newStatus.pinned = status.pinned
|
||||||
|
},
|
||||||
setRetweeted (state, { status, value }) {
|
setRetweeted (state, { status, value }) {
|
||||||
const newStatus = state.allStatusesObject[status.id]
|
const newStatus = state.allStatusesObject[status.id]
|
||||||
|
|
||||||
@ -533,6 +537,9 @@ const statuses = {
|
|||||||
rootState.api.backendInteractor.unfavorite(status.id)
|
rootState.api.backendInteractor.unfavorite(status.id)
|
||||||
.then(status => commit('setFavoritedConfirm', { status, user: rootState.users.currentUser }))
|
.then(status => commit('setFavoritedConfirm', { status, user: rootState.users.currentUser }))
|
||||||
},
|
},
|
||||||
|
updatePinned ({ rootState, commit }, status) {
|
||||||
|
commit('setPinned', { status })
|
||||||
|
},
|
||||||
retweet ({ rootState, commit }, status) {
|
retweet ({ rootState, commit }, status) {
|
||||||
// Optimistic retweeting...
|
// Optimistic retweeting...
|
||||||
commit('setRetweeted', { status, value: true })
|
commit('setRetweeted', { status, value: true })
|
||||||
|
@ -211,6 +211,7 @@ export const parseStatus = (data) => {
|
|||||||
|
|
||||||
output.summary_html = addEmojis(data.spoiler_text, data.emojis)
|
output.summary_html = addEmojis(data.spoiler_text, data.emojis)
|
||||||
output.external_url = data.url
|
output.external_url = data.url
|
||||||
|
output.pinned = data.pinned
|
||||||
} else {
|
} else {
|
||||||
output.favorited = data.favorited
|
output.favorited = data.favorited
|
||||||
output.fave_num = data.fave_num
|
output.fave_num = data.fave_num
|
||||||
|
Loading…
Reference in New Issue
Block a user