1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-08 15:58:42 +01:00

Merge pull request #1433 from h3poteto/iss-1321

refs #1321 Show quoted status in timelines for Misskey
This commit is contained in:
AkiraFukushima 2020-05-12 22:07:43 +09:00 committed by GitHub
commit 810e1c573f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 183 additions and 59 deletions

6
package-lock.json generated
View File

@ -19026,9 +19026,9 @@
"dev": true
},
"megalodon": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/megalodon/-/megalodon-3.1.2.tgz",
"integrity": "sha512-SKgVYazClInrWthcr4sMaJpHwgrOhxMypxfJWj3ZC+8JWe/Iq2j+d5Wlj1LRyu+9kpz44biAEL8kxT3p3vVmNg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/megalodon/-/megalodon-3.2.0.tgz",
"integrity": "sha512-7rxAuywvlpUNFDHhcuT19jg/IMngBGenR/6AKrdJpQHuEg4B19VXyvZYtY5ItnGIOPpKWiRLOqeTKDpe8oQVWg==",
"requires": {
"@types/oauth": "^0.9.0",
"@types/ws": "^7.2.0",

View File

@ -184,7 +184,7 @@
"hoek": "^6.1.3",
"i18next": "^19.4.1",
"lodash": "^4.17.15",
"megalodon": "3.1.2",
"megalodon": "3.2.0",
"moment": "^2.24.0",
"mousetrap": "^1.6.5",
"nedb": "^1.8.0",

View File

@ -75,7 +75,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
@ -108,7 +109,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const conversation1: Entity.Conversation = {

View File

@ -89,7 +89,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -121,7 +122,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): FavouritesState => {

View File

@ -75,7 +75,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -107,7 +108,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): TagState => {

View File

@ -74,7 +74,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -106,7 +107,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): HomeState => {

View File

@ -76,7 +76,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
@ -109,7 +110,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): ShowState => {

View File

@ -74,7 +74,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -106,7 +107,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): LocalState => {

View File

@ -75,7 +75,8 @@ const status: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const mention: Entity.Notification = {

View File

@ -97,7 +97,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
@ -130,7 +131,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -163,7 +165,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const notification1: Entity.Notification = {

View File

@ -74,7 +74,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -106,7 +107,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): PublicState => {

View File

@ -79,7 +79,8 @@ const status: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
let state = (): TootsState => {

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -117,7 +119,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/DirectMessages', () => {

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -95,7 +97,7 @@ const rebloggedStatus: Entity.Status = {
in_reply_to_id: null,
in_reply_to_account_id: null,
reblog: status1,
content: '',
content: 'hoge',
created_at: '2019-03-31T21:40:32',
emojis: [],
replies_count: 0,
@ -117,7 +119,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/Hashtag/Tag', () => {

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/Home', () => {
@ -286,7 +288,8 @@ describe('TimelineSpace/Contents/Home', () => {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const favouritedStatus: Entity.Status = Object.assign(status1, {
favourited: true
@ -361,7 +364,8 @@ describe('TimelineSpace/Contents/Home', () => {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
state = {
lazyLoading: false,

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -95,7 +97,7 @@ const rebloggedStatus: Entity.Status = {
in_reply_to_id: null,
in_reply_to_account_id: null,
reblog: status1,
content: '',
content: 'fuga',
created_at: '2019-03-31T21:40:32',
emojis: [],
replies_count: 0,
@ -117,7 +119,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/Lists/Show', () => {

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -95,7 +97,7 @@ const rebloggedStatus: Entity.Status = {
in_reply_to_id: null,
in_reply_to_account_id: null,
reblog: status1,
content: '',
content: 'hoge',
created_at: '2019-03-31T21:40:32',
emojis: [],
replies_count: 0,
@ -117,7 +119,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/Local', () => {

View File

@ -75,7 +75,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
@ -108,7 +109,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -141,7 +143,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const notification1: Entity.Notification = {

View File

@ -75,7 +75,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
@ -108,7 +109,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -141,7 +143,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const notification1: Entity.Notification = {

View File

@ -52,7 +52,8 @@ const status1: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const status2: Entity.Status = {
id: '2',
@ -84,7 +85,8 @@ const status2: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
const rebloggedStatus: Entity.Status = {
@ -117,7 +119,8 @@ const rebloggedStatus: Entity.Status = {
} as Entity.Application,
language: null,
pinned: null,
emoji_reactions: []
emoji_reactions: [],
quote: false
}
describe('TimelineSpace/Contents/Local', () => {

View File

@ -56,7 +56,7 @@ export default {
showReplies: state => state.TimelineSpace.Contents.Home.showReplies
}),
...mapGetters('TimelineSpace/Modals', ['modalOpened']),
shortcutEnabled: function() {
shortcutEnabled: function () {
if (this.modalOpened) {
return false
}
@ -86,7 +86,7 @@ export default {
// If focusedId does not change, we have to refresh focusedId because Toot component watch change events.
const previousFocusedId = this.focusedId
this.focusedId = 0
this.$nextTick(function() {
this.$nextTick(function () {
this.focusedId = previousFocusedId
})
})
@ -109,14 +109,14 @@ export default {
}
},
watch: {
startReload: function(newState, oldState) {
startReload: function (newState, oldState) {
if (!oldState && newState) {
this.reload().finally(() => {
this.$store.commit('TimelineSpace/HeaderMenu/changeReload', false)
})
}
},
focusedId: function(newState, _oldState) {
focusedId: function (newState, _oldState) {
if (newState && this.heading) {
this.$store.commit('TimelineSpace/Contents/Home/changeHeading', false)
} else if (newState === null && !this.heading) {

View File

@ -0,0 +1,70 @@
<template>
<div class="quote" v-on:click.stop.prevent="$emit('select')">
<FailoverImg class="icon" :src="icon" :alt="`Avatar of ${username}`" />
<div class="contents">
<div class="header">
<strong>{{ username }}</strong>
<span>{{ accountName }}</span>
</div>
<div class="body" v-html="body"></div>
</div>
</div>
</template>
<script>
import FailoverImg from '~/src/renderer/components/atoms/FailoverImg'
export default {
name: 'quote',
props: {
icon: {
type: String,
default: ''
},
username: {
type: String,
default: ''
},
accountName: {
type: String,
default: ''
},
body: {
type: String,
default: ''
}
},
components: {
FailoverImg
}
}
</script>
<style lang="scss">
.quote {
display: flex;
border-radius: 4px;
overflow: hidden;
margin-bottom: 4px;
border: 1px solid var(--theme-selected-background-color);
cursor: pointer;
&:hover {
background-color: var(--theme-selected-background-color);
}
.icon {
width: 40px;
height: 40px;
min-width: 40px;
min-height: 40px;
margin: 10px;
border-radius: 4px;
}
.contents {
.body {
margin-top: 4px;
}
}
}
</style>

View File

@ -21,7 +21,7 @@
"
@shortkey="handleTootControl"
ref="status"
@click="$emit('selectToot')"
@click="$emit('selectToot', message)"
role="article"
aria-label="toot"
>
@ -89,6 +89,14 @@
</div>
<div class="clearfix"></div>
</div>
<Quote
v-if="message.quote"
:icon="message.reblog.account.avatar"
:username="username(message.reblog.account)"
:accountName="accountName(message.reblog.account)"
:body="message.reblog.content"
@select="openDetail(message.reblog)"
/>
<LinkPreview
v-if="originalMessage.card && originalMessage.card.type === 'link'"
:icon="originalMessage.card.image"
@ -96,7 +104,7 @@
:description="originalMessage.card.description"
:url="originalMessage.card.url"
/>
<div class="reblogger" v-show="message.reblog !== null">
<div class="reblogger" v-show="message.reblog && !message.quote">
<icon name="retweet"></icon>
<span class="reblogger-icon" @click="openUser(message.account)" role="presentation">
<FailoverImg :src="message.account.avatar" :alt="`Avatar of ${message.account.username}`" />
@ -227,6 +235,7 @@ import emojify from '~/src/renderer/utils/emojify'
import FailoverImg from '~/src/renderer/components/atoms/FailoverImg'
import Poll from '~/src/renderer/components/molecules/Toot/Poll'
import LinkPreview from '~/src/renderer/components/molecules/Toot/LinkPreview'
import Quote from '@/components/molecules/Toot/Quote'
import { setInterval, clearInterval } from 'timers'
export default {
@ -238,7 +247,8 @@ export default {
FailoverImg,
Poll,
Picker,
LinkPreview
LinkPreview,
Quote
},
data() {
return {
@ -296,7 +306,7 @@ export default {
return moment(this.originalMessage.created_at).format('LLLL')
},
originalMessage: function () {
if (this.message.reblog !== null) {
if (this.message.reblog && !this.message.quote) {
return this.message.reblog
} else {
return this.message