Merge branch 'quotes-count' into 'develop'
Display quotes count on posts and add quotes list page See merge request pleroma/pleroma-fe!1885
This commit is contained in:
commit
3e99006e2a
|
@ -0,0 +1 @@
|
||||||
|
Display quotes count on posts and add quotes list page
|
|
@ -25,6 +25,7 @@ import ListsTimeline from 'components/lists_timeline/lists_timeline.vue'
|
||||||
import ListsEdit from 'components/lists_edit/lists_edit.vue'
|
import ListsEdit from 'components/lists_edit/lists_edit.vue'
|
||||||
import NavPanel from 'src/components/nav_panel/nav_panel.vue'
|
import NavPanel from 'src/components/nav_panel/nav_panel.vue'
|
||||||
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
|
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
|
||||||
|
import QuotesTimeline from '../components/quotes_timeline/quotes_timeline.vue'
|
||||||
|
|
||||||
export default (store) => {
|
export default (store) => {
|
||||||
const validateAuthenticatedRoute = (to, from, next) => {
|
const validateAuthenticatedRoute = (to, from, next) => {
|
||||||
|
@ -51,6 +52,7 @@ export default (store) => {
|
||||||
{ name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
|
{ name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline },
|
||||||
{ name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline },
|
{ name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline },
|
||||||
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
|
{ name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } },
|
||||||
|
{ name: 'quotes', path: '/notice/:id/quotes', component: QuotesTimeline },
|
||||||
{
|
{
|
||||||
name: 'remote-user-profile-acct',
|
name: 'remote-user-profile-acct',
|
||||||
path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)',
|
path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)',
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import Timeline from '../timeline/timeline.vue'
|
||||||
|
|
||||||
|
const QuotesTimeline = {
|
||||||
|
created () {
|
||||||
|
this.$store.commit('clearTimeline', { timeline: 'quotes' })
|
||||||
|
this.$store.dispatch('startFetchingTimeline', { timeline: 'quotes', statusId: this.statusId })
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
Timeline
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusId () { return this.$route.params.id },
|
||||||
|
timeline () { return this.$store.state.statuses.timelines.quotes }
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
statusId () {
|
||||||
|
this.$store.commit('clearTimeline', { timeline: 'quotes' })
|
||||||
|
this.$store.dispatch('startFetchingTimeline', { timeline: 'quotes', statusId: this.statusId })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
unmounted () {
|
||||||
|
this.$store.dispatch('stopFetchingTimeline', 'quotes')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QuotesTimeline
|
|
@ -0,0 +1,10 @@
|
||||||
|
<template>
|
||||||
|
<Timeline
|
||||||
|
:title="$t('nav.quotes')"
|
||||||
|
:timeline="timeline"
|
||||||
|
:timeline-name="'quotes'"
|
||||||
|
:status-id="statusId"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src='./quotes_timeline.js'></script>
|
|
@ -373,6 +373,9 @@ const Status = {
|
||||||
hidePostStats () {
|
hidePostStats () {
|
||||||
return this.mergedConfig.hidePostStats
|
return this.mergedConfig.hidePostStats
|
||||||
},
|
},
|
||||||
|
shouldDisplayFavsAndRepeats () {
|
||||||
|
return !this.hidePostStats && this.isFocused && (this.combinedFavsAndRepeatsUsers.length > 0 || this.statusFromGlobalRepository.quotes_count)
|
||||||
|
},
|
||||||
muteBotStatuses () {
|
muteBotStatuses () {
|
||||||
return this.mergedConfig.muteBotStatuses
|
return this.mergedConfig.muteBotStatuses
|
||||||
},
|
},
|
||||||
|
|
|
@ -374,6 +374,7 @@
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .stat-title {
|
&:hover .stat-title {
|
||||||
|
|
|
@ -484,7 +484,7 @@
|
||||||
|
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div
|
<div
|
||||||
v-if="!hidePostStats && isFocused && combinedFavsAndRepeatsUsers.length > 0"
|
v-if="shouldDisplayFavsAndRepeats"
|
||||||
class="favs-repeated-users"
|
class="favs-repeated-users"
|
||||||
>
|
>
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
|
@ -512,6 +512,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</UserListPopover>
|
</UserListPopover>
|
||||||
|
<router-link
|
||||||
|
v-if="statusFromGlobalRepository.quotes_count > 0"
|
||||||
|
:to="{ name: 'quotes', params: { id: status.id } }"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="stat-count"
|
||||||
|
>
|
||||||
|
<a class="stat-title">{{ $t('status.quotes') }}</a>
|
||||||
|
<div class="stat-number">
|
||||||
|
{{ statusFromGlobalRepository.quotes_count }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
<div class="avatar-row">
|
<div class="avatar-row">
|
||||||
<AvatarList :users="combinedFavsAndRepeatsUsers" />
|
<AvatarList :users="combinedFavsAndRepeatsUsers" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,6 +25,7 @@ const Timeline = {
|
||||||
'title',
|
'title',
|
||||||
'userId',
|
'userId',
|
||||||
'listId',
|
'listId',
|
||||||
|
'statusId',
|
||||||
'tag',
|
'tag',
|
||||||
'embedded',
|
'embedded',
|
||||||
'count',
|
'count',
|
||||||
|
@ -121,6 +122,7 @@ const Timeline = {
|
||||||
showImmediately,
|
showImmediately,
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
listId: this.listId,
|
listId: this.listId,
|
||||||
|
statusId: this.statusId,
|
||||||
tag: this.tag
|
tag: this.tag
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -183,6 +185,7 @@ const Timeline = {
|
||||||
showImmediately: true,
|
showImmediately: true,
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
listId: this.listId,
|
listId: this.listId,
|
||||||
|
statusId: this.statusId,
|
||||||
tag: this.tag
|
tag: this.tag
|
||||||
}).then(({ statuses }) => {
|
}).then(({ statuses }) => {
|
||||||
if (statuses && statuses.length === 0) {
|
if (statuses && statuses.length === 0) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ export const timelineNames = () => {
|
||||||
bookmarks: 'nav.bookmarks',
|
bookmarks: 'nav.bookmarks',
|
||||||
dms: 'nav.dms',
|
dms: 'nav.dms',
|
||||||
'public-timeline': 'nav.public_tl',
|
'public-timeline': 'nav.public_tl',
|
||||||
'public-external-timeline': 'nav.twkn'
|
'public-external-timeline': 'nav.twkn',
|
||||||
|
quotes: 'nav.quotes'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,8 @@
|
||||||
"mobile_notifications": "Open notifications (there are unread ones)",
|
"mobile_notifications": "Open notifications (there are unread ones)",
|
||||||
"mobile_notifications_close": "Close notifications",
|
"mobile_notifications_close": "Close notifications",
|
||||||
"mobile_notifications_mark_as_seen": "Mark all as seen",
|
"mobile_notifications_mark_as_seen": "Mark all as seen",
|
||||||
"announcements": "Announcements"
|
"announcements": "Announcements",
|
||||||
|
"quotes": "Quotes"
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"broken_favorite": "Unknown status, searching for it…",
|
"broken_favorite": "Unknown status, searching for it…",
|
||||||
|
@ -1048,6 +1049,7 @@
|
||||||
"status": {
|
"status": {
|
||||||
"favorites": "Favorites",
|
"favorites": "Favorites",
|
||||||
"repeats": "Repeats",
|
"repeats": "Repeats",
|
||||||
|
"quotes": "Quotes",
|
||||||
"repeat_confirm": "Do you really want to repeat this status?",
|
"repeat_confirm": "Do you really want to repeat this status?",
|
||||||
"repeat_confirm_title": "Repeat confirmation",
|
"repeat_confirm_title": "Repeat confirmation",
|
||||||
"repeat_confirm_accept_button": "Repeat",
|
"repeat_confirm_accept_button": "Repeat",
|
||||||
|
|
|
@ -202,12 +202,13 @@ const api = {
|
||||||
timeline = 'friends',
|
timeline = 'friends',
|
||||||
tag = false,
|
tag = false,
|
||||||
userId = false,
|
userId = false,
|
||||||
listId = false
|
listId = false,
|
||||||
|
statusId = false
|
||||||
}) {
|
}) {
|
||||||
if (store.state.fetchers[timeline]) return
|
if (store.state.fetchers[timeline]) return
|
||||||
|
|
||||||
const fetcher = store.state.backendInteractor.startFetchingTimeline({
|
const fetcher = store.state.backendInteractor.startFetchingTimeline({
|
||||||
timeline, store, userId, listId, tag
|
timeline, store, userId, listId, statusId, tag
|
||||||
})
|
})
|
||||||
store.commit('addFetcher', { fetcherName: timeline, fetcher })
|
store.commit('addFetcher', { fetcherName: timeline, fetcher })
|
||||||
},
|
},
|
||||||
|
|
|
@ -108,6 +108,7 @@ const PLEROMA_POST_ANNOUNCEMENT_URL = '/api/v1/pleroma/admin/announcements'
|
||||||
const PLEROMA_EDIT_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
|
const PLEROMA_EDIT_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
|
||||||
const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
|
const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
|
||||||
const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles`
|
const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles`
|
||||||
|
const PLEROMA_STATUS_QUOTES_URL = id => `/api/v1/pleroma/statuses/${id}/quotes`
|
||||||
const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites`
|
const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites`
|
||||||
|
|
||||||
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
|
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
|
||||||
|
@ -685,6 +686,7 @@ const fetchTimeline = ({
|
||||||
until = false,
|
until = false,
|
||||||
userId = false,
|
userId = false,
|
||||||
listId = false,
|
listId = false,
|
||||||
|
statusId = false,
|
||||||
tag = false,
|
tag = false,
|
||||||
withMuted = false,
|
withMuted = false,
|
||||||
replyVisibility = 'all',
|
replyVisibility = 'all',
|
||||||
|
@ -702,7 +704,8 @@ const fetchTimeline = ({
|
||||||
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
||||||
publicFavorites: PLEROMA_USER_FAVORITES_TIMELINE_URL,
|
publicFavorites: PLEROMA_USER_FAVORITES_TIMELINE_URL,
|
||||||
tag: MASTODON_TAG_TIMELINE_URL,
|
tag: MASTODON_TAG_TIMELINE_URL,
|
||||||
bookmarks: MASTODON_BOOKMARK_TIMELINE_URL
|
bookmarks: MASTODON_BOOKMARK_TIMELINE_URL,
|
||||||
|
quotes: PLEROMA_STATUS_QUOTES_URL
|
||||||
}
|
}
|
||||||
const isNotifications = timeline === 'notifications'
|
const isNotifications = timeline === 'notifications'
|
||||||
const params = []
|
const params = []
|
||||||
|
@ -721,6 +724,10 @@ const fetchTimeline = ({
|
||||||
url = url(listId)
|
url = url(listId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeline === 'quotes') {
|
||||||
|
url = url(statusId)
|
||||||
|
}
|
||||||
|
|
||||||
if (minId) {
|
if (minId) {
|
||||||
params.push(['min_id', minId])
|
params.push(['min_id', minId])
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import followRequestFetcher from '../../services/follow_request_fetcher/follow_r
|
||||||
import listsFetcher from '../../services/lists_fetcher/lists_fetcher.service.js'
|
import listsFetcher from '../../services/lists_fetcher/lists_fetcher.service.js'
|
||||||
|
|
||||||
const backendInteractorService = credentials => ({
|
const backendInteractorService = credentials => ({
|
||||||
startFetchingTimeline ({ timeline, store, userId = false, listId = false, tag }) {
|
startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, tag }) {
|
||||||
return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, tag })
|
return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, tag })
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchTimeline (args) {
|
fetchTimeline (args) {
|
||||||
|
|
|
@ -331,6 +331,7 @@ export const parseStatus = (data) => {
|
||||||
output.quote_id = pleroma.quote_id ? pleroma.quote_id : (output.quote ? output.quote.id : undefined)
|
output.quote_id = pleroma.quote_id ? pleroma.quote_id : (output.quote ? output.quote.id : undefined)
|
||||||
output.quote_url = pleroma.quote_url
|
output.quote_url = pleroma.quote_url
|
||||||
output.quote_visible = pleroma.quote_visible
|
output.quote_visible = pleroma.quote_visible
|
||||||
|
output.quotes_count = pleroma.quotes_count
|
||||||
} else {
|
} else {
|
||||||
output.text = data.content
|
output.text = data.content
|
||||||
output.summary = data.spoiler_text
|
output.summary = data.spoiler_text
|
||||||
|
|
|
@ -24,6 +24,7 @@ const fetchAndUpdate = ({
|
||||||
showImmediately = false,
|
showImmediately = false,
|
||||||
userId = false,
|
userId = false,
|
||||||
listId = false,
|
listId = false,
|
||||||
|
statusId = false,
|
||||||
tag = false,
|
tag = false,
|
||||||
until,
|
until,
|
||||||
since
|
since
|
||||||
|
@ -47,6 +48,7 @@ const fetchAndUpdate = ({
|
||||||
|
|
||||||
args.userId = userId
|
args.userId = userId
|
||||||
args.listId = listId
|
args.listId = listId
|
||||||
|
args.statusId = statusId
|
||||||
args.tag = tag
|
args.tag = tag
|
||||||
args.withMuted = !hideMutedPosts
|
args.withMuted = !hideMutedPosts
|
||||||
if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) {
|
if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) {
|
||||||
|
@ -78,15 +80,15 @@ const fetchAndUpdate = ({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, tag = false }) => {
|
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, statusId = false, tag = false }) => {
|
||||||
const rootState = store.rootState || store.state
|
const rootState = store.rootState || store.state
|
||||||
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
||||||
const showImmediately = timelineData.visibleStatuses.length === 0
|
const showImmediately = timelineData.visibleStatuses.length === 0
|
||||||
timelineData.userId = userId
|
timelineData.userId = userId
|
||||||
timelineData.listId = listId
|
timelineData.listId = listId
|
||||||
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, tag })
|
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, tag })
|
||||||
const boundFetchAndUpdate = () =>
|
const boundFetchAndUpdate = () =>
|
||||||
fetchAndUpdate({ timeline, credentials, store, userId, listId, tag })
|
fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, tag })
|
||||||
return promiseInterval(boundFetchAndUpdate, 10000)
|
return promiseInterval(boundFetchAndUpdate, 10000)
|
||||||
}
|
}
|
||||||
const timelineFetcher = {
|
const timelineFetcher = {
|
||||||
|
|
Loading…
Reference in New Issue