private async Task TagContentAsMature()

in code/Server/Common/Managers/ReportsManager.cs [914:1030]


        private async Task TagContentAsMature(IAVERTTransactionEntity transactionEntity)
        {
            // get the relevant report
            IContentReportEntity contentReport = await this.ReadContentReport(transactionEntity.AppHandle, transactionEntity.ReportHandle);
            if (contentReport == null)
            {
                this.log.LogException("did not find relevant content report for report handle: " + transactionEntity.ReportHandle);
            }

            if (string.IsNullOrWhiteSpace(contentReport.ContentHandle))
            {
                this.log.LogException("got empty content handle for report handle: " + transactionEntity.ReportHandle);
            }

            // get the relevant topic & tag it
            if (contentReport.ContentType == ContentType.Topic)
            {
                ITopicEntity topicEntity = await this.topicsManager.ReadTopic(contentReport.ContentHandle);
                if (topicEntity == null)
                {
                    this.log.LogInformation("Topic is already deleted for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (topicEntity.ReviewStatus == ReviewStatus.Banned)
                {
                    this.log.LogInformation("Topic is already banned for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (topicEntity.ReviewStatus == ReviewStatus.Mature)
                {
                    this.log.LogInformation("Topic is already tagged as mature for report handle: " + transactionEntity.ReportHandle);
                    return;
                }

                // update the status to mature
                this.log.LogInformation("Tagging content as mature for topic handle: " + contentReport.ContentHandle);
                await this.topicsManager.UpdateTopic(
                    ProcessType.Frontend,
                    contentReport.ContentHandle,
                    topicEntity.Title,
                    topicEntity.Text,
                    topicEntity.BlobType,
                    topicEntity.BlobHandle,
                    topicEntity.Categories,
                    ReviewStatus.Mature,
                    DateTime.UtcNow,
                    topicEntity);
                return;
            }

            // get the relevant comment & ban it
            if (contentReport.ContentType == ContentType.Comment)
            {
                ICommentEntity commentEntity = await this.commentsManager.ReadComment(contentReport.ContentHandle);
                if (commentEntity == null)
                {
                    this.log.LogInformation("Comment is already deleted for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (commentEntity.ReviewStatus == ReviewStatus.Banned)
                {
                    this.log.LogInformation("Comment is already banned for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (commentEntity.ReviewStatus == ReviewStatus.Mature)
                {
                    this.log.LogInformation("Comment is already tagged as mature for report handle: " + transactionEntity.ReportHandle);
                    return;
                }

                // update the status to mature
                this.log.LogInformation("Tagging content as mature for comment handle: " + contentReport.ContentHandle);
                await this.commentsManager.UpdateComment(
                    ProcessType.Frontend,
                    contentReport.ContentHandle,
                    commentEntity.Text,
                    commentEntity.BlobType,
                    commentEntity.BlobHandle,
                    ReviewStatus.Mature,
                    DateTime.UtcNow,
                    commentEntity);
                return;
            }

            // get the relevant reply & ban it
            if (contentReport.ContentType == ContentType.Reply)
            {
                IReplyEntity replyEntity = await this.repliesManager.ReadReply(contentReport.ContentHandle);
                if (replyEntity == null)
                {
                    this.log.LogInformation("Reply is already deleted for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (replyEntity.ReviewStatus == ReviewStatus.Banned)
                {
                    this.log.LogInformation("Reply is already banned for report handle: " + transactionEntity.ReportHandle);
                    return;
                }
                else if (replyEntity.ReviewStatus == ReviewStatus.Mature)
                {
                    this.log.LogInformation("Reply is already tagged as mature for report handle: " + transactionEntity.ReportHandle);
                    return;
                }

                // update the status to mature
                this.log.LogInformation("Tagging content as mature for reply handle: " + contentReport.ContentHandle);
                await this.repliesManager.UpdateReply(
                    ProcessType.Frontend,
                    contentReport.ContentHandle,
                    replyEntity.Text,
                    replyEntity.Language,
                    ReviewStatus.Mature,
                    DateTime.UtcNow,
                    replyEntity);
                return;
            }
        }