2020-08-24 19:35:21 +02:00
|
|
|
declare type Comment = {
|
|
|
|
comment: string, // comment body
|
|
|
|
comment_id: string, // sha256 digest
|
|
|
|
claim_id: string, // id linking to the claim this comment
|
|
|
|
timestamp: number, // integer representing unix-time
|
|
|
|
is_hidden: boolean, // claim owner may enable/disable this
|
2020-10-07 22:18:16 +02:00
|
|
|
channel_id: string, // claimId of channel signing this comment
|
|
|
|
channel_name?: string, // name of channel claim
|
2020-08-24 19:35:21 +02:00
|
|
|
channel_url?: string, // full lbry url to signing channel
|
|
|
|
signature?: string, // signature of comment by originating channel
|
|
|
|
signing_ts?: string, // timestamp used when signing this comment
|
|
|
|
is_channel_signature_valid?: boolean, // whether or not the signature could be validated
|
|
|
|
parent_id?: number, // comment_id of comment this is in reply to
|
2020-10-08 17:31:36 +02:00
|
|
|
is_pinned: boolean,
|
2021-04-23 21:59:48 +02:00
|
|
|
support_amount: number,
|
2021-07-15 16:43:28 +02:00
|
|
|
replies: number, // number of direct replies (i.e. excluding nested replies).
|
2021-07-23 12:26:16 +02:00
|
|
|
is_moderator: boolean,
|
|
|
|
is_creator: boolean,
|
|
|
|
is_global_mod: boolean,
|
2021-07-17 18:08:53 +02:00
|
|
|
is_fiat?: boolean,
|
2021-12-30 04:43:53 +01:00
|
|
|
removed?: boolean,
|
2020-08-24 19:35:21 +02:00
|
|
|
};
|
|
|
|
|
2022-02-07 19:03:10 +01:00
|
|
|
declare type CommentSubmitParams = {
|
|
|
|
comment: string,
|
|
|
|
claim_id: string,
|
|
|
|
parent_id?: string,
|
|
|
|
txid?: ?string,
|
|
|
|
payment_intent_id?: ?string,
|
|
|
|
environment?: ?string,
|
|
|
|
sticker: boolean,
|
|
|
|
};
|
|
|
|
|
2021-04-20 10:40:53 +02:00
|
|
|
declare type PerChannelSettings = {
|
|
|
|
words?: Array<string>,
|
|
|
|
comments_enabled?: boolean,
|
|
|
|
min_tip_amount_comment?: number,
|
|
|
|
min_tip_amount_super_chat?: number,
|
|
|
|
slow_mode_min_gap?: number,
|
2022-02-23 07:29:14 +01:00
|
|
|
time_since_first_comment?: number,
|
2021-04-20 10:40:53 +02:00
|
|
|
};
|
|
|
|
|
2020-08-24 19:35:21 +02:00
|
|
|
// todo: relate individual comments to their commentId
|
|
|
|
declare type CommentsState = {
|
2022-04-28 08:10:35 +02:00
|
|
|
commentsByUri: { [string]: string }, // URI -> claimId (TODO: remove)
|
2021-04-23 21:59:48 +02:00
|
|
|
superChatsByUri: { [string]: { totalAmount: number, comments: Array<Comment> } },
|
2021-07-15 16:43:28 +02:00
|
|
|
byId: { [string]: Array<string> }, // ClaimID -> list of fetched comment IDs.
|
|
|
|
totalCommentsById: {}, // ClaimId -> ultimate total (including replies) in commentron.
|
|
|
|
repliesByParentId: { [string]: Array<string> }, // ParentCommentID -> list of fetched replies.
|
2021-08-04 17:01:31 +02:00
|
|
|
repliesTotalPagesByParentId: {}, // ParentCommentID -> total number of reply pages for a parentId in commentron.
|
2021-07-15 16:43:28 +02:00
|
|
|
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of fetched top level comments.
|
|
|
|
topLevelTotalPagesById: { [string]: number }, // ClaimID -> total number of top-level pages in commentron. Based on COMMENT_PAGE_SIZE_TOP_LEVEL.
|
|
|
|
topLevelTotalCommentsById: { [string]: number }, // ClaimID -> total top level comments in commentron.
|
2022-04-28 08:10:35 +02:00
|
|
|
commentById: { [string]: Comment }, // commentId -> Comment
|
Re-design comment threads (#1489)
* Redesign threadline and fetching state
- threadline goes right below channel avatar, mimicking reddits implementation, has a increase effect on hover and is slimmer, creating more space for comments on screen
- fetching state now replaces show/hide button, also mimicking reddit, and now says that it is loading, instead of a blank spinner, and also improves space a bit
* Redesign comment threads
- Allow for infinite comment chains
- Can go back and forth between the pages
- Can go back to all comments or to the first comment in the chain
- Some other improvements, which include:
- add title on non-drawer comment sections (couldn't see amount of comments)
- fix Expandable component (would begin expanded and collapse after the effect runs, which looked bad and shifted the layout, now each comments greater than the set length begins collapsed)
- used constants for consistency
* Fix replying to last thread comment
* Fix buttons condition (only on fetched comment to avoid deleted case)
* Fix auto-scroll
* Bring back instant feedback for Show More replies
* Improve thread back links
- Now going back to all comments links the top-level comment for easier navigation
- Going back to ~ previous ~ now goes back into the chain instead of topmost level
* Clear timeouts due to unrelated issue
* Fix deep thread linked comment case and more scroll improvements
* More minor changes
* Flow
* Fix commentList tile style
* Fix long channel names overflowing on small screens
* More scroll changes
* Fix threadline
* Revert "Fix long channel names overflowing on small screens"
This reverts commit e4d2dc7da5861ed8136a60f3352e41a690cd4d33.
* Fix replies fetch
* Revert "Fix replies fetch"
This reverts commit ec70054675a604a7a5f3764ba07c36bf7b0f49c8.
* Cleanup and make smooth
* Always use linked comment on threads
* Cleanup
* Higlight thread comment
* Fix comment body styles
2022-05-16 12:22:13 +02:00
|
|
|
fetchedCommentAncestors: { [string]: Array<string> }, // {"fetchedCommentId": ["parentId", "grandParentId", ...]}
|
2021-08-09 08:26:03 +02:00
|
|
|
pinnedCommentsById: {}, // ClaimId -> array of pinned comment IDs
|
2020-08-24 19:35:21 +02:00
|
|
|
isLoading: boolean,
|
2021-10-01 09:49:37 +02:00
|
|
|
isLoadingById: boolean,
|
2021-07-15 16:43:28 +02:00
|
|
|
isLoadingByParentId: { [string]: boolean },
|
2021-10-11 05:22:05 +02:00
|
|
|
isCommenting: boolean,
|
2020-08-24 19:35:21 +02:00
|
|
|
myComments: ?Set<string>,
|
2020-09-29 16:10:23 +02:00
|
|
|
isFetchingReacts: boolean,
|
2021-07-15 16:43:28 +02:00
|
|
|
myReactsByCommentId: ?{ [string]: Array<string> }, // {"CommentId:MyChannelId": ["like", "dislike", ...]}
|
|
|
|
othersReactsByCommentId: ?{ [string]: { [string]: number } }, // {"CommentId:MyChannelId": {"like": 2, "dislike": 2, ...}}
|
2020-09-30 17:59:05 +02:00
|
|
|
pendingCommentReactions: Array<string>,
|
2021-05-25 08:17:36 +02:00
|
|
|
moderationBlockList: ?Array<string>, // @KP rename to "personalBlockList"?
|
|
|
|
adminBlockList: ?Array<string>,
|
|
|
|
moderatorBlockList: ?Array<string>,
|
2022-02-07 19:03:10 +01:00
|
|
|
moderatorBlockListDelegatorsMap: { [string]: Array<string> }, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
2021-03-03 19:50:16 +01:00
|
|
|
fetchingModerationBlockList: boolean,
|
2021-05-25 08:17:36 +02:00
|
|
|
moderationDelegatesById: { [string]: Array<{ channelId: string, channelName: string }> },
|
|
|
|
fetchingModerationDelegates: boolean,
|
2022-02-07 19:03:10 +01:00
|
|
|
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
2021-05-25 08:17:36 +02:00
|
|
|
fetchingModerationDelegators: boolean,
|
2021-03-03 19:50:16 +01:00
|
|
|
blockingByUri: {},
|
|
|
|
unBlockingByUri: {},
|
2021-08-20 09:18:54 +02:00
|
|
|
personalTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
|
|
|
adminTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
|
|
|
moderatorTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
2022-02-07 19:03:10 +01:00
|
|
|
togglingForDelegatorMap: { [string]: Array<string> }, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
2021-04-20 10:40:53 +02:00
|
|
|
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
|
|
|
fetchingSettings: boolean,
|
|
|
|
fetchingBlockedWords: boolean,
|
2022-04-28 09:08:26 +02:00
|
|
|
myCommentedChannelIdsById: { [string]: Array<string> }, // [content-claim-id] -> array of own channels IDs that have commented before.
|
2020-08-24 19:35:21 +02:00
|
|
|
};
|
2020-09-29 16:10:23 +02:00
|
|
|
|
2022-01-18 03:18:08 +01:00
|
|
|
// Authorization parameters for calls requiring user authentication
|
|
|
|
declare type Authorization = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
// ModAuthorization parameters for calls requiring creator/moderator authentication
|
|
|
|
declare type ModAuthorization = {
|
|
|
|
// Publisher, Moderator or Commentron Admin
|
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
// Creator that Moderator is delegated from. Used for delegated moderation
|
|
|
|
creator_channel_id: string,
|
|
|
|
creator_channel_name: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
2020-09-29 16:10:23 +02:00
|
|
|
declare type CommentReactParams = {
|
|
|
|
comment_ids: string,
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
react_type: string,
|
|
|
|
clear_types?: string,
|
|
|
|
remove?: boolean,
|
2020-10-07 22:18:16 +02:00
|
|
|
};
|
2021-04-23 21:59:48 +02:00
|
|
|
|
2021-07-15 05:24:37 +02:00
|
|
|
declare type ReactionReactParams = {
|
|
|
|
comment_ids: string,
|
|
|
|
signature?: string,
|
|
|
|
signing_ts?: string,
|
|
|
|
remove?: boolean,
|
|
|
|
clear_types?: string,
|
|
|
|
type: string,
|
|
|
|
channel_id: string,
|
|
|
|
channel_name: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ReactionReactResponse = {
|
2022-02-07 19:03:10 +01:00
|
|
|
Reactions: { [string]: { [string]: number } },
|
2021-07-15 05:24:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type ReactionListParams = {
|
|
|
|
comment_ids: string, // CSV of IDs
|
2021-07-15 16:43:28 +02:00
|
|
|
channel_id?: string,
|
|
|
|
channel_name?: string,
|
2021-07-15 05:24:37 +02:00
|
|
|
signature?: string,
|
|
|
|
signing_ts?: string,
|
|
|
|
types?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ReactionListResponse = {
|
|
|
|
my_reactions: Array<MyReactions>,
|
|
|
|
others_reactions: Array<OthersReactions>,
|
2021-07-15 16:43:28 +02:00
|
|
|
};
|
|
|
|
|
2021-04-23 21:59:48 +02:00
|
|
|
declare type CommentListParams = {
|
2022-02-07 19:03:10 +01:00
|
|
|
page: number, // pagination: which page of results
|
|
|
|
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
|
|
|
claim_id?: string, // claim id of claim being commented on
|
|
|
|
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
|
|
|
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
2021-07-15 16:43:28 +02:00
|
|
|
author_claim_id?: string, // filters comments to just this author
|
2022-03-02 13:10:52 +01:00
|
|
|
parent_id?: ?string, // filters comments to those under this thread
|
2022-02-07 19:03:10 +01:00
|
|
|
top_level?: boolean, // filters to only top level comments
|
|
|
|
hidden?: boolean, // if true, will show hidden comments as well
|
2022-03-03 16:16:02 +01:00
|
|
|
sort_by?: ?number, // @see: ui/constants/comments.js::SORT_BY
|
2021-04-23 21:59:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type CommentListResponse = {
|
|
|
|
items: Array<Comment>,
|
2021-07-15 16:43:28 +02:00
|
|
|
page: number,
|
|
|
|
page_size: number,
|
2022-02-07 19:03:10 +01:00
|
|
|
total_items: number, // Grand total for the claim being commented on.
|
2021-07-15 16:43:28 +02:00
|
|
|
total_filtered_items: number, // Total for filtered queries (e.g. top_level=true, parent_id=xxx, etc.).
|
|
|
|
total_pages: number,
|
|
|
|
has_hidden_comments: boolean,
|
2021-04-23 21:59:48 +02:00
|
|
|
};
|
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
declare type CommentByIdParams = {
|
|
|
|
comment_id: string,
|
|
|
|
with_ancestors: boolean,
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-07-15 16:43:28 +02:00
|
|
|
|
|
|
|
declare type CommentByIdResponse = {
|
|
|
|
item: Comment,
|
|
|
|
items: Comment,
|
|
|
|
ancestors: Array<Comment>,
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-07-15 16:43:28 +02:00
|
|
|
|
2021-07-15 05:24:37 +02:00
|
|
|
declare type CommentPinParams = {
|
|
|
|
comment_id: string,
|
|
|
|
channel_id: string,
|
|
|
|
channel_name: string,
|
|
|
|
remove?: boolean,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-07-15 05:24:37 +02:00
|
|
|
|
|
|
|
declare type CommentPinResponse = {
|
|
|
|
items: Comment, // "items" is an inherited typo to match SDK. Will be "item" in a new version.
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-07-15 05:24:37 +02:00
|
|
|
|
|
|
|
declare type CommentEditParams = {
|
|
|
|
comment: string,
|
|
|
|
comment_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-07-15 05:24:37 +02:00
|
|
|
|
2022-02-07 19:03:10 +01:00
|
|
|
declare type CommentEditResponse = Comment;
|
2021-07-15 05:24:37 +02:00
|
|
|
|
2021-04-23 21:59:48 +02:00
|
|
|
declare type CommentAbandonParams = {
|
|
|
|
comment_id: string,
|
|
|
|
creator_channel_id?: string,
|
|
|
|
creator_channel_name?: string,
|
2021-11-08 18:22:40 +01:00
|
|
|
signature?: string,
|
|
|
|
signing_ts?: string,
|
|
|
|
mod_channel_id?: string,
|
|
|
|
mod_channel_name?: string,
|
2021-04-23 21:59:48 +02:00
|
|
|
};
|
|
|
|
|
2022-01-17 14:44:45 +01:00
|
|
|
declare type MentionedChannel = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
};
|
|
|
|
|
2021-04-23 21:59:48 +02:00
|
|
|
declare type CommentCreateParams = {
|
|
|
|
comment: string,
|
|
|
|
claim_id: string,
|
|
|
|
parent_id?: string,
|
|
|
|
signature: string,
|
2021-10-17 10:36:14 +02:00
|
|
|
signing_ts: string,
|
2021-04-23 21:59:48 +02:00
|
|
|
support_tx_id?: string,
|
2022-01-17 14:44:45 +01:00
|
|
|
mentioned_channels?: Array<MentionedChannel>,
|
2021-04-23 21:59:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type SuperListParams = {};
|
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
declare type SuperListResponse = {
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_pages: number,
|
|
|
|
total_items: number,
|
|
|
|
total_amount: number,
|
|
|
|
items: Array<Comment>,
|
|
|
|
has_hidden_comments: boolean,
|
|
|
|
};
|
|
|
|
|
2021-08-12 09:10:44 +02:00
|
|
|
declare type ModerationBlockParams = {
|
|
|
|
// Publisher, Moderator, or Commentron Admin
|
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
// Offender being blocked
|
|
|
|
blocked_channel_id: string,
|
|
|
|
blocked_channel_name: string,
|
|
|
|
// Creator that Moderator is delegated from. Used for delegated moderation
|
|
|
|
creator_channel_id?: string,
|
|
|
|
creator_channel_name?: string,
|
2021-11-09 15:43:02 +01:00
|
|
|
// ID of comment to remove as part of this block
|
|
|
|
offending_comment_id?: string,
|
2021-08-12 09:10:44 +02:00
|
|
|
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
|
|
|
block_all?: boolean,
|
2021-11-09 15:43:02 +01:00
|
|
|
time_out?: ?number,
|
2021-08-12 09:10:44 +02:00
|
|
|
// If true will delete all comments of the offender, requires Admin rights on commentron for universal delete
|
|
|
|
delete_all?: boolean,
|
|
|
|
// The usual signature stuff
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ModerationBlockResponse = {
|
|
|
|
deleted_comment_ids: Array<string>,
|
|
|
|
banned_channel_id: string,
|
|
|
|
all_blocked: boolean,
|
|
|
|
banned_from: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type BlockedListArgs = {
|
|
|
|
// Publisher, Moderator or Commentron Admin
|
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
// Creator that Moderator is delegated from. Used for delegated moderation
|
|
|
|
creator_channel_id?: string,
|
|
|
|
creator_channel_name?: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
2021-04-20 10:40:53 +02:00
|
|
|
|
2022-01-18 03:18:08 +01:00
|
|
|
declare type ModerationAddDelegateParams = Authorization & {
|
2021-05-25 08:17:36 +02:00
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
};
|
|
|
|
|
2022-01-18 03:18:08 +01:00
|
|
|
declare type ModerationRemoveDelegateParams = Authorization & {
|
2021-05-25 08:17:36 +02:00
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
};
|
|
|
|
|
2022-01-18 03:18:08 +01:00
|
|
|
declare type ModerationListDelegatesParams = Authorization;
|
2021-05-25 08:17:36 +02:00
|
|
|
|
|
|
|
declare type ModerationAmIParams = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
signature: string,
|
2022-02-07 19:03:10 +01:00
|
|
|
signing_ts: string,
|
2021-05-25 08:17:36 +02:00
|
|
|
};
|
|
|
|
|
2021-04-20 10:40:53 +02:00
|
|
|
declare type SettingsParams = {
|
2021-07-29 16:53:36 +02:00
|
|
|
channel_name?: string,
|
2021-04-20 10:40:53 +02:00
|
|
|
channel_id: string,
|
2021-07-29 16:53:36 +02:00
|
|
|
signature?: string,
|
|
|
|
signing_ts?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type SettingsResponse = {
|
|
|
|
words?: string,
|
|
|
|
comments_enabled: boolean,
|
|
|
|
min_tip_amount_comment: number,
|
|
|
|
min_tip_amount_super_chat: number,
|
|
|
|
slow_mode_min_gap: number,
|
|
|
|
curse_jar_amount: number,
|
|
|
|
filters_enabled?: boolean,
|
2021-04-20 10:40:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type UpdateSettingsParams = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
comments_enabled?: boolean,
|
|
|
|
min_tip_amount_comment?: number,
|
|
|
|
min_tip_amount_super_chat?: number,
|
|
|
|
slow_mode_min_gap?: number,
|
2022-02-23 07:29:14 +01:00
|
|
|
time_since_first_comment?: number,
|
2022-02-07 19:03:10 +01:00
|
|
|
};
|
2021-04-20 10:40:53 +02:00
|
|
|
|
|
|
|
declare type BlockWordParams = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
words: string, // CSV list of containing words to block comment on content
|
|
|
|
};
|