mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 01:56:55 -07:00
fix(issues): 🐛 Fixed where we did not show the poster when an issue is raised for media we do not have a request for #4402
This commit is contained in:
parent
1023574631
commit
15e37b532a
13 changed files with 85 additions and 47 deletions
18
src/Ombi.Helpers/NotificationSubstitues.cs
Normal file
18
src/Ombi.Helpers/NotificationSubstitues.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Ombi.Helpers
|
||||||
|
{
|
||||||
|
public static class NotificationSubstitues
|
||||||
|
{
|
||||||
|
public const string Title = nameof(Title);
|
||||||
|
public const string IssueDescription = nameof(IssueDescription);
|
||||||
|
public const string IssueCategory = nameof(IssueCategory);
|
||||||
|
public const string IssueStatus = nameof(IssueStatus);
|
||||||
|
public const string IssueSubject = nameof(IssueSubject);
|
||||||
|
public const string IssueUser = nameof(IssueUser);
|
||||||
|
public const string IssueUserAlias = nameof(IssueUserAlias);
|
||||||
|
public const string RequestType = nameof(RequestType);
|
||||||
|
public const string PosterPath = nameof(PosterPath);
|
||||||
|
public const string NewIssueComment = nameof(NewIssueComment);
|
||||||
|
public const string IssueId = nameof(IssueId);
|
||||||
|
public const string AdminComment = nameof(AdminComment);
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,7 +39,12 @@ namespace Ombi.Notifications
|
||||||
Year = req?.ReleaseDate.Year.ToString();
|
Year = req?.ReleaseDate.Year.ToString();
|
||||||
Overview = req?.Overview;
|
Overview = req?.Overview;
|
||||||
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
|
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
|
||||||
PosterImage = $"https://image.tmdb.org/t/p/w300/{req?.PosterPath?.TrimStart('/') ?? string.Empty}";
|
|
||||||
|
var img = req?.PosterPath ?? string.Empty;
|
||||||
|
if (img.HasValue())
|
||||||
|
{
|
||||||
|
PosterImage = $"https://image.tmdb.org/t/p/w300/{req?.PosterPath?.TrimStart('/') ?? string.Empty}";
|
||||||
|
}
|
||||||
CalculateRequestStatus(req);
|
CalculateRequestStatus(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +58,12 @@ namespace Ombi.Notifications
|
||||||
Year = req?.ParentRequest?.ReleaseDate.Year.ToString();
|
Year = req?.ParentRequest?.ReleaseDate.Year.ToString();
|
||||||
Overview = req?.ParentRequest?.Overview;
|
Overview = req?.ParentRequest?.Overview;
|
||||||
AdditionalInformation = opts.AdditionalInformation;
|
AdditionalInformation = opts.AdditionalInformation;
|
||||||
PosterImage =
|
var img = req?.ParentRequest?.PosterPath ?? string.Empty;
|
||||||
$"https://image.tmdb.org/t/p/w300/{req?.ParentRequest?.PosterPath?.TrimStart('/') ?? string.Empty}";
|
if (img.HasValue())
|
||||||
|
{
|
||||||
|
PosterImage =
|
||||||
|
$"https://image.tmdb.org/t/p/w300/{req?.ParentRequest?.PosterPath?.TrimStart('/') ?? string.Empty}";
|
||||||
|
}
|
||||||
|
|
||||||
// Generate episode list.
|
// Generate episode list.
|
||||||
StringBuilder epSb = new StringBuilder();
|
StringBuilder epSb = new StringBuilder();
|
||||||
|
@ -94,16 +103,17 @@ namespace Ombi.Notifications
|
||||||
|
|
||||||
private void LoadIssues(NotificationOptions opts)
|
private void LoadIssues(NotificationOptions opts)
|
||||||
{
|
{
|
||||||
IssueDescription = opts.Substitutes.TryGetValue("IssueDescription", out string val) ? val : string.Empty;
|
IssueDescription = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueDescription, out string val) ? val : string.Empty;
|
||||||
IssueCategory = opts.Substitutes.TryGetValue("IssueCategory", out val) ? val : string.Empty;
|
IssueCategory = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueCategory, out val) ? val : string.Empty;
|
||||||
IssueStatus = opts.Substitutes.TryGetValue("IssueStatus", out val) ? val : string.Empty;
|
IssueStatus = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueStatus, out val) ? val : string.Empty;
|
||||||
IssueSubject = opts.Substitutes.TryGetValue("IssueSubject", out val) ? val : string.Empty;
|
IssueSubject = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueSubject, out val) ? val : string.Empty;
|
||||||
NewIssueComment = opts.Substitutes.TryGetValue("NewIssueComment", out val) ? val : string.Empty;
|
NewIssueComment = opts.Substitutes.TryGetValue(NotificationSubstitues.NewIssueComment, out val) ? val : string.Empty;
|
||||||
UserName = opts.Substitutes.TryGetValue("IssueUser", out val) ? val : string.Empty;
|
UserName = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueUser, out val) ? val : string.Empty;
|
||||||
Alias = opts.Substitutes.TryGetValue("IssueUserAlias", out val) ? val : string.Empty;
|
Alias = opts.Substitutes.TryGetValue(NotificationSubstitues.IssueUserAlias, out val) ? val : string.Empty;
|
||||||
Type = opts.Substitutes.TryGetValue("RequestType", out val) && Enum.TryParse(val, out RequestType type)
|
Type = opts.Substitutes.TryGetValue(NotificationSubstitues.RequestType, out val) && Enum.TryParse(val, out RequestType type)
|
||||||
? HumanizeReturnType(type)
|
? HumanizeReturnType(type)
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
PosterImage = opts.Substitutes.TryGetValue(NotificationSubstitues.PosterPath, out val) ? $"https://image.tmdb.org/t/p/w300/{val.TrimStart('/')}" : string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadCommon(BaseRequest req, CustomizationSettings s, UserNotificationPreferences pref, NotificationOptions opts)
|
private void LoadCommon(BaseRequest req, CustomizationSettings s, UserNotificationPreferences pref, NotificationOptions opts)
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace Ombi.Store.Entities.Requests
|
||||||
public string UserReportedId { get; set; }
|
public string UserReportedId { get; set; }
|
||||||
public OmbiUser UserReported { get; set; }
|
public OmbiUser UserReported { get; set; }
|
||||||
public List<IssueComments> Comments { get; set; }
|
public List<IssueComments> Comments { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string PosterPath { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IssueStatus
|
public enum IssueStatus
|
||||||
|
|
3
src/Ombi/.vscode/settings.json
vendored
3
src/Ombi/.vscode/settings.json
vendored
|
@ -17,6 +17,7 @@
|
||||||
"settings",
|
"settings",
|
||||||
"user-management",
|
"user-management",
|
||||||
"newsletter",
|
"newsletter",
|
||||||
"mass-email"
|
"mass-email",
|
||||||
|
"issues"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ export interface IIssues {
|
||||||
comments: IIssueComments[];
|
comments: IIssueComments[];
|
||||||
requestId: number | undefined;
|
requestId: number | undefined;
|
||||||
userReported: IUser | undefined;
|
userReported: IUser | undefined;
|
||||||
|
posterPath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum IssueStatus {
|
export enum IssueStatus {
|
||||||
|
|
|
@ -70,6 +70,7 @@ export class IssueDetailsComponent implements OnInit {
|
||||||
requestId: x.requestId,
|
requestId: x.requestId,
|
||||||
providerId: x.providerId,
|
providerId: x.providerId,
|
||||||
userReported: x.userReported,
|
userReported: x.userReported,
|
||||||
|
posterPath: undefined, // Poster Path is not stored in the db, will always be undefined
|
||||||
};
|
};
|
||||||
this.setBackground(x);
|
this.setBackground(x);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import { MovieDetailsComponent } from "./movie/movie-details.component";
|
import { IssuesService, RadarrService, RequestService, SearchService, SonarrService } from "../../services";
|
||||||
import { YoutubeTrailerComponent } from "./shared/youtube-trailer.component";
|
|
||||||
import { TvDetailsComponent } from "./tv/tv-details.component";
|
|
||||||
import { MovieInformationPanelComponent } from "./movie/panels/movie-information-panel.component";
|
|
||||||
import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel/tv-information-panel.component";
|
|
||||||
import { TopBannerComponent } from "./shared/top-banner/top-banner.component";
|
|
||||||
import { SocialIconsComponent } from "./shared/social-icons/social-icons.component";
|
|
||||||
import { MediaPosterComponent } from "./shared/media-poster/media-poster.component";
|
|
||||||
import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component";
|
|
||||||
import { DenyDialogComponent } from "./shared/deny-dialog/deny-dialog.component";
|
|
||||||
import { TvRequestsPanelComponent } from "./tv/panels/tv-requests/tv-requests-panel.component";
|
|
||||||
import { MovieAdvancedOptionsComponent } from "./movie/panels/movie-advanced-options/movie-advanced-options.component";
|
|
||||||
import { SearchService, RequestService, RadarrService, IssuesService, SonarrService } from "../../services";
|
|
||||||
import { RequestServiceV2 } from "../../services/requestV2.service";
|
|
||||||
import { NewIssueComponent } from "./shared/new-issue/new-issue.component";
|
|
||||||
import { ArtistDetailsComponent } from "./artist/artist-details.component";
|
import { ArtistDetailsComponent } from "./artist/artist-details.component";
|
||||||
import { ArtistInformationPanel } from "./artist/panels/artist-information-panel/artist-information-panel.component";
|
import { ArtistInformationPanel } from "./artist/panels/artist-information-panel/artist-information-panel.component";
|
||||||
import { ArtistReleasePanel } from "./artist/panels/artist-release-panel/artist-release-panel.component";
|
import { ArtistReleasePanel } from "./artist/panels/artist-release-panel/artist-release-panel.component";
|
||||||
|
import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component";
|
||||||
|
import { DenyDialogComponent } from "./shared/deny-dialog/deny-dialog.component";
|
||||||
import { IssuesPanelComponent } from "./shared/issues-panel/issues-panel.component";
|
import { IssuesPanelComponent } from "./shared/issues-panel/issues-panel.component";
|
||||||
import { TvAdvancedOptionsComponent } from "./tv/panels/tv-advanced-options/tv-advanced-options.component";
|
import { MediaPosterComponent } from "./shared/media-poster/media-poster.component";
|
||||||
|
import { MovieAdvancedOptionsComponent } from "./movie/panels/movie-advanced-options/movie-advanced-options.component";
|
||||||
|
import { MovieDetailsComponent } from "./movie/movie-details.component";
|
||||||
|
import { MovieInformationPanelComponent } from "./movie/panels/movie-information-panel.component";
|
||||||
|
import { NewIssueComponent } from "./shared/new-issue/new-issue.component";
|
||||||
import { RequestBehalfComponent } from "./shared/request-behalf/request-behalf.component";
|
import { RequestBehalfComponent } from "./shared/request-behalf/request-behalf.component";
|
||||||
|
import { RequestServiceV2 } from "../../services/requestV2.service";
|
||||||
|
import { SocialIconsComponent } from "./shared/social-icons/social-icons.component";
|
||||||
|
import { TopBannerComponent } from "./shared/top-banner/top-banner.component";
|
||||||
|
import { TvAdvancedOptionsComponent } from "./tv/panels/tv-advanced-options/tv-advanced-options.component";
|
||||||
|
import { TvDetailsComponent } from "./tv/tv-details.component";
|
||||||
|
import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel/tv-information-panel.component";
|
||||||
import { TvRequestGridComponent } from "./tv/panels/tv-request-grid/tv-request-grid.component";
|
import { TvRequestGridComponent } from "./tv/panels/tv-request-grid/tv-request-grid.component";
|
||||||
import { DetailsGroupComponent } from "../../issues/components/details-group/details-group.component";
|
import { TvRequestsPanelComponent } from "./tv/panels/tv-requests/tv-requests-panel.component";
|
||||||
|
import { YoutubeTrailerComponent } from "./shared/youtube-trailer.component";
|
||||||
|
|
||||||
export const components: any[] = [
|
export const components: any[] = [
|
||||||
MovieDetailsComponent,
|
MovieDetailsComponent,
|
||||||
|
|
|
@ -145,7 +145,7 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
data: { requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: provider, title: this.movie.title }
|
data: { requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: provider, title: this.movie.title, posterPath: this.movie.posterPath }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,5 @@ export interface IIssueDialogData {
|
||||||
requestId: number;
|
requestId: number;
|
||||||
providerId: string;
|
providerId: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
posterPath: string;
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
import { Component, Inject, OnInit } from "@angular/core";
|
import { Component, Inject, OnInit } from "@angular/core";
|
||||||
import { IDenyDialogData, IIssueDialogData } from "../interfaces/interfaces";
|
import { IIssueDialogData } from "../interfaces/interfaces";
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
|
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
|
||||||
import { MessageService, IssuesService } from "../../../../services";
|
import { MessageService, IssuesService } from "../../../../services";
|
||||||
import { IIssues, IIssueCategory, IssueStatus, RequestType } from "../../../../interfaces";
|
import { IIssues, IIssueCategory, IssueStatus, RequestType } from "../../../../interfaces";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
import { firstValueFrom } from "rxjs";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "new-issue",
|
selector: "new-issue",
|
||||||
|
@ -20,7 +21,6 @@ export class NewIssueComponent implements OnInit {
|
||||||
private issueService: IssuesService,
|
private issueService: IssuesService,
|
||||||
public messageService: MessageService,
|
public messageService: MessageService,
|
||||||
private translate: TranslateService) {
|
private translate: TranslateService) {
|
||||||
debugger;
|
|
||||||
this.issue = {
|
this.issue = {
|
||||||
subject: "",
|
subject: "",
|
||||||
description: "",
|
description: "",
|
||||||
|
@ -35,16 +35,18 @@ export class NewIssueComponent implements OnInit {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
providerId: data.providerId,
|
providerId: data.providerId,
|
||||||
userReported: undefined,
|
userReported: undefined,
|
||||||
|
posterPath: data.posterPath,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ngOnInit(): Promise<void> {
|
public async ngOnInit(): Promise<void> {
|
||||||
this.issueCategories = await this.issueService.getCategories().toPromise();
|
const categories$ = this.issueService.getCategories();
|
||||||
|
this.issueCategories = await firstValueFrom(categories$);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createIssue() {
|
public async createIssue() {
|
||||||
const result = await this.issueService.createIssue(this.issue).toPromise();
|
const result = await this.issueService.createIssue(this.issue).toPromise();
|
||||||
if(result) {
|
if (result) {
|
||||||
this.messageService.send(this.translate.instant("Issues.IssueDialog.IssueCreated"));
|
this.messageService.send(this.translate.instant("Issues.IssueDialog.IssueCreated"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class TvDetailsComponent implements OnInit {
|
||||||
public async issue() {
|
public async issue() {
|
||||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
data: { requestId: this.tvRequest ? this.tv.requestId : null, requestType: RequestType.tvShow, providerId: this.tv.theTvDbId, title: this.tv.title }
|
data: { requestId: this.tvRequest ? this.tv.requestId : null, requestType: RequestType.tvShow, providerId: this.tv.theTvDbId, title: this.tv.title, posterPath: this.tv.images.original }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||||
|
|
||||||
import { IIssueCategory, IIssues, IssueStatus, RequestType } from "../interfaces";
|
import { IIssueCategory, IIssues, IssueStatus, RequestType } from "../interfaces";
|
||||||
import { IssuesService, NotificationService } from "../services";
|
import { IssuesService, NotificationService } from "../services";
|
||||||
|
|
||||||
|
@ -44,6 +43,7 @@ export class IssuesReportComponent {
|
||||||
title: "",
|
title: "",
|
||||||
providerId: "",
|
providerId: "",
|
||||||
userReported: undefined,
|
userReported: undefined,
|
||||||
|
posterPath: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ export class IssuesReportComponent {
|
||||||
issue.issueCategoryId = this.issueCategory.id;
|
issue.issueCategoryId = this.issueCategory.id;
|
||||||
issue.title = this.title;
|
issue.title = this.title;
|
||||||
issue.providerId = this.providerId;
|
issue.providerId = this.providerId;
|
||||||
|
issue.posterPath = this.posterPath;
|
||||||
if (this.movie) {
|
if (this.movie) {
|
||||||
issue.requestType = RequestType.movie;
|
issue.requestType = RequestType.movie;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -244,9 +244,9 @@ namespace Ombi.Controllers.V1
|
||||||
|
|
||||||
var isAdmin = await _userManager.IsInRoleAsync(user, OmbiRoles.Admin) || user.IsSystemUser;
|
var isAdmin = await _userManager.IsInRoleAsync(user, OmbiRoles.Admin) || user.IsSystemUser;
|
||||||
AddIssueNotificationSubstitutes(notificationModel, issue, user.UserName, user.UserAlias);
|
AddIssueNotificationSubstitutes(notificationModel, issue, user.UserName, user.UserAlias);
|
||||||
notificationModel.Substitutes.Add("NewIssueComment", comment.Comment);
|
notificationModel.Substitutes.Add(NotificationSubstitues.NewIssueComment, comment.Comment);
|
||||||
notificationModel.Substitutes.Add("IssueId", comment.IssueId.ToString());
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueId, comment.IssueId.ToString());
|
||||||
notificationModel.Substitutes.Add("AdminComment", isAdmin.ToString());
|
notificationModel.Substitutes.Add(NotificationSubstitues.AdminComment, isAdmin.ToString());
|
||||||
|
|
||||||
if (isAdmin)
|
if (isAdmin)
|
||||||
{
|
{
|
||||||
|
@ -331,14 +331,15 @@ namespace Ombi.Controllers.V1
|
||||||
|
|
||||||
private static void AddIssueNotificationSubstitutes(NotificationOptions notificationModel, Issues issue, string issueReportedUsername, string alias)
|
private static void AddIssueNotificationSubstitutes(NotificationOptions notificationModel, Issues issue, string issueReportedUsername, string alias)
|
||||||
{
|
{
|
||||||
notificationModel.Substitutes.Add("Title", issue.Title);
|
notificationModel.Substitutes.Add(NotificationSubstitues.Title, issue.Title);
|
||||||
notificationModel.Substitutes.Add("IssueDescription", issue.Description);
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueDescription, issue.Description);
|
||||||
notificationModel.Substitutes.Add("IssueCategory", issue.IssueCategory?.Value);
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueCategory, issue.IssueCategory?.Value);
|
||||||
notificationModel.Substitutes.Add("IssueStatus", issue.Status.ToString());
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueStatus, issue.Status.ToString());
|
||||||
notificationModel.Substitutes.Add("IssueSubject", issue.Subject);
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueSubject, issue.Subject);
|
||||||
notificationModel.Substitutes.Add("IssueUser", issueReportedUsername);
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueUser, issueReportedUsername);
|
||||||
notificationModel.Substitutes.Add("IssueUserAlias", alias);
|
notificationModel.Substitutes.Add(NotificationSubstitues.IssueUserAlias, alias);
|
||||||
notificationModel.Substitutes.Add("RequestType", notificationModel.RequestType.ToString());
|
notificationModel.Substitutes.Add(NotificationSubstitues.RequestType, notificationModel.RequestType.ToString());
|
||||||
|
notificationModel.Substitutes.Add(NotificationSubstitues.PosterPath, issue.PosterPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue