feat: mark as watched button in feed (#3746)

* feat: add mark as watched/unwatched button

* fix: remove from trending page and hide if watch history is diabled

remove the button from trending page because it only works in feed page.

* fix: missing thumbnail url in watch_history  when using mark as watched

* fix: missing uploadername in watch_history when using mark as watched

* refactor: make mark as watched consistent with other app elements

* refactor: simplify setting "watched" property for videos

---------

Co-authored-by: Bnyro <bnyro@tutanota.com>
This commit is contained in:
HiImKobeAnd
2025-01-07 13:50:53 +01:00
committed by GitHub
parent 56bcc1b90f
commit 676dbef9b8
4 changed files with 60 additions and 3 deletions

View File

@@ -48,7 +48,7 @@
<LoadingIndicatorPage :show-content="videosStore != null" class="video-grid">
<template v-for="video in filteredVideos" :key="video.url">
<VideoItem v-if="shouldShowVideo(video)" :is-feed="true" :item="video" />
<VideoItem v-if="shouldShowVideo(video)" :is-feed="true" :item="video" @update:watched="onUpdateWatched" />
</template>
</LoadingIndicatorPage>
</template>
@@ -140,6 +140,15 @@ export default {
this.loadMoreVideos();
}
},
onUpdateWatched(urls = null) {
if (urls === null) {
if (this.videos.length > 0) this.updateWatched(this.videos);
return;
}
const subset = this.videos.filter(({ url }) => urls.includes(url));
if (subset.length > 0) this.updateWatched(subset);
},
shouldShowVideo(video) {
switch (this.selectedFilter.toLowerCase()) {
case "shorts":