Merge remote-tracking branch 'origin/develop' into notifications-thru-sw
This commit is contained in:
commit
c059f4a7ee
57 changed files with 1296 additions and 86 deletions
|
|
@ -107,6 +107,7 @@ const PLEROMA_ANNOUNCEMENTS_URL = '/api/v1/pleroma/admin/announcements'
|
|||
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_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
|
||||
const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
|
||||
|
|
@ -1765,6 +1766,23 @@ const installFrontend = ({ credentials, payload }) => {
|
|||
})
|
||||
}
|
||||
|
||||
const fetchScrobbles = ({ accountId, limit = 1 }) => {
|
||||
let url = PLEROMA_SCROBBLES_URL(accountId)
|
||||
const params = [['limit', limit]]
|
||||
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||
url += `?${queryString}`
|
||||
return fetch(url, {})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
} else {
|
||||
return {
|
||||
error: response
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const apiService = {
|
||||
verifyCredentials,
|
||||
fetchTimeline,
|
||||
|
|
@ -1878,6 +1896,7 @@ const apiService = {
|
|||
postAnnouncement,
|
||||
editAnnouncement,
|
||||
deleteAnnouncement,
|
||||
fetchScrobbles,
|
||||
adminFetchAnnouncements,
|
||||
fetchInstanceDBConfig,
|
||||
fetchInstanceConfigDescriptions,
|
||||
|
|
|
|||
|
|
@ -133,3 +133,17 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||
|
||||
return notifObj
|
||||
}
|
||||
|
||||
export const countExtraNotifications = (store) => {
|
||||
const mergedConfig = store.getters.mergedConfig
|
||||
|
||||
if (!mergedConfig.showExtraNotifications) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return [
|
||||
mergedConfig.showChatsInExtraNotifications ? store.getters.unreadChatCount : 0,
|
||||
mergedConfig.showAnnouncementsInExtraNotifications ? store.getters.unreadAnnouncementCount : 0,
|
||||
mergedConfig.showFollowRequestsInExtraNotifications ? store.getters.followRequestCount : 0
|
||||
].reduce((a, c) => a + c, 0)
|
||||
}
|
||||
|
|
|
|||
3
src/services/random_seed/random_seed.service.js
Normal file
3
src/services/random_seed/random_seed.service.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
const genRandomSeed = () => `${Math.random()}`.replace('.', '-')
|
||||
|
||||
export default genRandomSeed
|
||||
Loading…
Add table
Add a link
Reference in a new issue