aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-library/my-history/my-history.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-18 11:23:41 +0100
committerChocobozzz <me@florianbigard.com>2022-01-18 11:23:41 +0100
commit7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180 (patch)
tree016cb0d966fe9fea8a6381eb246e966f5c4eae57 /client/src/app/+my-library/my-history/my-history.component.ts
parent3b83faccfffc13adaef0b63c211b1ce4944e8b3b (diff)
downloadPeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.tar.gz
PeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.tar.zst
PeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.zip
Add ability to delete history element
Diffstat (limited to 'client/src/app/+my-library/my-history/my-history.component.ts')
-rw-r--r--client/src/app/+my-library/my-history/my-history.component.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/client/src/app/+my-library/my-history/my-history.component.ts b/client/src/app/+my-library/my-history/my-history.component.ts
index 95cfaee41..34efe5558 100644
--- a/client/src/app/+my-library/my-history/my-history.component.ts
+++ b/client/src/app/+my-library/my-history/my-history.component.ts
@@ -123,14 +123,25 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
123 }) 123 })
124 } 124 }
125 125
126 async deleteHistory () { 126 deleteHistoryElement (video: Video) {
127 this.userHistoryService.deleteUserVideoHistoryElement(video)
128 .subscribe({
129 next: () => {
130 this.videos = this.videos.filter(v => v.id !== video.id)
131 },
132
133 error: err => this.notifier.error(err.message)
134 })
135 }
136
137 async clearAllHistory () {
127 const title = $localize`Delete videos history` 138 const title = $localize`Delete videos history`
128 const message = $localize`Are you sure you want to delete all your videos history?` 139 const message = $localize`Are you sure you want to delete all your videos history?`
129 140
130 const res = await this.confirmService.confirm(message, title) 141 const res = await this.confirmService.confirm(message, title)
131 if (res !== true) return 142 if (res !== true) return
132 143
133 this.userHistoryService.deleteUserVideosHistory() 144 this.userHistoryService.clearAllUserVideosHistory()
134 .subscribe({ 145 .subscribe({
135 next: () => { 146 next: () => {
136 this.notifier.success($localize`Videos history deleted`) 147 this.notifier.success($localize`Videos history deleted`)