Merge branch 'remove_favorite_hacks' into 'develop'
no more "broken favorite" Closes #218 and #145 See merge request pleroma/pleroma-fe!431
This commit is contained in:
commit
b65ac128c1
7 changed files with 3 additions and 54 deletions
|
@ -33,10 +33,7 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<status :activatePanel="activatePanel" v-if="notification.status" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
|
<status :activatePanel="activatePanel" class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
|
||||||
<div class="broken-favorite" v-else>
|
|
||||||
{{$t('notifications.broken_favorite')}}
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,16 +36,6 @@
|
||||||
border-color: $fallback--border;
|
border-color: $fallback--border;
|
||||||
border-color: var(--border, $fallback--border);
|
border-color: var(--border, $fallback--border);
|
||||||
|
|
||||||
.broken-favorite {
|
|
||||||
border-radius: $fallback--tooltipRadius;
|
|
||||||
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
|
|
||||||
color: $fallback--text;
|
|
||||||
color: var(--alertErrorText, $fallback--text);
|
|
||||||
background-color: $fallback--alertError;
|
|
||||||
background-color: var(--alertError, $fallback--alertError);
|
|
||||||
padding: 2px .5em
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar-compact {
|
.avatar-compact {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
|
|
@ -46,9 +46,6 @@ const api = {
|
||||||
store.commit('addFetcher', {timeline, fetcher})
|
store.commit('addFetcher', {timeline, fetcher})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchOldPost (store, { postId }) {
|
|
||||||
store.state.backendInteractor.fetchOldPost({ store, postId })
|
|
||||||
},
|
|
||||||
stopFetching (store, timeline) {
|
stopFetching (store, timeline) {
|
||||||
const fetcher = store.state.fetchers[timeline]
|
const fetcher = store.state.fetchers[timeline]
|
||||||
window.clearInterval(fetcher)
|
window.clearInterval(fetcher)
|
||||||
|
|
|
@ -27,8 +27,7 @@ export const defaultState = {
|
||||||
maxId: 0,
|
maxId: 0,
|
||||||
minId: Number.POSITIVE_INFINITY,
|
minId: Number.POSITIVE_INFINITY,
|
||||||
data: [],
|
data: [],
|
||||||
error: false,
|
error: false
|
||||||
brokenFavorites: {}
|
|
||||||
},
|
},
|
||||||
favorites: new Set(),
|
favorites: new Set(),
|
||||||
error: false,
|
error: false,
|
||||||
|
@ -36,7 +35,6 @@ export const defaultState = {
|
||||||
mentions: emptyTl(),
|
mentions: emptyTl(),
|
||||||
public: emptyTl(),
|
public: emptyTl(),
|
||||||
user: emptyTl(),
|
user: emptyTl(),
|
||||||
own: emptyTl(),
|
|
||||||
publicAndExternal: emptyTl(),
|
publicAndExternal: emptyTl(),
|
||||||
friends: emptyTl(),
|
friends: emptyTl(),
|
||||||
tag: emptyTl(),
|
tag: emptyTl(),
|
||||||
|
@ -158,12 +156,6 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
||||||
const result = mergeOrAdd(allStatuses, allStatusesObject, status)
|
const result = mergeOrAdd(allStatuses, allStatusesObject, status)
|
||||||
status = result.item
|
status = result.item
|
||||||
|
|
||||||
const brokenFavorites = state.notifications.brokenFavorites[status.id] || []
|
|
||||||
brokenFavorites.forEach((fav) => {
|
|
||||||
fav.status = status
|
|
||||||
})
|
|
||||||
delete state.notifications.brokenFavorites[status.id]
|
|
||||||
|
|
||||||
if (result.new) {
|
if (result.new) {
|
||||||
// We are mentioned in a post
|
// We are mentioned in a post
|
||||||
if (statusType(status) === 'status' && find(status.attentions, { id: user.id })) {
|
if (statusType(status) === 'status' && find(status.attentions, { id: user.id })) {
|
||||||
|
@ -304,7 +296,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
||||||
|
|
||||||
const fresh = !notification.is_seen
|
const fresh = !notification.is_seen
|
||||||
const status = notification.ntype === 'like'
|
const status = notification.ntype === 'like'
|
||||||
? find(allStatuses, { id: action.in_reply_to_status_id })
|
? action.favorited_status
|
||||||
: action
|
: action
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
|
@ -314,17 +306,6 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
||||||
seen: !fresh
|
seen: !fresh
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification.ntype === 'like' && !status) {
|
|
||||||
let broken = state.notifications.brokenFavorites[action.in_reply_to_status_id]
|
|
||||||
if (broken) {
|
|
||||||
broken.push(result)
|
|
||||||
} else {
|
|
||||||
dispatch('fetchOldPost', { postId: action.in_reply_to_status_id })
|
|
||||||
broken = [ result ]
|
|
||||||
state.notifications.brokenFavorites[action.in_reply_to_status_id] = broken
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state.notifications.data.push(result)
|
state.notifications.data.push(result)
|
||||||
|
|
||||||
if ('Notification' in window && window.Notification.permission === 'granted') {
|
if ('Notification' in window && window.Notification.permission === 'granted') {
|
||||||
|
|
|
@ -195,8 +195,6 @@ const users = {
|
||||||
|
|
||||||
// Start getting fresh tweets.
|
// Start getting fresh tweets.
|
||||||
store.dispatch('startFetching', 'friends')
|
store.dispatch('startFetching', 'friends')
|
||||||
// Start getting our own posts, only really needed for mitigating broken favorites
|
|
||||||
store.dispatch('startFetching', ['own', user.id])
|
|
||||||
|
|
||||||
// Get user mutes and follower info
|
// Get user mutes and follower info
|
||||||
store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {
|
store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {
|
||||||
|
|
|
@ -300,9 +300,6 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
|
||||||
notifications: QVITTER_USER_NOTIFICATIONS_URL,
|
notifications: QVITTER_USER_NOTIFICATIONS_URL,
|
||||||
'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL,
|
'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL,
|
||||||
user: QVITTER_USER_TIMELINE_URL,
|
user: QVITTER_USER_TIMELINE_URL,
|
||||||
// separate timeline for own posts, so it won't break due to user timeline bugs
|
|
||||||
// really needed only for broken favorites
|
|
||||||
own: QVITTER_USER_TIMELINE_URL,
|
|
||||||
tag: TAG_TIMELINE_URL
|
tag: TAG_TIMELINE_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,6 @@ const backendInteractorService = (credentials) => {
|
||||||
return timelineFetcherService.startFetching({timeline, store, credentials, userId})
|
return timelineFetcherService.startFetching({timeline, store, credentials, userId})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchOldPost = ({store, postId}) => {
|
|
||||||
return timelineFetcherService.fetchAndUpdate({
|
|
||||||
store,
|
|
||||||
credentials,
|
|
||||||
timeline: 'own',
|
|
||||||
older: true,
|
|
||||||
until: postId + 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const setUserMute = ({id, muted = true}) => {
|
const setUserMute = ({id, muted = true}) => {
|
||||||
return apiService.setUserMute({id, muted, credentials})
|
return apiService.setUserMute({id, muted, credentials})
|
||||||
}
|
}
|
||||||
|
@ -97,7 +87,6 @@ const backendInteractorService = (credentials) => {
|
||||||
fetchAllFollowing,
|
fetchAllFollowing,
|
||||||
verifyCredentials: apiService.verifyCredentials,
|
verifyCredentials: apiService.verifyCredentials,
|
||||||
startFetching,
|
startFetching,
|
||||||
fetchOldPost,
|
|
||||||
setUserMute,
|
setUserMute,
|
||||||
fetchMutes,
|
fetchMutes,
|
||||||
register,
|
register,
|
||||||
|
|
Loading…
Reference in a new issue