lbry-desktop/flow-typed/Comment.js

156 lines
4.6 KiB
JavaScript
Raw Normal View History

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
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
is_pinned: boolean,
2021-04-23 21:59:48 +02:00
support_amount: number,
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> } },
2020-08-24 19:35:21 +02:00
byId: { [string]: Array<string> },
repliesByParentId: { [string]: Array<string> }, // ParentCommentID -> list of reply comments
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of top level comments
commentById: { [string]: Comment },
isLoading: boolean,
myComments: ?Set<string>,
2020-09-29 16:10:23 +02:00
isFetchingReacts: boolean,
myReactsByCommentId: any,
othersReactsByCommentId: any,
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", ...]}
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,
blockingByUri: {},
unBlockingByUri: {},
2021-05-25 08:17:36 +02:00
togglingForDelegatorMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
commentsDisabledChannelIds: Array<string>,
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,
};
2021-04-23 21:59:48 +02:00
declare type CommentListParams = {
page: number,
page_size: number,
claim_id: string,
};
declare type CommentListResponse = {
items: Array<Comment>,
total_amount: number,
};
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,
signing_ts: number,
support_tx_id?: string,
};
declare type SuperListParams = {};
declare type ModerationBlockParams = {};
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 = {
channel_name: string,
channel_id: string,
signature: string,
signing_ts: string,
};
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
};