1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-05 03:38:55 +01:00

Merge pull request #70 from h3poteto/iss-30

fixes #30 Fix reblog/favourite target too is reblogged
This commit is contained in:
AkiraFukushima 2018-03-14 23:44:11 +09:00 committed by GitHub
commit fefa03b50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 14 deletions

View File

@ -1,12 +1,12 @@
<template>
<div class="toot">
<div class="icon">
<img :src="contributorIcon(message)" />
<img :src="originalMessage(message).account.avatar" />
</div>
<div class="detail">
<div class="toot-header">
<div class="user">
{{ contributorName(message) }}
{{ originalMessage(message).account.display_name }}
</div>
<div class="timestamp">
{{ parseDatetime(message.created_at) }}
@ -26,10 +26,10 @@
<el-button type="text" @click="openReply(message)">
<icon name="reply" scale="0.9"></icon>
</el-button>
<el-button type="text" @click="changeReblog(message)" :class="message.reblogged ? 'reblogged' : ''">
<el-button type="text" @click="changeReblog(originalMessage(message))" :class="originalMessage(message).reblogged ? 'reblogged' : ''">
<icon name="retweet" scale="0.9"></icon>
</el-button>
<el-button type="text" @click="changeFavourite(message)" :class="message.favourited ? 'favourited' : ''">
<el-button type="text" @click="changeFavourite(originalMessage(message))" :class="originalMessage(message).favourited ? 'favourited' : ''">
<icon name="star" scale="0.9"></icon>
</el-button>
</div>
@ -47,18 +47,11 @@ export default {
name: 'toot',
props: ['message'],
methods: {
contributorIcon (message) {
originalMessage (message) {
if (message.reblog !== null) {
return message.reblog.account.avatar
return message.reblog
} else {
return message.account.avatar
}
},
contributorName (message) {
if (message.reblog !== null) {
return message.reblog.account.display_name
} else {
return message.account.display_name
return message
}
},
parseDatetime (datetime) {

View File

@ -51,12 +51,21 @@ const TimelineSpace = {
state.homeTimeline = state.homeTimeline.map((toot) => {
if (toot.id === message.id) {
return message
} else if (toot.reblog !== null && toot.reblog.id === message.id) {
// When user reblog/favourite a reblogged toot, target message is a original toot.
// So, a message which is received now is original toot.
const reblog = {
reblog: message
}
return Object.assign(toot, reblog)
} else {
return toot
}
})
state.notifications = state.notifications.map((notification) => {
// I want to update toot only mention.
// Because Toot component don't use status information when other patterns.
if (notification.type === 'mention' && notification.status.id === message.id) {
const status = {
status: message

View File

@ -13,6 +13,13 @@ const Favourites = {
state.favourites = state.favourites.map((toot) => {
if (toot.id === message.id) {
return message
} else if (toot.reblog !== null && toot.reblog.id === message.id) {
// When user reblog/favourite a reblogged toot, target message is a original toot.
// So, a message which is received now is original toot.
const reblog = {
reblog: message
}
return Object.assign(toot, reblog)
} else {
return toot
}

View File

@ -13,6 +13,13 @@ const Local = {
state.timeline = state.timeline.map((toot) => {
if (toot.id === message.id) {
return message
} else if (toot.reblog !== null && toot.reblog.id === message.id) {
// When user reblog/favourite a reblogged toot, target message is a original toot.
// So, a message which is received now is original toot.
const reblog = {
reblog: message
}
return Object.assign(toot, reblog)
} else {
return toot
}

View File

@ -13,6 +13,13 @@ const Public = {
state.timeline = state.timeline.map((toot) => {
if (toot.id === message.id) {
return message
} else if (toot.reblog !== null && toot.reblog.id === message.id) {
// When user reblog/favourite a reblogged toot, target message is a original toot.
// So, a message which is received now is original toot.
const reblog = {
reblog: message
}
return Object.assign(toot, reblog)
} else {
return toot
}