forked from AkkomaGang/akkoma-fe
Merge branch '516-autoload' into 'develop'
Autoload older notifications when scrolled to the bottom Closes #516 See merge request pleroma/pleroma-fe!780
This commit is contained in:
commit
b47820905c
3 changed files with 10 additions and 1 deletions
|
@ -63,6 +63,11 @@ const MobileNav = {
|
|||
},
|
||||
markNotificationsAsSeen () {
|
||||
this.$refs.notifications.markAsSeen()
|
||||
},
|
||||
onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) {
|
||||
if (this.$store.state.config.autoLoad && scrollTop + clientHeight >= scrollHeight) {
|
||||
this.$refs.notifications.fetchOlderNotifications()
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<i class="button-icon icon-cancel"/>
|
||||
</a>
|
||||
</div>
|
||||
<div v-if="currentUser" class="mobile-notifications">
|
||||
<div class="mobile-notifications" @scroll="onScroll">
|
||||
<Notifications ref="notifications" noHeading="true"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -52,6 +52,10 @@ const Notifications = {
|
|||
this.$store.dispatch('markNotificationsAsSeen')
|
||||
},
|
||||
fetchOlderNotifications () {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
|
||||
const store = this.$store
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
store.commit('setNotificationsLoading', { value: true })
|
||||
|
|
Loading…
Reference in a new issue