Example #1
0
        /// <summary>
        /// Insert a new user-generated report of another user into the store
        /// </summary>
        /// <param name="storageConsistencyMode">consistency to use</param>
        /// <param name="reportHandle">uniquely identifies this report</param>
        /// <param name="reportedUserHandle">uniquely identifies the user who is being reported</param>
        /// <param name="reportingUserHandle">uniquely identifies the user doing the reporting</param>
        /// <param name="appHandle">uniquely identifies the app that the user is in</param>
        /// <param name="reason">the complaint against the content</param>
        /// <param name="lastUpdatedTime">when the report was received</param>
        /// <param name="hasComplainedBefore">has the reporting user complained about this user before?</param>
        /// <returns>a task that inserts the report into the store</returns>
        public async Task InsertUserReport(
            StorageConsistencyMode storageConsistencyMode,
            string reportHandle,
            string reportedUserHandle,
            string reportingUserHandle,
            string appHandle,
            ReportReason reason,
            DateTime lastUpdatedTime,
            bool hasComplainedBefore)
        {
            // get all the table interfaces
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.UserReports);

            ObjectTable lookupTable               = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsLookup) as ObjectTable;
            ObjectTable lookupUniquenessTable     = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsLookupUniquenessByReportingUser) as ObjectTable;
            FeedTable   feedByAppTable            = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsRecentFeedByApp) as FeedTable;
            FeedTable   feedByReportedUserTable   = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsRecentFeedByReportedUser) as FeedTable;
            FeedTable   feedByReportingUserTable  = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsRecentFeedByReportingUser) as FeedTable;
            CountTable  countByReportedUserTable  = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsCountByReportedUser) as CountTable;
            CountTable  countByReportingUserTable = this.tableStoreManager.GetTable(ContainerIdentifier.UserReports, TableIdentifier.UserReportsCountByReportingUser) as CountTable;

            // create the two entities that will be inserted into the tables
            UserReportEntity userReportEntity = new UserReportEntity()
            {
                ReportedUserHandle  = reportedUserHandle,
                ReportingUserHandle = reportingUserHandle,
                AppHandle           = appHandle,
                Reason      = reason,
                CreatedTime = lastUpdatedTime
            };

            UserReportFeedEntity userReportFeedEntity = new UserReportFeedEntity()
            {
                ReportHandle        = reportHandle,
                ReportedUserHandle  = reportedUserHandle,
                ReportingUserHandle = reportingUserHandle,
                AppHandle           = appHandle
            };

            // do the inserts and increments as a transaction
            Transaction transaction = new Transaction();

            // the partition key is app handle for all tables so that a transaction can be achieved
            transaction.Add(Operation.Insert(lookupTable, appHandle, reportHandle, userReportEntity));
            transaction.Add(Operation.Insert(feedByAppTable, appHandle, appHandle, reportHandle, userReportFeedEntity));
            transaction.Add(Operation.Insert(feedByReportedUserTable, appHandle, reportedUserHandle, reportHandle, userReportFeedEntity));
            transaction.Add(Operation.Insert(feedByReportingUserTable, appHandle, reportingUserHandle, reportHandle, userReportFeedEntity));

            // if the reporting user has not previously reported this user, then increment counts
            if (!hasComplainedBefore)
            {
                string uniquenessKey = UniquenessObjectKey(reportedUserHandle, reportingUserHandle);
                transaction.Add(Operation.Insert(lookupUniquenessTable, appHandle, uniquenessKey, new ObjectEntity()));
                transaction.Add(Operation.InsertOrIncrement(countByReportedUserTable, appHandle, reportedUserHandle));
                transaction.Add(Operation.InsertOrIncrement(countByReportingUserTable, appHandle, reportingUserHandle));
            }

            // execute the transaction
            await store.ExecuteTransactionAsync(transaction, storageConsistencyMode.ToConsistencyMode());
        }
Example #2
0
        public string GetSmpData(ReportReason reportReason)
        {
            // Check if we have some location data
            if (_location != null)
            {
                // We do so build the SMP string and return it
                var smp = new SMP
                {
                    Reason    = reportReason,
                    Latitude  = Convert.ToDecimal(_location.Coordinates.Latitude),
                    Longitude = Convert.ToDecimal(_location.Coordinates.Longitude),
                    Speed     = Convert.ToInt16(_location.Coordinates.Speed) > (short)2
                                ? Convert.ToInt16(_location.Coordinates.Speed)
                                : (short)0,
                    Quality         = Convert.ToInt32(_location.Coordinates.Accuracy),
                    LastFixDateTime = _location.Timestamp.DateTime,
                    Heading         = Convert.ToInt16(_location.Coordinates.Heading),
                    ReportDateTime  = DateTime.UtcNow
                };

                return(smp.ToString());
            }
            else
            {
                // We don't so build what we can and return it
                var smp = new SMP
                {
                    Reason         = reportReason,
                    ReportDateTime = DateTime.UtcNow
                };

                return(smp.ToString());
            }
        }
Example #3
0
        private async void OnReportPhoto(ReportReason reason)
        {
            try
            {
                IsBusy = true;

                await _authEnforcementHandler.CheckUserAuthentication();

                var result = await _dialogService.ShowYesNoNotification("ReportContent_Message", "ReportContent_Title");

                if (result)
                {
                    await _petCareService.ReportPhoto(_photo, reason);
                }
            }
            catch (SignInRequiredException)
            {
                // Swallow exception.  User canceled the Sign-in dialog.
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #4
0
        public async Task <bool> ReportGalleryItemAsync(string id, ReportReason reason = ReportReason.Unspecified)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            HttpRequestMessage msg = new HttpRequestMessage(HttpMethod.Post, $"/3/gallery/{id}/report");

            msg.Content = new StringContent($"{{ \"reason\": {(int)reason} }}");
            msg.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
            var response = await client.SendAsync(msg);

            (bool success, int status, string dataJson) = GetDataToken(await response.Content.ReadAsStringAsync());
            if (success)
            {
                return(JsonConvert.DeserializeObject <bool>(dataJson.ToLower()));
            }
            else
            {
                throw new ApiRequestException(dataJson)
                      {
                          Status = status
                      };
            }
        }
Example #5
0
 private void SetReportReasons()
 {
     foreach (ReportReason reason in ReportReason.Get())
     {
         Reason.Items.Add(new ListItem(reason.Reason, reason.Id.ToString()));
     }
 }
Example #6
0
 /// <inheritdoc />
 public async Task <bool> ReportAsync(long videoId
                                      , ReportReason reason
                                      , long?ownerId
                                      , string comment     = null
                                      , string searchQuery = null)
 {
     return(await TypeHelper.TryInvokeMethodAsync(func : () =>
                                                  _vk.Video.Report(videoId: videoId, reason: reason, ownerId: ownerId, comment: comment, searchQuery: searchQuery)));
 }
Example #7
0
        public void ReportComment(long ownerId, long commentId, ReportReason reportReason, Action <BackendResult <ResponseWithId, ResultCode> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["owner_id"]   = ownerId.ToString();
            parameters["comment_id"] = commentId.ToString();
            parameters["reason"]     = ((int)reportReason).ToString();
            VKRequestsDispatcher.DispatchRequestToVK <ResponseWithId>("photos.reportComment", parameters, callback, (Func <string, ResponseWithId>)(jsonStr => new ResponseWithId()), false, true, new CancellationToken?(), null);
        }
Example #8
0
        public bool Report(long ownerId, long itemId, ReportReason reason)
        {
            var parameters = new VkParameters {
                { "owner_id", ownerId },
                { "item_id", itemId },
                { "reason", reason }
            };

            return(_vk.Call("market.report", parameters));
        }
 protected ReportContract CreateTestReport(string contentId, ContentType contentType, ReportReason reportReason, string reporterId)
 {
     return new ReportContract
     {
         ContentId = contentId,
         ContentType = contentType,
         ReportReason = reportReason,
         ReporterUserId = reporterId
     };
 }
Example #10
0
        public bool ReportComment(long ownerId, long commentId, ReportReason reason)
        {
            var parameters = new VkParameters {
                { "owner_id", ownerId },
                { "comment_id", commentId },
                { "reason", reason }
            };

            return(_vk.Call("market.reportComment", parameters));
        }
        public async Task <ReportReasonViewModel> Add(ReportReason entity)
        {
            var currentUser = Feature.CurrentUser(httpContextAccessor, userRepository);
            var data        = new ReportReason()
            {
                Detail    = entity.Detail,
                CreatedBy = currentUser.OId
            };
            await reportReasonRepository.AddAsync(data);

            return(mapper.Map <ReportReasonViewModel>(data));
        }
Example #12
0
        public async Task AddReport(string authorId, string postId, ReportReason reason)
        {
            var report = new PostReport()
            {
                AuthorId     = authorId,
                PostId       = postId,
                ReportReason = reason,
            };

            await this.dbContext.PostReports.AddAsync(report);

            await this.dbContext.SaveChangesAsync();
        }
Example #13
0
        /// <summary>
        /// Позволяет пожаловаться на комментарий к видеозаписи.
        /// </summary>
        /// <param name="ownerId">
        /// Идентификатор владельца видеозаписи, к которой оставлен комментарий. целое
        /// число, обязательный
        /// параметр (Целое число, обязательный параметр).
        /// </param>
        /// <param name="commentId">
        /// Идентификатор комментария. положительное число, обязательный параметр
        /// (Положительное число,
        /// обязательный параметр).
        /// </param>
        /// <param name="reason">
        /// Тип жалобы:
        /// 0 – это спам
        /// 1 – детская порнография
        /// 2 – экстремизм
        /// 3 – насилие
        /// 4 – пропаганда наркотиков
        /// 5 – материал для взрослых
        /// 6 – оскорбление положительное число (Положительное число).
        /// </param>
        /// <returns>
        /// После успешного выполнения возвращает <c> true </c>.
        /// </returns>
        /// <remarks>
        /// Страница документации ВКонтакте http://vk.com/dev/video.reportComment
        /// </remarks>
        public bool ReportComment(long commentId, long ownerId, ReportReason reason)
        {
            VkErrors.ThrowIfNumberIsNegative(expr: () => commentId);

            var parameters = new VkParameters
            {
                { "comment_id", commentId }
                , { "owner_id", ownerId }
                , { "reason", reason }
            };

            return(_vk.Call(methodName: "video.reportComment", parameters: parameters));
        }
        internal HttpRequestMessage ReportCommentRequest(string url, ReportReason reason)
        {
            var parameters = new Dictionary <string, string>
            {
                { "reason", ((int)reason).ToString() }
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return(request);
        }
        public void AddReport(string authorId, string postId, ReportReason reason)
        {
            var report = new PostReport()
            {
                AuthorId     = authorId,
                PostId       = postId,
                ReportReason = reason,
            };

            var post = this.postRepository.All().FirstOrDefault(x => x.Id == postId);

            post?.PostReports.Add(report);
            this.postRepository.SaveChangesAsync().GetAwaiter().GetResult();
        }
        internal HttpRequestMessage ReportCommentRequest(string url, ReportReason reason)
        {
            var parameters = new Dictionary<string, string>
            {
                {"reason", ((int) reason).ToString()}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #17
0
        /// <summary>
        /// Позволяет пожаловаться на видеозапись.
        /// </summary>
        /// <param name="ownerId">
        /// Идентификатор пользователя или сообщества, которому принадлежит видеозапись.
        /// целое число,
        /// обязательный параметр (Целое число, обязательный параметр).
        /// </param>
        /// <param name="videoId">
        /// Идентификатор видеозаписи. положительное число, обязательный параметр
        /// (Положительное число,
        /// обязательный параметр).
        /// </param>
        /// <param name="reason">
        /// Тип жалобы:
        /// 0 – это спам
        /// 1 – детская порнография
        /// 2 – экстремизм
        /// 3 – насилие
        /// 4 – пропаганда наркотиков
        /// 5 – материал для взрослых
        /// 6 – оскорбление положительное число (Положительное число).
        /// </param>
        /// <param name="comment"> Комментарий для жалобы. строка (Строка). </param>
        /// <param name="searchQuery">
        /// Поисковой запрос, если видеозапись была найдена
        /// через поиск. строка (Строка).
        /// </param>
        /// <returns>
        /// После успешного выполнения возвращает <c> true </c>.
        /// </returns>
        /// <remarks>
        /// Страница документации ВКонтакте http://vk.com/dev/video.report
        /// </remarks>
        public bool Report(long videoId, ReportReason reason, long?ownerId, string comment = null, string searchQuery = null)
        {
            VkErrors.ThrowIfNumberIsNegative(expr: () => videoId);

            var parameters = new VkParameters
            {
                { "video_id", videoId }
                , { "owner_id", ownerId }
                , { "reason", reason }
                , { "comment", comment }
                , { "search_query", searchQuery }
            };

            return(_vk.Call(methodName: "video.report", parameters: parameters));
        }
Example #18
0
        /// <summary>
        ///     Report a comment for being inappropriate.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        /// <param name="reason">The reason why the comment is inappropriate.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task <bool> ReportCommentAsync(int commentId, ReportReason reason)
        {
            if (ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
            }

            var url = $"comment/{commentId}/report";

            using (var request = RequestBuilderBase.ReportItemRequest(url, reason))
            {
                var reported = await SendRequestAsync <bool?>(request).ConfigureAwait(false);

                return(reported ?? true);
            }
        }
Example #19
0
        /// <summary>
        ///     Report an item in the gallery. OAuth authentication required.
        /// </summary>
        /// <param name="galleryItemId">The gallery item id.</param>
        /// <param name="reason">A reason why content is inappropriate.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="T:Imgur.API.ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="T:Imgur.API.MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task <bool> ReportGalleryItemAsync(string galleryItemId, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(galleryItemId))
            {
                throw new ArgumentNullException(nameof(galleryItemId));
            }
            if (this.ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException("OAuth2Token", "OAuth authentication required.");
            }
            string url = string.Format("gallery/{0}/report", (object)galleryItemId);
            bool   flag;

            using (HttpRequestMessage request = this.RequestBuilder.ReportItemRequest(url, reason))
                flag = await this.SendRequestAsync <bool>(request).ConfigureAwait(false);
            return(flag);
        }
        /// <summary>
        ///     Report a comment for being inappropriate.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        /// <param name="reason">The reason why the comment is inappropriate.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public Basic <bool> ReportComment(int commentId, ReportReason reason)
        {
            if (ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
            }

            var url = $"comment/{commentId}/report";

            using (var request = new HttpRequestMessage(HttpMethod.Get, url))
            {
                var httpResponse = HttpClient.SendAsync(request).Result;
                var jsonString   = httpResponse.Content.ReadAsStringAsync().Result;
                var output       = Newtonsoft.Json.JsonConvert.DeserializeObject <Basic <bool> >(httpResponse.Content.ReadAsStringAsync().Result.ToString());
                return(output);
            }
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage ReportItemRequest(string url, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>
            {
                {"reason", ((int) reason).ToString()}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #22
0
        public void BanReviewByReviewId(Guid reviewId, ReportReason reportReason)
        {
            try
            {
                var review = FilmHausDbContext.Reviews.Find(reviewId);

                if (review == null)
                {
                    throw new ArgumentNullException();
                }

                switch (review.ReviewType)
                {
                case ReviewType.Film:
                    var reviewFilm = FilmHausDbContext.ReviewFilms.Where(rf => rf.ReviewId == reviewId && rf.ObsoletedOn == null).FirstOrDefault();
                    ReviewFilmService.ObsoleteReviewFilm(reviewFilm.ReviewId, reviewFilm.MediaId);
                    break;

                case ReviewType.Show:
                    var reviewShow = FilmHausDbContext.ReviewShows.Where(rf => rf.ReviewId == reviewId && rf.ObsoletedOn == null).FirstOrDefault();
                    ReviewShowService.ObsoleteReviewShow(reviewShow.ReviewId, reviewShow.MediaId);
                    break;

                case ReviewType.Season:
                    break;

                case ReviewType.Episode:
                    break;

                default:
                    break;
                }

                review.ReportReason = reportReason;
                review.Shared       = false;
                review.IsActive     = false;

                FilmHausDbContext.Entry(review).State = EntityState.Modified;
                FilmHausDbContext.SaveChanges();
            }
            catch
            {
                throw;
            }
        }
Example #23
0
        /// <summary>
        ///     Report an item in the gallery. OAuth authentication required.
        /// </summary>
        /// <param name="galleryItemId">The gallery item id.</param>
        /// <param name="reason">A reason why content is inappropriate.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public Basic<bool> ReportGalleryItem(string galleryItemId, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(galleryItemId))
                throw new ArgumentNullException(nameof(galleryItemId));

            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = $"gallery/{galleryItemId}/report";

            using (var request = RequestBuilderBase.ReportItemRequest(url, reason))
            {
                var httpResponse = HttpClient.SendAsync(request).Result;
                var jsonString = httpResponse.Content.ReadAsStringAsync().Result;
                var output = Newtonsoft.Json.JsonConvert.DeserializeObject<Basic<bool>>(httpResponse.Content.ReadAsStringAsync().Result.ToString());
                return output;
            }
        }
Example #24
0
 public void ReportComment(long ownerId, long commentId, ReportReason reportReason, Action <BackendResult <VKClient.Audio.Base.ResponseWithId, ResultCode> > callback)
 {
     VKRequestsDispatcher.DispatchRequestToVK <VKClient.Audio.Base.ResponseWithId>("market.reportComment", new Dictionary <string, string>()
     {
         {
             "owner_id",
             ownerId.ToString()
         },
         {
             "comment_id",
             commentId.ToString()
         },
         {
             "reason",
             ((int)reportReason).ToString()
         }
     }, callback, (Func <string, VKClient.Audio.Base.ResponseWithId>)(jsonStr => new VKClient.Audio.Base.ResponseWithId()), false, true, new CancellationToken?(), null);
 }
Example #25
0
        /// <exception cref="T:System.ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage ReportItemRequest(string url, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentNullException(nameof(url));
            }
            Dictionary <string, string> source = new Dictionary <string, string>()
            {
                {
                    nameof(reason),
                    ((int)reason).ToString()
                }
            };

            return(new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = (HttpContent) new FormUrlEncodedContent((IEnumerable <KeyValuePair <string, string> >)source.ToArray <KeyValuePair <string, string> >())
            });
        }
Example #26
0
        public static void InsertReport(int reasonid, ReportReason reason, string ip, int postID, DbConnection con)
        {
            using (DbCommand dc = DatabaseEngine.GenerateDbCommand(con))
            {
                dc.CommandText = "INSERT INTO reports (postID, reporterIP, time, comment, reasonID) " +
                                 " VALUES (@id, @ip, @time, @comment, @reasonID)";

                dc.Parameters.Add(DatabaseEngine.MakeParameter("@id", postID, DbType.Int32));
                dc.Parameters.Add(DatabaseEngine.MakeParameter("@ip", ip, DbType.String));

                dc.Parameters.Add(DatabaseEngine.MakeParameter("@time", DateTime.UtcNow, DbType.DateTime));

                dc.Parameters.Add(DatabaseEngine.MakeParameter("@comment", reason.Description, DbType.String));

                dc.Parameters.Add(DatabaseEngine.MakeParameter("@reasonID", reasonid, DbType.Int32));

                dc.ExecuteNonQuery();
            }
        }
Example #27
0
        internal static HttpRequestMessage ReportItemRequest(string url, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentNullException(nameof(url));
            }

            var parameters = new Dictionary <string, string>
            {
                { nameof(reason), ((int)reason).ToString() }
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return(request);
        }
Example #28
0
        /// <summary>
        ///     Report a comment for being inappropriate.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        /// <param name="reason">The reason why the comment is inappropriate.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="T:Imgur.API.ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="T:Imgur.API.MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task <bool> ReportCommentAsync(int commentId, ReportReason reason)
        {
            if (this.ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException("OAuth2Token", "OAuth authentication required.");
            }
            string url = string.Format("comment/{0}/report", (object)commentId);
            bool   flag;

            using (HttpRequestMessage request = this.RequestBuilder.ReportItemRequest(url, reason))
            {
                bool?nullable = await this.SendRequestAsync <bool?>(request).ConfigureAwait(false);

                bool?reported = nullable;
                nullable = new bool?();
                bool?nullable1 = reported;
                flag = !nullable1.HasValue || nullable1.GetValueOrDefault();
            }
            return(flag);
        }
        /// <summary>
        /// Reports the photo as inappropriate.
        /// </summary>
        /// <param name="photo">The photo to report.</param>
        /// <param name="reportReason">The reason for the report.</param>
        public async Task ReportPhoto(Photo photo, ReportReason reportReason)
        {
            try
            {
                var reportContract = new ReportContract
                {
                    ReportReason = reportReason,
                    ContentId    = photo.Id,
                    ContentType  = ContentType.Photo
                };

                await _mobileServiceClient.InvokeApiAsync <ReportContract, ReportContract>("report",
                                                                                           reportContract,
                                                                                           HttpMethod.Post,
                                                                                           null);
            }
            catch (Exception e)
            {
                throw new ServiceException("ReportPhoto error", e);
            }
        }
        /// <summary>
        ///     Report a comment for being inappropriate.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="id">The comment id.</param>
        /// <param name="reason">The reason why the comment is inappropriate.</param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ImgurException"></exception>
        /// <exception cref="MashapeException"></exception>
        /// <exception cref="OverflowException"></exception>
        /// <returns></returns>
        public async Task <bool> ReportCommentAsync(string id, ReportReason reason)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
            }

            var url = $"comment/{id}/report";

            using (var request = RequestBuilder.ReportCommentRequest(url, reason))
            {
                var reported = await SendRequestAsync <bool?>(request);

                return(reported ?? true);
            }
        }
Example #31
0
        /// <summary>
        ///     Report an item in the gallery. OAuth authentication required.
        /// </summary>
        /// <param name="galleryItemId">The gallery item id.</param>
        /// <param name="reason">A reason why content is inappropriate.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task <bool> ReportGalleryItemAsync(string galleryItemId, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(galleryItemId))
            {
                throw new ArgumentNullException(nameof(galleryItemId));
            }

            if (ApiClient.OAuth2Token == null)
            {
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
            }

            var url = $"gallery/{galleryItemId}/report";

            using (var request = RequestBuilderBase.ReportItemRequest(url, reason))
            {
                var reported = await SendRequestAsync <bool>(request).ConfigureAwait(false);

                return(reported);
            }
        }
Example #32
0
 ///<summary>
 ///          Позволяет пожаловаться на видеозапись
 ///      
 ///</summary>
 ///<param name="videoId">идентификатор видеозаписи</param>
 ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит видеозапись</param>
 ///<param name="reason">тип жалобы</param>
 ///<param name="comment">комментарий для жалобы</param>
 ///<param name="searchQuery">поисковой запрос, если видеозапись была найдена через поиск</param>
 public async Task  Report(
     long videoId , int? ownerId = null, ReportReason? reason = null, string comment = "",  string searchQuery = ""
 ) {
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Video.Report(
                 videoId,ownerId,reason,comment,searchQuery
             )
         ).ConfigureAwait(false)
     ;
 }
Example #33
0
        /// <summary>
        /// Reports the photo as inappropriate.
        /// </summary>
        /// <param name="photo">The photo to report.</param>
        /// <param name="reportReason">The reason for the report.</param>
        public async Task ReportPhoto(Photo photo, ReportReason reportReason)
        {
            try
            {
                var reportContract = new ReportContract
                {
                    ReportReason = reportReason,
                    ContentId = photo.Id,
                    ContentType = ContentType.Photo
                };

                await _mobileServiceClient.InvokeApiAsync<ReportContract, ReportContract>("report",
                    reportContract,
                    HttpMethod.Post,
                    null);
            }
            catch (Exception e)
            {
                throw new ServiceException("ReportPhoto error", e);
            }
        }
Example #34
0
 public async Task  Report(
     long photoId , int? ownerId = null,  ReportReason? reason = null
 ) {
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.Report(
                 photoId,ownerId,reason
             )
         ).ConfigureAwait(false)
     ;
 }
Example #35
0
		public bool Report(long ownerId, long itemId, ReportReason reason)
		{
			var parameters = new VkParameters {
				{ "owner_id", ownerId },
				{ "item_id", itemId },
				{ "reason", reason }
			};

			return _vk.Call("market.report", parameters);
		}
Example #36
0
        public bool ReportComment(long commentId, long ownerId, ReportReason reason)
        {
            VkErrors.ThrowIfNumberIsNegative(() => commentId);

            var parameters = new VkParameters
            {
                {"comment_id", commentId},
                {"owner_id", ownerId},
                {"reason", reason}
            };

            return _vk.Call("video.reportComment", parameters);
        }
Example #37
0
 ///<summary>
 ///          Позволяет пожаловаться на комментарий к видеозаписи
 ///      
 ///</summary>
 ///<param name="commentId">идентификатор комментария</param>
 ///<param name="ownerId">идентификатор владельца видеозаписи, к которой оставлен комментарий</param>
 ///<param name="reason">тип жалобы</param>
 public void ReportCommentSync(
     int commentId , int? ownerId = null,  ReportReason? reason = null
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Video.ReportComment(
                 commentId,ownerId,reason
             )
         );
     task.Wait();
     
 }
Example #38
0
		public async Task WallReportPostAsync(
			 uint postId ,
			 int? ownerId = null,
			 ReportReason? reason = null
			){
			await Executor.ExecAsync(
				_reqapi.WallReportPost(
											postId,
											ownerId,
											reason
									)
			);
		}
Example #39
0
 ///<summary>
 ///          Позволяет пожаловаться на видеозапись
 ///      
 ///</summary>
 ///<param name="videoId">идентификатор видеозаписи</param>
 ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит видеозапись</param>
 ///<param name="reason">тип жалобы</param>
 ///<param name="comment">комментарий для жалобы</param>
 ///<param name="searchQuery">поисковой запрос, если видеозапись была найдена через поиск</param>
 public void ReportSync(
     long videoId , int? ownerId = null, ReportReason? reason = null, string comment = "",  string searchQuery = ""
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Video.Report(
                 videoId,ownerId,reason,comment,searchQuery
             )
         );
     task.Wait();
     
 }
        /// <summary>
        ///     Report a comment for being inappropriate.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        /// <param name="reason">The reason why the comment is inappropriate.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<bool> ReportCommentAsync(int commentId, ReportReason reason)
        {
            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = $"comment/{commentId}/report";

            using (var request = RequestBuilder.ReportItemRequest(url, reason))
            {
                var reported = await SendRequestAsync<bool?>(request).ConfigureAwait(false);
                return reported ?? true;
            }
        }
Example #41
0
		public async Task PhotosReportAsync(
			 long photoId ,
			 int? ownerId = null,
			 ReportReason? reason = null
			){
			await Executor.ExecAsync(
				_reqapi.PhotosReport(
											photoId,
											ownerId,
											reason
									)
			);
		}
Example #42
0
		public bool ReportPost(long ownerId, long postId, ReportReason? reason = null)
		{
			var parameters = new VkParameters {
				{ "owner_id", ownerId },
				{ "post_id", postId },
				{ "reason", reason }
			};

			return _vk.Call("wall.reportPost", parameters);
		}
Example #43
0
            ///<summary>
            ///        Позволяет пожаловаться на запись.
            ///      
            ///</summary>
            ///<param name="postId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
            ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
            ///<param name="reason">причина жалобы</param>
            public Request<bool> ReportPost(
                int postId , int? ownerId = null,  ReportReason? reason = null
            ) {
                var req = new Request<bool>{
                    MethodName = "wall.reportPost",
                    Parameters = new Dictionary<string, string> {

                        { "post_id", postId.ToNCString()},
                        { "owner_id", MiscTools.NullableString(ownerId)},
                        { "reason", MiscTools.NullableString( (int?)reason )},

                    }
                };
                    req.Token = _parent.CurrentToken;
                return req;
            }
Example #44
0
		public VKRequest<StructEntity<bool>> WallReportComment(
			 uint commentId ,
			 int? ownerId = null,
			 ReportReason? reason = null
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "wall.reportComment",
				Parameters = new Dictionary<string, string> {
					{ "comment_id", commentId.ToNCString() },
			{ "owner_id", MiscTools.NullableString(ownerId) },
			{ "reason", reason == null ? "" : ( (int)reason ).ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #45
0
		public VKRequest<StructEntity<int>> VideoReport(
			 ulong videoId ,
			 int? ownerId = null,
			 ReportReason? reason = null,
			 string comment = "",
			 string searchQuery = ""
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "video.report",
				Parameters = new Dictionary<string, string> {
					{ "video_id", videoId.ToNCString() },
			{ "owner_id", MiscTools.NullableString(ownerId) },
			{ "reason", reason == null ? "" : ( (int)reason ).ToNCString() },
			{ "comment", comment },
			{ "search_query", searchQuery }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #46
0
		public VKRequest<StructEntity<bool>> PhotosReport(
			 long photoId ,
			 int? ownerId = null,
			 ReportReason? reason = null
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "photos.report",
				Parameters = new Dictionary<string, string> {
					{ "photo_id", photoId.ToNCString() },
			{ "owner_id", MiscTools.NullableString(ownerId) },
			{ "reason", reason == null ? "" : ( (int)reason ).ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
Example #47
0
		public async Task VideoReportAsync(
			 ulong videoId ,
			 int? ownerId = null,
			 ReportReason? reason = null,
			 string comment = "",
			 string searchQuery = ""
			){
			await Executor.ExecAsync(
				_reqapi.VideoReport(
											videoId,
											ownerId,
											reason,
											comment,
											searchQuery
									)
			);
		}
Example #48
0
 /// <inheritdoc />
 public async Task <bool> ReportCommentAsync(long commentId, long ownerId, ReportReason reason)
 {
     return(await TypeHelper.TryInvokeMethodAsync(() => _vk.Video.ReportComment(commentId, ownerId, reason)));
 }
Example #49
0
		public async Task PhotosReportCommentAsync(
			 uint commentId ,
			 int? ownerId = null,
			 ReportReason? reason = null
			){
			await Executor.ExecAsync(
				_reqapi.PhotosReportComment(
											commentId,
											ownerId,
											reason
									)
			);
		}
Example #50
0
        /// <summary>
        /// Update report for a user.
        /// </summary>
        /// <param name="callerClassName">name of the controller class of the caller</param>
        /// <param name="callerMethodName">name of method insider controller class of the caller (should correspond to an HTTP action)</param>
        /// <param name="reportedUserHandle">User being reported on</param>
        /// <param name="reason">Report reason</param>
        /// <returns>Http response</returns>
        protected async Task <IHttpActionResult> UpdateUserReport(string callerClassName, string callerMethodName, string reportedUserHandle, ReportReason reason)
        {
            string reportingUserHandle = this.UserHandle;
            string appHandle           = this.AppHandle;

            // Do not allow the user to self-report.
            // If we did, it could allow an attacker to test our reporting mechanism and figure out
            // what gets blocked and what gets through.
            if (reportingUserHandle == reportedUserHandle)
            {
                return(this.Unauthorized(ResponseStrings.SelfReportIsNotAllowed));
            }

            // submit the request to the reports manager
            DateTime currentTime  = DateTime.UtcNow;
            string   reportHandle = this.handleGenerator.GenerateShortHandle();

            await this.reportsManager.CreateUserReport(
                ProcessType.Frontend,
                reportHandle,
                reportedUserHandle,
                reportingUserHandle,
                appHandle,
                reason,
                currentTime,
                this.ConstructReviewUri(reportHandle));

            string logEntry = $"ReportedUserHandle = {reportedUserHandle}, Reason = {reason}, ReportHandle = {reportHandle}";

            this.LogControllerEnd(this.log, callerClassName, callerMethodName, logEntry);
            return(this.NoContent());
        }
Example #51
0
        public bool Report(long videoId, ReportReason reason, long? ownerId, string comment = null, string searchQuery = null)
        {
            VkErrors.ThrowIfNumberIsNegative(() => videoId);

            var parameters = new VkParameters
            {
                {"video_id", videoId},
                {"owner_id", ownerId},
                {"reason", reason},
                {"comment", comment},
                {"search_query", searchQuery}
            };

            return _vk.Call("video.report", parameters);
        }
Example #52
0
 ///<summary>
 ///        Позволяет пожаловаться на запись.
 ///      
 ///</summary>
 ///<param name="postId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
 ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
 ///<param name="reason">причина жалобы</param>
 public async Task  ReportPost(
     int postId , int? ownerId = null,  ReportReason? reason = null
 ) {
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Wall.ReportPost(
                 postId,ownerId,reason
             )
         ).ConfigureAwait(false)
     ;
 }
Example #53
0
 ///<summary>
 ///          Позволяет пожаловаться на комментарий к видеозаписи
 ///      
 ///</summary>
 ///<param name="commentId">идентификатор комментария</param>
 ///<param name="ownerId">идентификатор владельца видеозаписи, к которой оставлен комментарий</param>
 ///<param name="reason">тип жалобы</param>
 public async Task  ReportComment(
     int commentId , int? ownerId = null,  ReportReason? reason = null
 ) {
         await _parent.Executor.ExecAsync(
             _parent._reqapi.Video.ReportComment(
                 commentId,ownerId,reason
             )
         ).ConfigureAwait(false)
     ;
 }
Example #54
0
		public bool ReportComment(long ownerId, long commentId, ReportReason reason)
		{
			var parameters = new VkParameters {
				{ "owner_id", ownerId },
				{ "comment_id", commentId },
				{ "reason", reason }
			};

			return _vk.Call("market.reportComment", parameters);
		}
Example #55
0
            ///<summary>
            ///          Позволяет пожаловаться на видеозапись
            ///      
            ///</summary>
            ///<param name="videoId">идентификатор видеозаписи</param>
            ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит видеозапись</param>
            ///<param name="reason">тип жалобы</param>
            ///<param name="comment">комментарий для жалобы</param>
            ///<param name="searchQuery">поисковой запрос, если видеозапись была найдена через поиск</param>
            public Request<bool> Report(
                long videoId , int? ownerId = null, ReportReason? reason = null, string comment = "",  string searchQuery = ""
            ) {
                var req = new Request<bool>{
                    MethodName = "video.report",
                    Parameters = new Dictionary<string, string> {

                        { "video_id", videoId.ToNCString()},
                        { "owner_id", MiscTools.NullableString(ownerId)},
                        { "reason", MiscTools.NullableString( (int?)reason )},
                        { "comment", comment},
                        { "search_query", searchQuery},

                    }
                };
                    req.Token = _parent.CurrentToken;
                return req;
            }
Example #56
0
 public void ReportSync(
     long photoId , int? ownerId = null,  ReportReason? reason = null
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Photos.Report(
                 photoId,ownerId,reason
             )
         );
     task.Wait();
     
 }
        private async void OnReportPhoto(ReportReason reason)
        {
            try
            {
                IsBusy = true;

                await _authEnforcementHandler.CheckUserAuthentication();
                var result = await _dialogService.ShowYesNoNotification("ReportContent_Message", "ReportContent_Title");
                if (result)
                {
                    await _photoService.ReportPhoto(_photo, reason);
                }
            }
            catch (SignInRequiredException)
            {
                // Swallow exception.  User canceled the Sign-in dialog.
            }
            catch (ServiceException)
            {
                await _dialogService.ShowGenericServiceErrorNotification();
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #58
0
        /// <summary>
        /// Позволяет пожаловаться на фотографию.
        /// </summary>
        /// <param name="ownerId">Идентификатор пользователя или сообщества, которому принадлежит фотография. целое число, обязательный параметр (Целое число, обязательный параметр).</param>
        /// <param name="photoId">Идентификатор фотографии. положительное число, обязательный параметр (Положительное число, обязательный параметр).</param>
        /// <param name="reason">Причина жалобы:
        ///
        /// 0 — спам;
        /// 1 — детская порнография;
        /// 2 — экстремизм;
        /// 3 — насилие;
        /// 4 — пропаганда наркотиков;
        /// 5 — материал для взрослых;
        /// 6 — оскорбление.
        /// положительное число (Положительное число).</param>
        /// <returns>
        /// После успешного выполнения возвращает <c>true</c>.
        /// </returns>
        /// <remarks>
        /// Страница документации ВКонтакте <see href="http://vk.com/dev/photos.report" />.
        /// </remarks>
        public bool Report(long ownerId, ulong photoId, ReportReason reason)
        {
            var parameters = new VkParameters
            {
                {"owner_id", ownerId},
                {"photo_id", photoId},
                {"reason", reason}
            };

            return _vk.Call("photos.report", parameters);
        }
 /// <summary>
 /// Reports the photo as inappropriate.
 /// </summary>
 /// <param name="photo">The photo.</param>
 /// <param name="reportReason">The reason for the report.</param>
 public async Task ReportPhoto(Photo photo, ReportReason reportReason)
 {
     await SimulateWaitAndError();
 }
Example #60
0
 ///<summary>
 ///        Позволяет пожаловаться на запись.
 ///      
 ///</summary>
 ///<param name="postId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
 ///<param name="ownerId">идентификатор пользователя или сообщества, которому принадлежит запись</param>
 ///<param name="reason">причина жалобы</param>
 public void ReportPostSync(
     int postId , int? ownerId = null,  ReportReason? reason = null
 ) {
     var task = _parent.Executor.ExecAsync(
             _parent._reqapi.Wall.ReportPost(
                 postId,ownerId,reason
             )
         );
     task.Wait();
     
 }