refs #53 Display reblog status when toot is reblogged

This commit is contained in:
AkiraFukushima 2018-03-14 22:54:19 +09:00
parent 7d143104c8
commit 572dfdaae9
2 changed files with 10 additions and 3 deletions

View File

@ -17,7 +17,7 @@
<el-button type="text" @click="openReply(message)"> <el-button type="text" @click="openReply(message)">
<icon name="reply" scale="0.9"></icon> <icon name="reply" scale="0.9"></icon>
</el-button> </el-button>
<el-button type="text" @click="changeReblog(message)"> <el-button type="text" @click="changeReblog(message)" :class="message.reblogged ? 'reblogged' : ''">
<icon name="retweet" scale="0.9"></icon> <icon name="retweet" scale="0.9"></icon>
</el-button> </el-button>
<el-button type="text" @click="changeFavourite(message)" :class="message.favourited ? 'favourited' : ''"> <el-button type="text" @click="changeFavourite(message)" :class="message.favourited ? 'favourited' : ''">
@ -166,6 +166,10 @@ function findLink (target) {
color: #909399; color: #909399;
} }
.reblogged {
color: #409eff;
}
.favourited { .favourited {
color: #e6a23c; color: #e6a23c;
} }

View File

@ -15,8 +15,11 @@ const Toot = {
) )
client.post(`/statuses/${message.id}/reblog`, {}, (err, data, res) => { client.post(`/statuses/${message.id}/reblog`, {}, (err, data, res) => {
if (err) return reject(err) if (err) return reject(err)
commit('TimelineSpace/updateToot', data, { root: true }) // API returns new status when reblog.
resolve(data) // Reblog target status is in the data.reblog.
// So I send data.reblog as status for update local timeline.
commit('TimelineSpace/updateToot', data.reblog, { root: true })
resolve(data.reblog)
}) })
}) })
}, },