aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2024-05-22 12:15:57 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2024-05-22 12:15:57 +0000
commit3e99006e2ab06d2c8ade2eb20e12b1d2fbbcaac2 (patch)
treeec9b7035c45a45f17f973162ba8a514003b39eb5 /src/services
parente232ba0ec5542020f83ea685b8fb491b23def627 (diff)
parent9d2572ffdb384ca4458cd96daf6c11e5d46dd03a (diff)
Merge branch 'quotes-count' into 'develop'
Display quotes count on posts and add quotes list page See merge request pleroma/pleroma-fe!1885
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js9
-rw-r--r--src/services/backend_interactor_service/backend_interactor_service.js4
-rw-r--r--src/services/entity_normalizer/entity_normalizer.service.js1
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js8
4 files changed, 16 insertions, 6 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index a47c638c..fa417193 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -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_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
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_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
@@ -685,6 +686,7 @@ const fetchTimeline = ({
until = false,
userId = false,
listId = false,
+ statusId = false,
tag = false,
withMuted = false,
replyVisibility = 'all',
@@ -702,7 +704,8 @@ const fetchTimeline = ({
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
publicFavorites: PLEROMA_USER_FAVORITES_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 params = []
@@ -721,6 +724,10 @@ const fetchTimeline = ({
url = url(listId)
}
+ if (timeline === 'quotes') {
+ url = url(statusId)
+ }
+
if (minId) {
params.push(['min_id', minId])
}
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
index 62ee8549..8ceb897d 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -5,8 +5,8 @@ import followRequestFetcher from '../../services/follow_request_fetcher/follow_r
import listsFetcher from '../../services/lists_fetcher/lists_fetcher.service.js'
const backendInteractorService = credentials => ({
- startFetchingTimeline ({ timeline, store, userId = false, listId = false, tag }) {
- return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, tag })
+ startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, tag }) {
+ return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, tag })
},
fetchTimeline (args) {
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 21e67b67..e41e7125 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -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_url = pleroma.quote_url
output.quote_visible = pleroma.quote_visible
+ output.quotes_count = pleroma.quotes_count
} else {
output.text = data.content
output.summary = data.spoiler_text
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 8501907e..2fed14bc 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -24,6 +24,7 @@ const fetchAndUpdate = ({
showImmediately = false,
userId = false,
listId = false,
+ statusId = false,
tag = false,
until,
since
@@ -47,6 +48,7 @@ const fetchAndUpdate = ({
args.userId = userId
args.listId = listId
+ args.statusId = statusId
args.tag = tag
args.withMuted = !hideMutedPosts
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 timelineData = rootState.statuses.timelines[camelCase(timeline)]
const showImmediately = timelineData.visibleStatuses.length === 0
timelineData.userId = userId
timelineData.listId = listId
- fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, tag })
+ fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, tag })
const boundFetchAndUpdate = () =>
- fetchAndUpdate({ timeline, credentials, store, userId, listId, tag })
+ fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, tag })
return promiseInterval(boundFetchAndUpdate, 10000)
}
const timelineFetcher = {