Skip to content

Commit

Permalink
Fixed #882
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie.Rees authored and Jamie.Rees committed Jan 10, 2017
1 parent 7f913de commit a9ebe04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions Ombi.Store/Repository/UserRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,24 @@ public UserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(
public UsersModel GetUser(string userGuid)
{
var sql = @"SELECT * FROM Users
WHERE Userguid = @UserGuid";
WHERE Userguid = @UserGuid
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserGuid = userGuid});
}

public UsersModel GetUserByUsername(string username)
{
var sql = @"SELECT * FROM Users
WHERE UserName = @UserName";
WHERE UserName = @UserName
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserName = username});
}

public async Task<UsersModel> GetUserAsync(string userguid)
{
var sql = @"SELECT * FROM Users
WHERE UserGuid = @UserGuid";
WHERE UserGuid = @UserGuid
COLLATE NOCASE";
return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid});
}

Expand Down
10 changes: 5 additions & 5 deletions Ombi.UI/Modules/SearchModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ private async Task<Response> RequestMovie(int movieId)
};
try
{
if (ShouldAutoApprove(RequestType.Movie, settings, Username))
if (ShouldAutoApprove(RequestType.Movie))
{
model.Approved = true;

Expand Down Expand Up @@ -885,7 +885,7 @@ await NotificationService.Publish(new NotificationModel

try
{
if (ShouldAutoApprove(RequestType.TvShow, settings, Username))
if (ShouldAutoApprove(RequestType.TvShow))
{
model.Approved = true;
var s = await sonarrSettings;
Expand Down Expand Up @@ -981,7 +981,7 @@ private async Task<Response> AddUserToRequest(RequestedModel existingRequest, Pl

private bool ShouldSendNotification(RequestType type, PlexRequestSettings prSettings)
{
var sendNotification = ShouldAutoApprove(type, prSettings, Username)
var sendNotification = ShouldAutoApprove(type)
? !prSettings.IgnoreNotifyForAutoApprovedRequests
: true;

Expand Down Expand Up @@ -1089,7 +1089,7 @@ private async Task<Response> RequestAlbum(string releaseId)

try
{
if (ShouldAutoApprove(RequestType.Album, settings, Username))
if (ShouldAutoApprove(RequestType.Album))
{
model.Approved = true;
var hpSettings = HeadphonesService.GetSettings();
Expand Down Expand Up @@ -1363,7 +1363,7 @@ private async Task<IEnumerable<EpisodesModel>> GetEpisodeRequestDifference(int s
return diff;
}

public bool ShouldAutoApprove(RequestType requestType, PlexRequestSettings prSettings, string username)
public bool ShouldAutoApprove(RequestType requestType)
{
var admin = Security.HasPermissions(Context.CurrentUser, Permissions.Administrator);
// if the user is an admin, they go ahead and allow auto-approval
Expand Down

0 comments on commit a9ebe04

Please sign in to comment.