public void Unaward(DB4Thing comment) { // This can happen on "force add" command if (comment.ParentThing.AuthorName == Constants.DeletedAuthorName) { _logger.Info("---SKIPPING UNAWARD ON DELETED USER---"); return; } _logger.Info($"---START UNAWARD DELTA--- -> user: {comment.ParentThing.AuthorName}, comment: {comment.Permalink}"); // Update wiki // The wiki is the standard from which delta counts come from _logger.Info(" ---Updating wiki (unaward)"); int newDeltaCount = _wikiEditor.UpdateUserWikiEntryUnaward(comment); string newFlairText = string.Empty; // If we are removing the user's only delta, we don't want the text to read "0∆" if (newDeltaCount != 0) { newFlairText = DeltaHelper.GetFlairText(newDeltaCount); } // Unaward from the parent comment _logger.Info(" ---Setting flair (unaward)"); _subredditService.SetUserFlair(comment.ParentThing.AuthorName, comment.ParentThing.AuthorFlairCssClass, newFlairText); // Update deltaboards _logger.Info(" ---Updating deltaboards (unaward)"); _deltaboardEditor.RemoveDelta(comment.ParentThing.AuthorName); // Remove from repository after successful unaward _logger.Info(" ---Removing delta from local db (unaward)"); _repository.RemoveDeltaComment(comment.Id); // Update DeltaLogs after repository update since it reads data from the repository _logger.Info(" ---Updating DeltaLog (unaward)"); string deltaLogPostUrl = _deltaLogEditor.Upsert(comment.ParentPost.Id, comment.ParentPost.Permalink, comment.ParentPost.Title, comment.ParentPost.AuthorName); // Update sticky if this is from OP if (comment.AuthorName == comment.ParentPost.AuthorName) { // We need to get the count of deltas for this particular post var opDeltaCommentsInPost = _repository.GetDeltaCommentsForPost(comment.ParentPost.Id, comment.ParentPost.AuthorName); // Update or remove sticky comment - make sure to remove one from the count since we haven't removed the data from // the repository yet, so the current comment won't count _logger.Info(" ---Updating post sticky (unaward)"); _stickyCommentEditor.UpsertOrRemove(comment.ParentPost, opDeltaCommentsInPost.Count, null, deltaLogPostUrl); } _logger.Info("---END UNAWARD DELTA---"); }