mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 18:16:55 -07:00
When a users requests content and the voting is enabled, the user who requested is an automatic +1 vote.
This commit is contained in:
parent
870a07de9d
commit
4508f79a5f
7 changed files with 68 additions and 14 deletions
|
@ -149,13 +149,17 @@ namespace Ombi.Core.Engine
|
|||
|
||||
public async Task<VoteEngineResult> UpVote(int requestId, RequestType requestType)
|
||||
{
|
||||
var voteSettings = await _voteSettings.GetSettingsAsync();
|
||||
if (!voteSettings.Enabled)
|
||||
{
|
||||
return new VoteEngineResult {Result = true};
|
||||
}
|
||||
// How many votes does this have?!
|
||||
var currentVotes = GetVotes(requestId, requestType);
|
||||
var voteSettings = await _voteSettings.GetSettingsAsync();
|
||||
|
||||
// Does this user have a downvote? If so we should revert it and make it an upvote
|
||||
var user = await GetUser();
|
||||
|
||||
// Does this user have a downvote? If so we should revert it and make it an upvote
|
||||
var currentVote = await GetVoteForUser(requestId, user.Id);
|
||||
if (currentVote != null && currentVote.VoteType == VoteType.Upvote)
|
||||
{
|
||||
|
@ -206,7 +210,7 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
return new VoteEngineResult
|
||||
{
|
||||
ErrorMessage = "Voted succesfully but could not approve movie!"
|
||||
ErrorMessage = "Voted succesfully but could not approve!"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -218,6 +222,11 @@ namespace Ombi.Core.Engine
|
|||
|
||||
public async Task<VoteEngineResult> DownVote(int requestId, RequestType requestType)
|
||||
{
|
||||
var voteSettings = await _voteSettings.GetSettingsAsync();
|
||||
if (!voteSettings.Enabled)
|
||||
{
|
||||
return new VoteEngineResult { Result = true };
|
||||
}
|
||||
var user = await GetUser();
|
||||
var currentVote = await GetVoteForUser(requestId, user.Id);
|
||||
if (currentVote != null && currentVote.VoteType == VoteType.Downvote)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue