Fixed the issue when updating the issue status

pull/3556/head
tidusjar 5 years ago
parent cb804a2e98
commit 6a104afb33

@ -208,7 +208,7 @@ namespace Ombi.Controllers.V1
[HttpPost("comments")] [HttpPost("comments")]
public async Task<IssueComments> AddComment([FromBody] NewIssueCommentViewModel comment) public async Task<IssueComments> AddComment([FromBody] NewIssueCommentViewModel comment)
{ {
var user = await _userManager.Users.Where(x => User.Identity.Name.Equals(x.UserName, StringComparison.InvariantCultureIgnoreCase)) var user = await _userManager.Users.Where(x => User.Identity.Name == x.UserName)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
var issue = await _issues.GetAll().Include(x => x.UserReported).Include(x => x.IssueCategory).FirstOrDefaultAsync(x => x.Id == comment.IssueId); var issue = await _issues.GetAll().Include(x => x.UserReported).Include(x => x.IssueCategory).FirstOrDefaultAsync(x => x.Id == comment.IssueId);
if (issue == null) if (issue == null)
@ -278,7 +278,8 @@ namespace Ombi.Controllers.V1
[HttpPost("status")] [HttpPost("status")]
public async Task<bool> UpdateStatus([FromBody] IssueStateViewModel model) public async Task<bool> UpdateStatus([FromBody] IssueStateViewModel model)
{ {
var user = await _userManager.Users.Where(x => User.Identity.Name.Equals(x.UserName, StringComparison.InvariantCultureIgnoreCase)) var username = User.Identity.Name.ToUpper();
var user = await _userManager.Users.Where(x => username == x.NormalizedUserName)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
var issue = await _issues.GetAll().Include(x => x.UserReported).Include(x => x.IssueCategory).FirstOrDefaultAsync(x => x.Id == model.IssueId); var issue = await _issues.GetAll().Include(x => x.UserReported).Include(x => x.IssueCategory).FirstOrDefaultAsync(x => x.Id == model.IssueId);
if (issue == null) if (issue == null)

Loading…
Cancel
Save