mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
More work on #27 Added a new notify button to the search UI (Needs styling). Also fixed a bug where if the user could only see their own requests, if they search for something that has been requested, it will show as requested.
This commit is contained in:
parent
186b18ccb9
commit
7051c31dd3
4 changed files with 83 additions and 40 deletions
|
@ -40,6 +40,7 @@ namespace PlexRequests.Store
|
|||
public List<string> RequestedUsers { get; set; }
|
||||
public string ArtistName { get; set; }
|
||||
public string ArtistId { get; set; }
|
||||
public List<string> UsersToNotify { get; private set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<string> AllUsers
|
||||
|
@ -61,18 +62,27 @@ namespace PlexRequests.Store
|
|||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public bool CanApprove
|
||||
{
|
||||
get
|
||||
{
|
||||
return !Approved && !Available;
|
||||
}
|
||||
}
|
||||
public bool CanApprove => !Approved && !Available;
|
||||
|
||||
public bool UserHasRequested(string username)
|
||||
{
|
||||
return AllUsers.Any(x => x.Equals(username, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public void AddUserToNotification(string username)
|
||||
{
|
||||
if (UsersToNotify == null)
|
||||
{
|
||||
UsersToNotify = new List<string>();
|
||||
}
|
||||
if (UsersToNotify.FirstOrDefault(x => x == username) != null)
|
||||
{
|
||||
// User already exists in the notification list
|
||||
return;
|
||||
}
|
||||
|
||||
UsersToNotify.Add(username);
|
||||
}
|
||||
}
|
||||
|
||||
public enum RequestType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue