Permalink
Browse files

[F] Fix some logic errors and state when adding Manually Linked files

  • Loading branch information...
da3dsoul committed Aug 3, 2018
1 parent 7712cfc commit 1dd08edc7f579513340d448d50852bec652104ba
Showing with 5 additions and 6 deletions.
  1. +4 −5 Shoko.Server/AniDBHelper.cs
  2. +1 −1 Shoko.Server/Commands/AniDB/CommandRequest_AddFileToMyList.cs
@@ -602,7 +602,7 @@ public void UpdateMyListFileStatus(IHash hash, bool watched, DateTime? watchedDa
return (null, null);
}

public (int?, DateTime?) AddFileToMyList(int animeID, int episodeNumber, DateTime? watchedDate)
public (int?, DateTime?) AddFileToMyList(int animeID, int episodeNumber, DateTime? watchedDate, ref AniDBFile_State? state)
{
if (!Login()) return (null, null);

@@ -620,14 +620,13 @@ public void UpdateMyListFileStatus(IHash hash, bool watched, DateTime? watchedDa
}

// if the user already has this file on
if (ev == enHelperActivityType.FileAlreadyExists && cmdAddFile.FileData != null && ServerSettings.AniDB_MyList_ReadWatched)
if (ev == enHelperActivityType.FileAlreadyExists && cmdAddFile.FileData != null)
{
state = cmdAddFile.State;
return (cmdAddFile.MyListID, cmdAddFile.WatchedDate);
}
if (ServerSettings.AniDB_MyList_ReadUnwatched) return (cmdAddFile.MyListID, null);

if (cmdAddFile.MyListID > 0)
return (cmdAddFile.MyListID, null);
if (cmdAddFile.MyListID > 0) return (cmdAddFile.MyListID, null);

return (null, null);
}
@@ -85,7 +85,7 @@ public override void ProcessCommand()

if (isManualLink)
(lid, newWatchedDate) = ShokoService.AnidbProcessor.AddFileToMyList(xrefs[0].AnimeID,
xrefs[0].GetEpisode().EpisodeNumber, originalWatchedDate);
xrefs[0].GetEpisode().EpisodeNumber, originalWatchedDate, ref state);
else
(lid, newWatchedDate) =
ShokoService.AnidbProcessor.AddFileToMyList(vid, originalWatchedDate, ref state);

0 comments on commit 1dd08ed

Please sign in to comment.