mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-23 06:25:24 -07:00
Merge 622b1f69f8
into 09f648515e
This commit is contained in:
commit
a922106ea4
18 changed files with 172 additions and 118 deletions
|
@ -51,7 +51,7 @@ namespace Ombi.Core.Tests.Engine.V2
|
||||||
[Ignore("Needs to be tested")]
|
[Ignore("Needs to be tested")]
|
||||||
public async Task Get_UnavailableRequests()
|
public async Task Get_UnavailableRequests()
|
||||||
{
|
{
|
||||||
_movieRequestRepository.Setup(x => x.GetWithUser()).Returns(new List<MovieRequests>
|
_movieRequestRepository.Setup(x => x.GetWithUser(false)).Returns(new List<MovieRequests>
|
||||||
{
|
{
|
||||||
new MovieRequests
|
new MovieRequests
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,6 +157,7 @@ namespace Ombi.Core.Engine
|
||||||
var result = new HideResult
|
var result = new HideResult
|
||||||
{
|
{
|
||||||
Hide = settings.HideRequestsUsers,
|
Hide = settings.HideRequestsUsers,
|
||||||
|
Anonimize = settings.AnonimizeRequests,
|
||||||
UserId = user.Id
|
UserId = user.Id
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
|
@ -245,6 +246,7 @@ namespace Ombi.Core.Engine
|
||||||
public class HideResult
|
public class HideResult
|
||||||
{
|
{
|
||||||
public bool Hide { get; set; }
|
public bool Hide { get; set; }
|
||||||
|
public bool Anonimize { get; set; }
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ namespace Ombi.Core.Engine
|
||||||
{
|
{
|
||||||
allRequests =
|
allRequests =
|
||||||
MovieRepository
|
MovieRepository
|
||||||
.GetWithUser(); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync();
|
.GetWithUser(shouldHide.Anonimize); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (orderFilter.AvailabilityFilter)
|
switch (orderFilter.AvailabilityFilter)
|
||||||
|
@ -240,7 +240,7 @@ namespace Ombi.Core.Engine
|
||||||
{
|
{
|
||||||
allRequests =
|
allRequests =
|
||||||
MovieRepository
|
MovieRepository
|
||||||
.GetWithUser();
|
.GetWithUser(shouldHide.Anonimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true);
|
var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true);
|
||||||
|
@ -284,7 +284,7 @@ namespace Ombi.Core.Engine
|
||||||
{
|
{
|
||||||
allRequests =
|
allRequests =
|
||||||
MovieRepository
|
MovieRepository
|
||||||
.GetWithUser();
|
.GetWithUser(shouldHide.Anonimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
|
@ -346,7 +346,7 @@ namespace Ombi.Core.Engine
|
||||||
{
|
{
|
||||||
allRequests =
|
allRequests =
|
||||||
MovieRepository
|
MovieRepository
|
||||||
.GetWithUser().Where(x => !x.Available && x.Approved);
|
.GetWithUser(shouldHide.Anonimize).Where(x => !x.Available && x.Approved);
|
||||||
}
|
}
|
||||||
|
|
||||||
var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true);
|
var prop = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(sortProperty, true);
|
||||||
|
@ -428,7 +428,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return await MovieRepository.GetWithUser().CountAsync();
|
return await MovieRepository.GetWithUser(shouldHide.Anonimize).CountAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allRequests = await MovieRepository.GetWithUser().ToListAsync();
|
allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
await CheckForSubscription(shouldHide, allRequests);
|
await CheckForSubscription(shouldHide, allRequests);
|
||||||
|
@ -456,7 +456,8 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public async Task<MovieRequests> GetRequest(int requestId)
|
public async Task<MovieRequests> GetRequest(int requestId)
|
||||||
{
|
{
|
||||||
var request = await MovieRepository.GetWithUser().Where(x => x.Id == requestId).FirstOrDefaultAsync();
|
var shouldHide = await HideFromOtherUsers();
|
||||||
|
var request = await MovieRepository.GetWithUser(shouldHide.Anonimize).Where(x => x.Id == requestId).FirstOrDefaultAsync();
|
||||||
await CheckForSubscription(new HideResult(), new List<MovieRequests> { request });
|
await CheckForSubscription(new HideResult(), new List<MovieRequests> { request });
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
@ -499,7 +500,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allRequests = await MovieRepository.GetWithUser().ToListAsync();
|
allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToList();
|
var results = allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToList();
|
||||||
|
@ -630,7 +631,8 @@ namespace Ombi.Core.Engine
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<MovieRequests> UpdateMovieRequest(MovieRequests request)
|
public async Task<MovieRequests> UpdateMovieRequest(MovieRequests request)
|
||||||
{
|
{
|
||||||
var allRequests = await MovieRepository.GetWithUser().ToListAsync();
|
var shouldHide = await HideFromOtherUsers();
|
||||||
|
var allRequests = await MovieRepository.GetWithUser(shouldHide.Anonimize).ToListAsync();
|
||||||
var results = allRequests.FirstOrDefault(x => x.Id == request.Id);
|
var results = allRequests.FirstOrDefault(x => x.Id == request.Id);
|
||||||
|
|
||||||
results.Approved = request.Approved;
|
results.Approved = request.Approved;
|
||||||
|
|
|
@ -369,7 +369,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allRequests = await TvRepository.GetChild().ToListAsync();
|
allRequests = await TvRepository.GetChild(shouldHide.Anonimize).ToListAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allRequests = await TvRepository.GetChild().ToListAsync();
|
allRequests = await TvRepository.GetChild(shouldHide.Anonimize).ToListAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,9 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
public async Task<UserStatsSummary> GetSummary(SummaryRequest request)
|
public async Task<UserStatsSummary> GetSummary(SummaryRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get all movie requests
|
// get all movie requests
|
||||||
var movies = _movieRequest.GetWithUser();
|
var movies = _movieRequest.GetWithUser(false);
|
||||||
var filteredMovies = movies.Where(x => x.RequestedDate >= request.From && x.RequestedDate <= request.To);
|
var filteredMovies = movies.Where(x => x.RequestedDate >= request.From && x.RequestedDate <= request.To);
|
||||||
var tv = _tvRequest.GetLite();
|
var tv = _tvRequest.GetLite();
|
||||||
var children = tv.SelectMany(x =>
|
var children = tv.SelectMany(x =>
|
||||||
|
|
|
@ -145,7 +145,7 @@ namespace Ombi.Notifications
|
||||||
{
|
{
|
||||||
if (type == RequestType.Movie)
|
if (type == RequestType.Movie)
|
||||||
{
|
{
|
||||||
MovieRequest = await MovieRepository.GetWithUser().FirstOrDefaultAsync(x => x.Id == requestId);
|
MovieRequest = await MovieRepository.GetWithUser(false).FirstOrDefaultAsync(x => x.Id == requestId);
|
||||||
}
|
}
|
||||||
else if (type == RequestType.TvShow)
|
else if (type == RequestType.TvShow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
_ombiSettings = ombiSettings;
|
_ombiSettings = ombiSettings;
|
||||||
_movieRequests = movieRequest;
|
_movieRequests = movieRequest;
|
||||||
_tvRequestRepository = tvRequestRepository;
|
_tvRequestRepository = tvRequestRepository;
|
||||||
_musicRequestRepository = _musicRequestRepository;
|
_musicRequestRepository = musicRequestRepository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace Ombi.Settings.Settings.Models
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public bool DoNotSendNotificationsForAutoApprove { get; set; }
|
public bool DoNotSendNotificationsForAutoApprove { get; set; }
|
||||||
public bool HideRequestsUsers { get; set; }
|
public bool HideRequestsUsers { get; set; }
|
||||||
|
public bool AnonimizeRequests { get; set; }
|
||||||
public bool DisableHealthChecks { get; set; }
|
public bool DisableHealthChecks { get; set; }
|
||||||
public string DefaultLanguageCode
|
public string DefaultLanguageCode
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Ombi.Store.Repository.Requests
|
||||||
Task Update(MovieRequests request);
|
Task Update(MovieRequests request);
|
||||||
Task Save();
|
Task Save();
|
||||||
Task MarkAsAvailable(int id);
|
Task MarkAsAvailable(int id);
|
||||||
IQueryable<MovieRequests> GetWithUser();
|
IQueryable<MovieRequests> GetWithUser(bool anonimize = false);
|
||||||
IQueryable<MovieRequests> GetWithUser(string userId);
|
IQueryable<MovieRequests> GetWithUser(string userId);
|
||||||
IQueryable<MovieRequests> GetAll(string userId);
|
IQueryable<MovieRequests> GetAll(string userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Ombi.Store.Repository.Requests
|
||||||
TvRequests GetRequest(int theMovieDbId);
|
TvRequests GetRequest(int theMovieDbId);
|
||||||
Task Update(TvRequests request);
|
Task Update(TvRequests request);
|
||||||
Task UpdateChild(ChildRequests request);
|
Task UpdateChild(ChildRequests request);
|
||||||
IQueryable<ChildRequests> GetChild();
|
IQueryable<ChildRequests> GetChild(bool anonimize = false);
|
||||||
IQueryable<ChildRequests> GetChild(string userId);
|
IQueryable<ChildRequests> GetChild(string userId);
|
||||||
Task MarkEpisodeAsAvailable(int id);
|
Task MarkEpisodeAsAvailable(int id);
|
||||||
Task MarkChildAsAvailable(int id);
|
Task MarkChildAsAvailable(int id);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Ombi.Store.Repository.Requests
|
||||||
|
|
||||||
public IQueryable<MovieRequests> GetAll(string userId)
|
public IQueryable<MovieRequests> GetAll(string userId)
|
||||||
{
|
{
|
||||||
return GetWithUser().Where(x => x.RequestedUserId == userId);
|
return GetWithUser(false).Where(x => x.RequestedUserId == userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieRequests GetRequest(int theMovieDbId)
|
public MovieRequests GetRequest(int theMovieDbId)
|
||||||
|
@ -46,12 +46,18 @@ namespace Ombi.Store.Repository.Requests
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQueryable<MovieRequests> GetWithUser()
|
public IQueryable<MovieRequests> GetWithUser(bool anonimize = false)
|
||||||
|
{
|
||||||
|
if (!anonimize)
|
||||||
{
|
{
|
||||||
return Db.MovieRequests
|
return Db.MovieRequests
|
||||||
.Include(x => x.RequestedUser)
|
.Include(x => x.RequestedUser)
|
||||||
.ThenInclude(x => x.NotificationUserIds)
|
.ThenInclude(x => x.NotificationUserIds)
|
||||||
.AsQueryable();
|
.AsQueryable();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return Db.MovieRequests.AsNoTracking().AsQueryable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task MarkAsAvailable(int id)
|
public async Task MarkAsAvailable(int id)
|
||||||
|
|
|
@ -80,8 +80,9 @@ namespace Ombi.Store.Repository.Requests
|
||||||
.AsQueryable();
|
.AsQueryable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQueryable<ChildRequests> GetChild()
|
public IQueryable<ChildRequests> GetChild(bool anonimize = false)
|
||||||
{
|
{
|
||||||
|
if (!anonimize) {
|
||||||
return Db.ChildRequests
|
return Db.ChildRequests
|
||||||
.Include(x => x.RequestedUser)
|
.Include(x => x.RequestedUser)
|
||||||
.Include(x => x.ParentRequest)
|
.Include(x => x.ParentRequest)
|
||||||
|
@ -89,6 +90,16 @@ namespace Ombi.Store.Repository.Requests
|
||||||
.ThenInclude(x => x.Episodes)
|
.ThenInclude(x => x.Episodes)
|
||||||
.AsQueryable();
|
.AsQueryable();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Db.ChildRequests
|
||||||
|
.AsNoTracking()
|
||||||
|
.Include(x => x.ParentRequest)
|
||||||
|
.Include(x => x.SeasonRequests)
|
||||||
|
.ThenInclude(x => x.Episodes)
|
||||||
|
.AsQueryable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IQueryable<ChildRequests> GetChild(string userId)
|
public IQueryable<ChildRequests> GetChild(string userId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface IOmbiSettings extends ISettings {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
doNotSendNotificationsForAutoApprove: boolean;
|
doNotSendNotificationsForAutoApprove: boolean;
|
||||||
hideRequestsUsers: boolean;
|
hideRequestsUsers: boolean;
|
||||||
|
anonimizeRequests: boolean;
|
||||||
defaultLanguageCode: string;
|
defaultLanguageCode: string;
|
||||||
disableHealthChecks: boolean;
|
disableHealthChecks: boolean;
|
||||||
autoDeleteAvailableRequests: boolean;
|
autoDeleteAvailableRequests: boolean;
|
||||||
|
|
|
@ -32,6 +32,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
||||||
public currentFilter: RequestFilterType = RequestFilterType.All;
|
public currentFilter: RequestFilterType = RequestFilterType.All;
|
||||||
public selection = new SelectionModel<IMovieRequests>(true, []);
|
public selection = new SelectionModel<IMovieRequests>(true, []);
|
||||||
public userName: string;
|
public userName: string;
|
||||||
|
public anonimized: boolean = true;
|
||||||
|
|
||||||
public RequestFilter = RequestFilterType;
|
public RequestFilter = RequestFilterType;
|
||||||
|
|
||||||
|
@ -102,7 +103,18 @@ export class MoviesGridComponent implements OnInit, AfterViewInit {
|
||||||
// Flip flag to show that loading has finished.
|
// Flip flag to show that loading has finished.
|
||||||
this.isLoadingResults = false;
|
this.isLoadingResults = false;
|
||||||
this.resultsLength = data.total;
|
this.resultsLength = data.total;
|
||||||
|
if (data.collection.filter(x => x.requestedUserId != null).length > 0 &&
|
||||||
|
data.collection.filter(x => x.requestedUser != null).length > 0) {
|
||||||
|
this.anonimized = false;
|
||||||
|
}
|
||||||
|
if (this.anonimized) {
|
||||||
|
this.displayedColumns.forEach((element, index) => {
|
||||||
|
if (element === 'requestedUser.requestedBy')
|
||||||
|
{
|
||||||
|
this.displayedColumns.splice(index, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return data.collection;
|
return data.collection;
|
||||||
}),
|
}),
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
|
|
|
@ -25,6 +25,7 @@ export class TvGridComponent implements OnInit, AfterViewInit {
|
||||||
public defaultSort: string = "requestedDate";
|
public defaultSort: string = "requestedDate";
|
||||||
public defaultOrder: string = "desc";
|
public defaultOrder: string = "desc";
|
||||||
public currentFilter: RequestFilterType = RequestFilterType.All;
|
public currentFilter: RequestFilterType = RequestFilterType.All;
|
||||||
|
public anonimized: boolean = true;
|
||||||
|
|
||||||
public RequestFilter = RequestFilterType;
|
public RequestFilter = RequestFilterType;
|
||||||
public manageOwnRequests: boolean;
|
public manageOwnRequests: boolean;
|
||||||
|
@ -90,6 +91,16 @@ export class TvGridComponent implements OnInit, AfterViewInit {
|
||||||
this.isLoadingResults = false;
|
this.isLoadingResults = false;
|
||||||
this.resultsLength = data.total;
|
this.resultsLength = data.total;
|
||||||
|
|
||||||
|
if (data.collection.filter(x => x.requestedUser != null).length > 0) {
|
||||||
|
this.anonimized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.anonimized) {
|
||||||
|
this.displayedColumns.forEach((element, index) => {
|
||||||
|
if (element == 'requestedBy') this.displayedColumns.splice(index, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return data.collection;
|
return data.collection;
|
||||||
}),
|
}),
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<settings-menu></settings-menu>
|
<settings-menu></settings-menu>
|
||||||
<div class="small-middle-container">
|
<div class="small-middle-container">
|
||||||
<wiki></wiki>
|
<wiki></wiki>
|
||||||
<fieldset *ngIf="form">
|
<fieldset *ngIf="form">
|
||||||
|
@ -35,13 +35,19 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-slide-toggle formControlName="doNotSendNotificationsForAutoApprove">
|
<mat-slide-toggle formControlName="doNotSendNotificationsForAutoApprove">
|
||||||
Do not send Notifications if a User has the Auto Approve permission</mat-slide-toggle>
|
Do not send Notifications if a User has the Auto Approve permission
|
||||||
|
</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-slide-toggle formControlName="hideRequestsUsers">
|
<mat-slide-toggle formControlName="hideRequestsUsers">
|
||||||
Hide requests from other users
|
Hide requests from other users
|
||||||
</mat-slide-toggle>
|
</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<mat-slide-toggle formControlName="anonimizeRequests">
|
||||||
|
Anonimize requests for other users
|
||||||
|
</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<mat-slide-toggle formControlName="autoDeleteAvailableRequests">
|
<mat-slide-toggle formControlName="autoDeleteAvailableRequests">
|
||||||
Auto Delete Available Requests
|
Auto Delete Available Requests
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { FormBuilder, FormGroup } from "@angular/forms";
|
import { FormBuilder, FormGroup } from "@angular/forms";
|
||||||
|
|
||||||
import { Branch, ILanguageRefine, IOmbiSettings } from "../../interfaces";
|
import { Branch, ILanguageRefine, IOmbiSettings } from "../../interfaces";
|
||||||
|
@ -29,6 +29,7 @@ export class OmbiComponent implements OnInit {
|
||||||
baseUrl: [x.baseUrl],
|
baseUrl: [x.baseUrl],
|
||||||
doNotSendNotificationsForAutoApprove: [x.doNotSendNotificationsForAutoApprove],
|
doNotSendNotificationsForAutoApprove: [x.doNotSendNotificationsForAutoApprove],
|
||||||
hideRequestsUsers: [x.hideRequestsUsers],
|
hideRequestsUsers: [x.hideRequestsUsers],
|
||||||
|
anonimizeRequests: [x.anonimizeRequests],
|
||||||
defaultLanguageCode: [x.defaultLanguageCode],
|
defaultLanguageCode: [x.defaultLanguageCode],
|
||||||
disableHealthChecks: [x.disableHealthChecks],
|
disableHealthChecks: [x.disableHealthChecks],
|
||||||
autoDeleteAvailableRequests: [x.autoDeleteAvailableRequests],
|
autoDeleteAvailableRequests: [x.autoDeleteAvailableRequests],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue