Skip to content

Commit

Permalink
fix(discover): Fix denied requests displayed as approved (#4901)
Browse files Browse the repository at this point in the history
  • Loading branch information
sephrat committed Apr 15, 2023
1 parent bdc0214 commit 1e87f20
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Ombi.Core/Models/Requests/RecentlyRequestedModel.cs
Expand Up @@ -16,6 +16,7 @@ public class RecentlyRequestedModel
public string Overview { get; set; }
public DateTime ReleaseDate { get; set; }
public bool Approved { get; set; }
public bool Denied { get; set; }
public string MediaId { get; set; }

public string PosterPath { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/Ombi.Core/Services/RecentlyRequestedService.cs
Expand Up @@ -88,6 +88,7 @@ public async Task<IEnumerable<RecentlyRequestedModel>> GetRecentlyRequested(Canc
Title = item.Title,
Type = RequestType.Movie,
Approved = item.Approved,
Denied = item.Denied ?? false,
UserId = item.RequestedUserId,
Username = item.RequestedUser.UserAlias,
MediaId = item.TheMovieDbId.ToString(),
Expand All @@ -108,6 +109,7 @@ public async Task<IEnumerable<RecentlyRequestedModel>> GetRecentlyRequested(Canc
Available = item.Available,
Overview = item.ArtistName,
Approved = item.Approved,
Denied = item.Denied ?? false,
ReleaseDate = item.ReleaseDate,
RequestDate = item.RequestedDate,
Title = item.Title,
Expand Down Expand Up @@ -135,6 +137,7 @@ public async Task<IEnumerable<RecentlyRequestedModel>> GetRecentlyRequested(Canc
Overview = item.ParentRequest.Overview,
ReleaseDate = item.ParentRequest.ReleaseDate,
Approved = item.Approved,
Denied = item.Denied ?? false,
RequestDate = item.RequestedDate,
TvPartiallyAvailable = partialAvailability,
Title = item.ParentRequest.Title,
Expand Down
Expand Up @@ -41,6 +41,9 @@ export class DetailedCardComponent implements OnInit, OnDestroy {
}

public getStatus(request: IRecentlyRequested) {
if (request.denied) {
return "Common.Denied";
}
if (request.available) {
return "Common.Available";
}
Expand All @@ -63,6 +66,9 @@ export class DetailedCardComponent implements OnInit, OnDestroy {
}

public getClass(request: IRecentlyRequested) {
if (request.denied) {
return "danger";
}
if (request.available || request.tvPartiallyAvailable) {
return "success";
}
Expand Down Expand Up @@ -113,7 +119,7 @@ export class DetailedCardComponent implements OnInit, OnDestroy {
this.setBackgroundStyle(this.request.background);
return;
}

// Set background style while image path is loading.
this.setBackgroundStyle(null);
switch (this.request.type) {
Expand Down
3 changes: 2 additions & 1 deletion src/Ombi/ClientApp/src/app/interfaces/IRecentlyRequested.ts
Expand Up @@ -11,9 +11,10 @@ export interface IRecentlyRequested {
overview: string;
releaseDate: Date;
approved: boolean;
denied: boolean;
mediaId: string;
type: RequestType;

posterPath: string;
background: string;
}
}

0 comments on commit 1e87f20

Please sign in to comment.