mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-02 10:26:50 +01:00
Merge pull request #1732 from h3poteto/iss-1713
closes #1713 Support to add bookmarks
This commit is contained in:
commit
dd400474ff
14
package-lock.json
generated
14
package-lock.json
generated
@ -19389,9 +19389,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"megalodon": {
|
||||
"version": "3.2.5",
|
||||
"resolved": "https://registry.npmjs.org/megalodon/-/megalodon-3.2.5.tgz",
|
||||
"integrity": "sha512-RoAX14fjkjWEaJg/QhoTIoSM6A8FUbWFqB77rd3EivD5bilXPkNh+yh9XPtEp67NCrZEbnfwpV0b0rhAcEsHcw==",
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/megalodon/-/megalodon-3.3.0.tgz",
|
||||
"integrity": "sha512-YDspzWuJ6lqsxaCoEaE4bILNrK8nuk+7rDd+ythNoBcVksJ/2SFqSIeRdkIGPchc7VfKpCn1vpe8URx9FrPnuw==",
|
||||
"requires": {
|
||||
"@types/oauth": "^0.9.0",
|
||||
"@types/ws": "^7.2.0",
|
||||
@ -24973,11 +24973,11 @@
|
||||
}
|
||||
},
|
||||
"socks": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.4.1.tgz",
|
||||
"integrity": "sha512-8mWHeYC1OA0500qzb+sqwm0Hzi8oBpeuI1JugoBVMEJtJvxSgco8xFSK+NRnZcHeeWjTbF82KUDo5sXH22TY5A==",
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.4.2.tgz",
|
||||
"integrity": "sha512-cE6P9R+/CET9XhIMvqhRgaNT1GXKIahioMjwwhgYOd+8UQWP50rrFm+faqG/4xkZsjTdVeBYr0Tb246BSC9/fg==",
|
||||
"requires": {
|
||||
"ip": "1.1.5",
|
||||
"ip": "^1.1.5",
|
||||
"smart-buffer": "^4.1.0"
|
||||
}
|
||||
},
|
||||
|
@ -184,7 +184,7 @@
|
||||
"hoek": "^6.1.3",
|
||||
"i18next": "^19.6.3",
|
||||
"lodash": "^4.17.19",
|
||||
"megalodon": "3.2.5",
|
||||
"megalodon": "3.3.0",
|
||||
"moment": "^2.27.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"nedb": "^1.8.0",
|
||||
|
@ -76,6 +76,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -123,6 +124,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -109,6 +110,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -108,6 +109,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -111,6 +112,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -108,6 +109,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ const status: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -132,6 +133,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -166,6 +168,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -108,6 +109,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ const status: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -120,6 +122,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -120,6 +122,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -289,6 +291,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const favouritedStatus: Entity.Status = Object.assign(status1, {
|
||||
@ -365,6 +368,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
state = {
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -120,6 +122,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -120,6 +122,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -144,6 +146,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -144,6 +146,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ const status1: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
const status2: Entity.Status = {
|
||||
@ -86,6 +87,7 @@ const status2: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
@ -120,6 +122,7 @@ const rebloggedStatus: Entity.Status = {
|
||||
language: null,
|
||||
pinned: null,
|
||||
emoji_reactions: [],
|
||||
bookmarked: false,
|
||||
quote: false
|
||||
}
|
||||
|
||||
|
@ -327,6 +327,7 @@
|
||||
"reblog": "Reblog",
|
||||
"fav": "Favourite",
|
||||
"detail": "Toot details",
|
||||
"bookmark": "Bookmark",
|
||||
"pinned": "Pinned toot",
|
||||
"poll": {
|
||||
"vote": "Vote",
|
||||
@ -423,6 +424,8 @@
|
||||
"unreblog_error": "Failed to unreblog",
|
||||
"favourite_error": "Failed to favourite",
|
||||
"unfavourite_error": "Failed to unfavourite",
|
||||
"bookmark_error": "Failed to bookmark",
|
||||
"unbookmark_error": "Failed to remove bookmark",
|
||||
"delete_error": "Failed to delete the toot",
|
||||
"search_error": "Failed to search",
|
||||
"toot_error": "Failed to toot",
|
||||
|
@ -167,6 +167,16 @@
|
||||
<span class="count">
|
||||
{{ favouritesCount }}
|
||||
</span>
|
||||
<el-button
|
||||
@click="changeBookmark(originalMessage)"
|
||||
:class="originalMessage.bookmarked ? 'bookmarked' : 'bookmark'"
|
||||
type="text"
|
||||
:text="$t('cards.toot.bookmark')"
|
||||
:aria-label="$t('cards.toot.bookmark')"
|
||||
v-if="bookmarkSupported"
|
||||
>
|
||||
<icon name="bookmark" scale="0.9"></icon>
|
||||
</el-button>
|
||||
<el-button type="text" class="quote-btn" v-if="quoteSupported" @click="openQuote()">
|
||||
<icon name="quote-right" scale="0.9"></icon>
|
||||
</el-button>
|
||||
@ -305,6 +315,9 @@ export default {
|
||||
sns: state => state.sns,
|
||||
account: state => state.account
|
||||
}),
|
||||
...mapState('TimelineSpace/SideMenu', {
|
||||
bookmarkSupported: state => state.enabledTimelines.bookmark
|
||||
}),
|
||||
shortcutEnabled: function () {
|
||||
return this.focused && !this.overlaid && !this.openEmojiPicker
|
||||
},
|
||||
@ -562,6 +575,35 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
changeBookmark(message) {
|
||||
if (message.bookmarked) {
|
||||
this.$store
|
||||
.dispatch('organisms/Toot/removeBookmark', message)
|
||||
.then(data => {
|
||||
this.$emit('update', data)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
this.$message({
|
||||
message: this.$t('message.unbookmark_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.$store
|
||||
.dispatch('organisms/Toot/addBookmark', message)
|
||||
.then(data => {
|
||||
this.$emit('update', data)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
this.$message({
|
||||
message: this.$t('message.bookmark_error'),
|
||||
type: 'error'
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
openImage(url, rawMediaList) {
|
||||
const mediaList = rawMediaList.map(media => {
|
||||
return media.url
|
||||
@ -896,6 +938,15 @@ export default {
|
||||
margin: 0 0 4px -8px;
|
||||
}
|
||||
|
||||
.bookmark {
|
||||
margin: 0 0 0 8px;
|
||||
}
|
||||
|
||||
.bookmarked {
|
||||
margin: 0 0 0 8px;
|
||||
color: #ff5050;
|
||||
}
|
||||
|
||||
.pinned {
|
||||
color: gold;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ const actions: ActionTree<TootState, RootState> = {
|
||||
dispatch('TimelineSpace/updateTootForAllTimelines', res.data, { root: true })
|
||||
return res.data
|
||||
},
|
||||
addFavourite: async ({ rootState, dispatch }, message: Entity.Status) => {
|
||||
addFavourite: async ({ rootState, dispatch }, message: Entity.Status): Promise<Entity.Status> => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
@ -58,7 +58,7 @@ const actions: ActionTree<TootState, RootState> = {
|
||||
dispatch('TimelineSpace/updateTootForAllTimelines', res.data, { root: true })
|
||||
return res.data
|
||||
},
|
||||
removeFavourite: async ({ rootState, dispatch }, message: Entity.Status) => {
|
||||
removeFavourite: async ({ rootState, dispatch }, message: Entity.Status): Promise<Entity.Status> => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
@ -69,6 +69,29 @@ const actions: ActionTree<TootState, RootState> = {
|
||||
dispatch('TimelineSpace/updateTootForAllTimelines', res.data, { root: true })
|
||||
return res.data
|
||||
},
|
||||
addBookmark: async ({ rootState, dispatch }, message: Entity.Status): Promise<Entity.Status> => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.App.userAgent
|
||||
)
|
||||
const res = await client.bookmarkStatus(message.id)
|
||||
win.ipcRenderer.send('fav-rt-action-sound')
|
||||
dispatch('TimelineSpace/updateTootForAllTimelines', res.data, { root: true })
|
||||
return res.data
|
||||
},
|
||||
removeBookmark: async ({ rootState, dispatch }, message: Entity.Status): Promise<Entity.Status> => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.App.userAgent
|
||||
)
|
||||
const res = await client.unbookmarkStatus(message.id)
|
||||
dispatch('TimelineSpace/updateTootForAllTimelines', res.data, { root: true })
|
||||
return res.data
|
||||
},
|
||||
deleteToot: async ({ rootState }, message: Entity.Status) => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
|
Loading…
x
Reference in New Issue
Block a user