Skip to content

Commit

Permalink
feat(details): ✨ Added the notify button back into the details pages …
Browse files Browse the repository at this point in the history
…for requests
  • Loading branch information
tidusjar committed Dec 22, 2021
1 parent 9fe1f8e commit 8b33cdc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
{{'Common.Request' | translate }}
</button>
</ng-template>
<span *ngIf="!isAdmin && movie.showSubscribe" >
<button *ngIf="!movie.subscribed" (click)="notify()" id="notifyBtn" mat-raised-button class="btn-spacing" > <i class="fas fa-bell"></i>
{{ 'Requests.Notify' | translate }}</button>
<button *ngIf="movie.subscribed" (click)="unNotify()" id="unnotifyBtn" mat-raised-button class="btn-spacing" > <i class="fas fa-bell-slash"></i>
{{ 'Requests.RemoveNotification' | translate }}</button>
</span>
</span>
<span *ngIf="isAdmin && hasRequest">
<button id="approveBtn" *ngIf="!movie.approved " (click)="approve()" mat-raised-button class="btn-spacing" color="accent">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,28 @@ export class MovieDetailsComponent {
});
}

public notify() {
this.requestService.subscribeToMovie(this.movieRequest.id).subscribe(result => {
if (result) {
this.movie.subscribed = true;
this.messageService.send(this.translate.instant("Requests.SuccessfulNotify", {title: this.movie.title}), "Ok");
} else {
this.messageService.send(this.translate.instant("Requests.CouldntNotify", {title: this.movie.title}), "Ok");
}
});
}

public unNotify() {
this.requestService.unSubscribeToMovie(this.movieRequest.id).subscribe(result => {
if (result) {
this.movie.subscribed = false;
this.messageService.send(this.translate.instant("Requests.SuccessfulUnNotify", {title: this.movie.title}), "Ok");
} else {
this.messageService.send(this.translate.instant("Requests.CouldntNotify", {title: this.movie.title}), "Ok");
}
});
}

private loadBanner() {
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
if (!this.movie.backdropPath) {
Expand Down
7 changes: 6 additions & 1 deletion src/Ombi/wwwroot/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@
"MovieRequestQuotaExceeded":"You have exceeded your Movie request quota!",
"TvRequestQuotaExceeded":"You have exceeded your Episode request quota!",
"AlbumRequestQuotaExceeded":"You have exceeded your Album request quota!"
}
},
"Notify": "Notify",
"RemoveNotification": "Remove Notifications",
"SuccessfulNotify":"You will now be notified for title {{title}}",
"SuccessfulUnNotify":"You will no longer be notified for title {{title}}",
"CouldntNotify":"Couldn't notify title {{title}}"
},
"Issues": {
"Title": "Issues",
Expand Down

0 comments on commit 8b33cdc

Please # to comment.