#264 allow narrators to upvotes their own recitations but make these votes during reordering computations

This commit is contained in:
Hamid Reza Mohammadi 2021-12-20 19:20:49 +03:30
parent d519d6f64e
commit 5da2219664

View File

@ -1890,7 +1890,7 @@ namespace RMuseum.Services.Implementationa
//audio order is used as a temporary variable in the following line and soon is get replaced by computed value
recitation.AudioOrder =
recitations.Count - 1 - i +
await _context.RecitationUserUpVotes.AsNoTracking().Where(r => r.RecitationId == recitation.Id)
await _context.RecitationUserUpVotes.AsNoTracking().Where(r => r.RecitationId == recitation.Id && r.UserId != recitation.OwnerId)
.CountAsync(); //this way oldest recitations have an advantage which could be beaten by user ranks over time
}
@ -1932,10 +1932,6 @@ namespace RMuseum.Services.Implementationa
{
return new RServiceResult<bool>(false, "خوانشی با این شناسه وجود ندارد.");
}
if(recitation.OwnerId == userId)
{
return new RServiceResult<bool>(false, "شما نمی‌توانید به خوانش خودتان رأی بدهید.");
}
if(recitation.ReviewStatus != AudioReviewStatus.Approved)
{
return new RServiceResult<bool>(false, "امکان رأی دادن به خوانش منتشر نشده وجود ندارد.");