mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-30 17:15:16 +01:00
refs #254 Allow delete toot in favourites, local, public and lists
This commit is contained in:
parent
439966cbcb
commit
2a0e432f23
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="favourites">
|
||||
<div class="fav" v-for="message in favourites" v-bind:key="message.id">
|
||||
<toot :message="message" v-on:update="updateToot"></toot>
|
||||
<toot :message="message" v-on:update="updateToot" v-on:delete="deleteToot"></toot>
|
||||
</div>
|
||||
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor">
|
||||
</div>
|
||||
@ -56,6 +56,9 @@ export default {
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Favourites/updateToot', message)
|
||||
},
|
||||
deleteToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Favourites/deleteToot', message)
|
||||
},
|
||||
onScroll (event) {
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('favourites').clientHeight - 10) && !this.lazyloading) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Favourites/lazyFetchFavourites', this.favourites[this.favourites.length - 1])
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
|
||||
<transition-group name="timeline" tag="div">
|
||||
<div class="list-timeline" v-for="message in timeline" v-bind:key="message.id">
|
||||
<toot :message="message" v-on:update="updateToot"></toot>
|
||||
<toot :message="message" v-on:update="updateToot" v-on:delete="deleteToot"></toot>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor"></div>
|
||||
@ -90,6 +90,9 @@ export default {
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Lists/updateToot', message)
|
||||
},
|
||||
deleteToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Lists/deleteToot', message)
|
||||
},
|
||||
onScroll (event) {
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementsByName('lists')[0].clientHeight - 10) && !this.lazyloading) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Lists/lazyFetchTimeline', {
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
|
||||
<transition-group name="timeline" tag="div">
|
||||
<div class="local-timeline" v-for="message in timeline" v-bind:key="message.id">
|
||||
<toot :message="message" v-on:update="updateToot"></toot>
|
||||
<toot :message="message" v-on:update="updateToot" v-on:delete="deleteToot"></toot>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor">
|
||||
@ -77,6 +77,9 @@ export default {
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/updateToot', message)
|
||||
},
|
||||
deleteToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Local/deleteToot', message)
|
||||
},
|
||||
onScroll (event) {
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('local').clientHeight - 10) && !this.lazyloading) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Local/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
|
||||
<transition-group name="timeline" tag="div">
|
||||
<div class="public-timeline" v-for="message in timeline" v-bind:key="message.id">
|
||||
<toot :message="message" v-on:update="updateToot"></toot>
|
||||
<toot :message="message" v-on:update="updateToot" v-on:delete="deleteToot"></toot>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor">
|
||||
@ -77,6 +77,9 @@ export default {
|
||||
updateToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/updateToot', message)
|
||||
},
|
||||
deleteToot (message) {
|
||||
this.$store.commit('TimelineSpace/Contents/Public/deleteToot', message)
|
||||
},
|
||||
onScroll (event) {
|
||||
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('public').clientHeight - 10) && !this.lazyloading) {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Public/lazyFetchTimeline', this.timeline[this.timeline.length - 1])
|
||||
|
@ -29,6 +29,15 @@ const Favourites = {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteToot (state, message) {
|
||||
state.timeline = state.timeline.filter((toot) => {
|
||||
if (toot.reblog !== null && toot.reblog.id === message.id) {
|
||||
return false
|
||||
} else {
|
||||
return toot.id !== message.id
|
||||
}
|
||||
})
|
||||
},
|
||||
changeLazyLoading (state, value) {
|
||||
state.lazyLoading = value
|
||||
}
|
||||
|
@ -53,6 +53,15 @@ const Lists = {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteToot (state, message) {
|
||||
state.timeline = state.timeline.filter((toot) => {
|
||||
if (toot.reblog !== null && toot.reblog.id === message.id) {
|
||||
return false
|
||||
} else {
|
||||
return toot.id !== message.id
|
||||
}
|
||||
})
|
||||
},
|
||||
changeLazyLoading (state, value) {
|
||||
state.lazyLoading = value
|
||||
}
|
||||
|
@ -53,6 +53,15 @@ const Local = {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteToot (state, message) {
|
||||
state.timeline = state.timeline.filter((toot) => {
|
||||
if (toot.reblog !== null && toot.reblog.id === message.id) {
|
||||
return false
|
||||
} else {
|
||||
return toot.id !== message.id
|
||||
}
|
||||
})
|
||||
},
|
||||
changeLazyLoading (state, value) {
|
||||
state.lazyLoading = value
|
||||
}
|
||||
|
@ -53,6 +53,15 @@ const Public = {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteToot (state, message) {
|
||||
state.timeline = state.timeline.filter((toot) => {
|
||||
if (toot.reblog !== null && toot.reblog.id === message.id) {
|
||||
return false
|
||||
} else {
|
||||
return toot.id !== message.id
|
||||
}
|
||||
})
|
||||
},
|
||||
changeLazyLoading (state, value) {
|
||||
state.lazyLoading = value
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user