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,
|
2020-08-24 19:35:21 +02:00
|
|
|
};
|
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2020-08-24 19:35:21 +02:00
|
|
|
// todo: relate individual comments to their commentId
|
|
|
|
declare type CommentsState = {
|
|
|
|
commentsByUri: { [string]: string },
|
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.
|
2020-08-24 19:35:21 +02:00
|
|
|
commentById: { [string]: Comment },
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentAncestors: { [string]: Array<string> }, // {"linkedCommentId": ["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-12-03 05:19:47 +01: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>,
|
|
|
|
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,
|
|
|
|
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } }},
|
|
|
|
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 } },
|
2021-05-25 08:17:36 +02: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,
|
2020-08-24 19:35:21 +02:00
|
|
|
};
|
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 = {
|
|
|
|
Reactions: { [string]: { [string]: number} },
|
|
|
|
};
|
|
|
|
|
|
|
|
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 = {
|
2021-07-15 16:43:28 +02:00
|
|
|
page: number, // pagination: which page of results
|
|
|
|
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
2021-10-01 14:10:27 +02:00
|
|
|
claim_id?: string, // claim id of claim being commented on
|
2021-07-15 16:43:28 +02:00
|
|
|
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
|
|
|
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
|
|
|
author_claim_id?: string, // filters comments to just this author
|
|
|
|
parent_id?: string, // filters comments to those under this thread
|
|
|
|
top_level?: boolean, // filters to only top level comments
|
|
|
|
hidden?: boolean, // if true, will show hidden comments as well
|
2021-10-01 14:10:27 +02: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,
|
|
|
|
total_items: number, // Grand total for the claim being commented on.
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
|
|
|
|
declare type CommentByIdResponse = {
|
|
|
|
item: Comment,
|
|
|
|
items: Comment,
|
|
|
|
ancestors: Array<Comment>,
|
|
|
|
}
|
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
|
|
|
|
declare type CommentPinResponse = {
|
|
|
|
items: Comment, // "items" is an inherited typo to match SDK. Will be "item" in a new version.
|
|
|
|
}
|
|
|
|
|
|
|
|
declare type CommentEditParams = {
|
|
|
|
comment: string,
|
|
|
|
comment_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
declare type CommentEditResponse = Comment
|
|
|
|
|
2021-04-23 21:59:48 +02:00
|
|
|
declare type CommentAbandonParams = {
|
|
|
|
comment_id: string,
|
|
|
|
creator_channel_id?: string,
|
|
|
|
creator_channel_name?: string,
|
|
|
|
channel_id?: string,
|
|
|
|
hexdata?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type CommentCreateParams = {
|
|
|
|
comment: string,
|
|
|
|
claim_id: string,
|
|
|
|
parent_id?: string,
|
|
|
|
signature: string,
|
2021-10-08 05:47:39 +02:00
|
|
|
signing_ts: string,
|
2021-04-23 21:59:48 +02:00
|
|
|
support_tx_id?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
|
|
|
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
|
|
|
block_all?: boolean,
|
2021-08-20 03:04:48 +02: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
|
|
|
|
2021-05-25 08:17:36 +02:00
|
|
|
declare type ModerationAddDelegateParams = {
|
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
creator_channel_id: string,
|
|
|
|
creator_channel_name: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ModerationRemoveDelegateParams = {
|
|
|
|
mod_channel_id: string,
|
|
|
|
mod_channel_name: string,
|
|
|
|
creator_channel_id: string,
|
|
|
|
creator_channel_name: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ModerationListDelegatesParams = {
|
|
|
|
creator_channel_id: string,
|
|
|
|
creator_channel_name: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type ModerationAmIParams = {
|
|
|
|
channel_name: string,
|
|
|
|
channel_id: string,
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string
|
|
|
|
};
|
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|