public async Task SubmitContentReportForReview()

in code/Server/Common/Managers/ReportsManager.cs [213:319]


        public async Task SubmitContentReportForReview(ProcessType processType, string appHandle, string reportHandle, Uri callbackUri)
        {
            // get the report
            IContentReportEntity contentReport = await this.ReadContentReport(appHandle, reportHandle);
            if (contentReport == null)
            {
                // this should never happen; throw an exception
                this.log.LogException("Got null content report for appHandle " + appHandle + " and reportHandle " + reportHandle);
            }

            // get the content
            string text1 = string.Empty;
            string text2 = string.Empty;
            Uri imageUri = null;
            switch (contentReport.ContentType)
            {
                // pull information out of a topic
                case ContentType.Topic:
                    ITopicEntity topicEntity = await this.topicsManager.ReadTopic(contentReport.ContentHandle);
                    if (topicEntity == null)
                    {
                        this.log.LogInformation("Topic has already been deleted for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }
                    else if (topicEntity.ReviewStatus == ReviewStatus.Banned)
                    {
                        this.log.LogInformation("Topic has already been banned for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }

                    text1 = topicEntity.Title;
                    text2 = topicEntity.Text;
                    if (topicEntity.BlobType == BlobType.Image && !string.IsNullOrWhiteSpace(topicEntity.BlobHandle))
                    {
                        imageUri = await this.blobsManager.ReadImageCdnUrl(topicEntity.BlobHandle);
                    }

                    break;

                // pull information out of a comment
                case ContentType.Comment:
                    ICommentEntity commentEntity = await this.commentsManager.ReadComment(contentReport.ContentHandle);
                    if (commentEntity == null)
                    {
                        this.log.LogInformation("Comment has already been deleted for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }
                    else if (commentEntity.ReviewStatus == ReviewStatus.Banned)
                    {
                        this.log.LogInformation("Comment has already been banned for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }

                    text1 = commentEntity.Text;
                    if (commentEntity.BlobType == BlobType.Image && !string.IsNullOrWhiteSpace(commentEntity.BlobHandle))
                    {
                        imageUri = await this.blobsManager.ReadImageCdnUrl(commentEntity.BlobHandle);
                    }

                    break;

                // pull information out of a reply
                case ContentType.Reply:
                    IReplyEntity replyEntity = await this.repliesManager.ReadReply(contentReport.ContentHandle);
                    if (replyEntity == null)
                    {
                        this.log.LogInformation("Reply has already been deleted for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }
                    else if (replyEntity.ReviewStatus == ReviewStatus.Banned)
                    {
                        this.log.LogInformation("Reply has already been banned for appHandle " + appHandle + " and reportHandle " + reportHandle);
                        return;
                    }

                    text1 = replyEntity.Text;
                    break;

                default:
                    // this should never happen; throw an exception
                    this.log.LogException("Got an unexpected content type: " + contentReport.ContentType + " for appHandle " + appHandle + " and reportHandle " + reportHandle);
                    break;
            }

            // skip if there's nothing to be submitted for review
            if (string.IsNullOrWhiteSpace(text1) && string.IsNullOrWhiteSpace(text2) && imageUri == null)
            {
                // nothing we can do here since there is no content
                this.log.LogInformation("The content is empty for appHandle " + appHandle + " and reportHandle " + reportHandle);
                return;
            }

            // If init not called, call init.
            if (this.initStarted == false)
            {
                await this.Init();
            }

            // If init not done, wait
            this.initDone.WaitOne();

            // submit the request to AVERT
            string reviewResponse = await this.reportAbuseClient.SubmitReviewRequest(contentReport.Reason, contentReport.CreatedTime, callbackUri, text1, text2, null, imageUri);

            // store it in AVERTStore
            await this.avertStore.InsertSubmission(StorageConsistencyMode.Strong, reportHandle, appHandle, ReportType.Content, DateTime.UtcNow, reviewResponse);
        }