forked from AkkomaGang/akkoma-fe
missing files and a plug for bad favs
This commit is contained in:
parent
d085cc8584
commit
ef515056b5
2 changed files with 46 additions and 2 deletions
|
@ -24,12 +24,15 @@
|
||||||
<small>{{$t('notifications.followed_you')}}</small>
|
<small>{{$t('notifications.followed_you')}}</small>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<small class="timeago"><router-link :to="{ name: 'conversation', params: { id: notification.status.id } }"><timeago :since="notification.action.created_at" :auto-update="240"></timeago></router-link></small>
|
<small class="timeago"><router-link v-if="notification.status" :to="{ name: 'conversation', params: { id: notification.status.id } }"><timeago :since="notification.action.created_at" :auto-update="240"></timeago></router-link></small>
|
||||||
</span>
|
</span>
|
||||||
<div class="follow-text" v-if="notification.type === 'follow'">
|
<div class="follow-text" v-if="notification.type === 'follow'">
|
||||||
<router-link :to="{ name: 'user-profile', params: { id: notification.action.user.id } }">@{{notification.action.user.screen_name}}</router-link>
|
<router-link :to="{ name: 'user-profile', params: { id: notification.action.user.id } }">@{{notification.action.user.screen_name}}</router-link>
|
||||||
</div>
|
</div>
|
||||||
<status v-else class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
|
<status v-if="notification.status" v-else class="faint" :compact="true" :statusoid="notification.status" :noHeading="true"></status>
|
||||||
|
<div v-if="!notification.status">
|
||||||
|
Favorite for missing post
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
import apiService from '../api/api.service.js'
|
||||||
|
|
||||||
|
const update = ({store, notifications, older}) => {
|
||||||
|
store.dispatch('setNotificationsError', { value: false })
|
||||||
|
|
||||||
|
store.dispatch('addNewNotifications', { notifications, older })
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchAndUpdate = ({store, credentials, older = false}) => {
|
||||||
|
const args = { credentials }
|
||||||
|
const rootState = store.rootState || store.state
|
||||||
|
const timelineData = rootState.statuses.notifications
|
||||||
|
|
||||||
|
if (older) {
|
||||||
|
if (timelineData.minId !== Number.POSITIVE_INFINITY) {
|
||||||
|
args['until'] = timelineData.minId
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
args['since'] = timelineData.maxId
|
||||||
|
}
|
||||||
|
|
||||||
|
args['timeline'] = 'notifications'
|
||||||
|
|
||||||
|
return apiService.fetchTimeline(args)
|
||||||
|
.then((notifications) => {
|
||||||
|
update({store, notifications, older})
|
||||||
|
}, () => store.dispatch('setNotificationsError', { value: true }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const startFetching = ({credentials, store}) => {
|
||||||
|
fetchAndUpdate({ credentials, store })
|
||||||
|
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
|
||||||
|
return setInterval(boundFetchAndUpdate, 10000)
|
||||||
|
}
|
||||||
|
|
||||||
|
const notificationsFetcher = {
|
||||||
|
fetchAndUpdate,
|
||||||
|
startFetching
|
||||||
|
}
|
||||||
|
|
||||||
|
export default notificationsFetcher
|
Loading…
Reference in a new issue