comment.list: fix typos and renamed variables

- Switch from 'author' to 'creator' to disambiguate between comment author and content author. For comment author, we'll use 'commenter' from now on.
- Corrected 'commenterClaimId' to 'creatorClaimId' (just a typo, no functional change).
This commit is contained in:
infinite-persistence 2021-09-27 11:44:44 +08:00
parent cb6873843f
commit 135982e9d0
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 8 additions and 9 deletions

View file

@ -127,7 +127,6 @@ export function doCommentList(
type: ACTIONS.COMMENT_LIST_FAILED, type: ACTIONS.COMMENT_LIST_FAILED,
data: 'unable to find claim for uri', data: 'unable to find claim for uri',
}); });
return; return;
} }
@ -139,7 +138,7 @@ export function doCommentList(
}); });
// Adding 'channel_id' and 'channel_name' enables "CreatorSettings > commentsEnabled". // Adding 'channel_id' and 'channel_name' enables "CreatorSettings > commentsEnabled".
const authorChannelClaim = claim.value_type === 'channel' ? claim : claim.signing_channel; const creatorChannelClaim = claim.value_type === 'channel' ? claim : claim.signing_channel;
return Comments.comment_list({ return Comments.comment_list({
page, page,
@ -147,8 +146,8 @@ export function doCommentList(
page_size: pageSize, page_size: pageSize,
parent_id: parentId || undefined, parent_id: parentId || undefined,
top_level: !parentId, top_level: !parentId,
channel_id: authorChannelClaim ? authorChannelClaim.claim_id : undefined, channel_id: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
channel_name: authorChannelClaim ? authorChannelClaim.name : undefined, channel_name: creatorChannelClaim ? creatorChannelClaim.name : undefined,
sort_by: sortBy, sort_by: sortBy,
}) })
.then((result: CommentListResponse) => { .then((result: CommentListResponse) => {
@ -162,7 +161,7 @@ export function doCommentList(
totalFilteredItems: total_filtered_items, totalFilteredItems: total_filtered_items,
totalPages: total_pages, totalPages: total_pages,
claimId: claimId, claimId: claimId,
commenterClaimId: authorChannelClaim ? authorChannelClaim.claim_id : undefined, creatorClaimId: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
uri: uri, uri: uri,
}, },
}); });
@ -175,7 +174,7 @@ export function doCommentList(
dispatch({ dispatch({
type: ACTIONS.COMMENT_LIST_COMPLETED, type: ACTIONS.COMMENT_LIST_COMPLETED,
data: { data: {
authorClaimId: authorChannelClaim ? authorChannelClaim.claim_id : undefined, creatorClaimId: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
disabled: true, disabled: true,
}, },
}); });

View file

@ -246,7 +246,7 @@ export default handleActions(
claimId, claimId,
uri, uri,
disabled, disabled,
commenterClaimId, creatorClaimId,
} = action.data; } = action.data;
const commentById = Object.assign({}, state.commentById); const commentById = Object.assign({}, state.commentById);
@ -262,8 +262,8 @@ export default handleActions(
const isLoadingByParentId = Object.assign({}, state.isLoadingByParentId); const isLoadingByParentId = Object.assign({}, state.isLoadingByParentId);
const settingsByChannelId = Object.assign({}, state.settingsByChannelId); const settingsByChannelId = Object.assign({}, state.settingsByChannelId);
settingsByChannelId[commenterClaimId] = { settingsByChannelId[creatorClaimId] = {
...(settingsByChannelId[commenterClaimId] || {}), ...(settingsByChannelId[creatorClaimId] || {}),
comments_enabled: !disabled, comments_enabled: !disabled,
}; };