コード例 #1
0
 public GetCommentsRequest(CommentableType type, long id, CommentsSortCriteria sort = CommentsSortCriteria.New, int page = 1)
 {
     this.type = type;
     this.sort = sort;
     this.id   = id;
     this.page = page;
 }
コード例 #2
0
 public GetCommentsRequest(long commentableId, CommentableType type, CommentsSortCriteria sort = CommentsSortCriteria.New, int page = 1, long?parentId = null)
 {
     this.commentableId = commentableId;
     this.type          = type;
     this.sort          = sort;
     this.page          = page;
     this.parentId      = parentId;
 }
コード例 #3
0
ファイル: CommentsContainer.cs プロジェクト: DanSprat/osu
        /// <param name="type">The type of resource to get comments for.</param>
        /// <param name="id">The id of the resource to get comments for.</param>
        public void ShowComments(CommentableType type, long id)
        {
            this.type = type;
            this.id   = id;

            if (!IsLoaded)
            {
                return;
            }

            refetchComments();
        }
コード例 #4
0
        /// <param name="type">The type of resource to get comments for.</param>
        /// <param name="id">The id of the resource to get comments for.</param>
        public void ShowComments(CommentableType type, long id)
        {
            this.type = type;
            this.id   = id;

            if (!IsLoaded)
            {
                return;
            }

            // only reset when changing ID/type. other refetch ops are generally just changing sort order.
            commentCounter.Current.Value = 0;

            refetchComments();
        }
コード例 #5
0
        public async Task TestCommentableLookup(CommentableType type, uint typeId, uint expectedCommentId)
        {
            var comments = await Client.GetComments(type, typeId);

            Assert.IsTrue(comments.Comments.Select(x => x.Id).Contains(expectedCommentId));
        }
コード例 #6
0
ファイル: CommentsContainer.cs プロジェクト: zachllogan/osu
        public CommentsContainer(CommentableType type, long id)
        {
            this.type = type;
            this.id   = id;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            AddRangeInternal(new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        new CommentsHeader
                        {
                            Sort        = { BindTarget = Sort },
                            ShowDeleted = { BindTarget = ShowDeleted }
                        },
                        content = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.Gray(0.2f)
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Children         = new Drawable[]
                                    {
                                        deletedChildrenPlaceholder = new DeletedChildrenPlaceholder
                                        {
                                            ShowDeleted = { BindTarget = ShowDeleted }
                                        },
                                        new Container
                                        {
                                            AutoSizeAxes     = Axes.Y,
                                            RelativeSizeAxes = Axes.X,
                                            Child            = moreButton = new CommentsShowMoreButton
                                            {
                                                Anchor = Anchor.Centre,
                                                Origin = Anchor.Centre,
                                                Margin = new MarginPadding(5),
                                                Action = getComments
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
コード例 #7
0
        /// <summary>
        /// Gets child comments posted in reply to a comment (upto 2 levels deep)
        /// </summary>
        /// <param name="client">The <see cref="OrbitClient"/> to use</param>
        /// <param name="type">The <see cref="CommentableType"/> the <see cref="typeId"/> is</param>
        /// <param name="typeId">The id of the entity to get comments for</param>
        /// <param name="last">Optional response of the last request for getting the "next page" of results</param>
        /// <param name="limit">Optional upper-limit for returned responses</param>
        /// <returns>
        /// Comments summary, including all metadata (users/maps/posts) the comments relate to.
        /// Returns null if there are no more comments (based on the cursor)
        /// </returns>
        public static Task <OsuCommentsSummary> GetComments(this OrbitClient client, CommentableType type, uint typeId, OsuCommentsSummary last = null, uint?limit = null)
        {
            var request = GetRequest(last, limit, () => new OsuCommentsRequest(type, typeId));

            return(request is null ? null : client.PerformAsync <OsuCommentsSummary>(request));
        }
コード例 #8
0
 public CommentsRequestSettings(long commentableId, CommentableType commentableType)
 {
     commentable_id   = commentableId;
     commentable_type = commentableType;
 }