doCommentListOwn: clean up docs; add limit assertion
This commit is contained in:
parent
95df6fedc0
commit
12a59708e4
1 changed files with 14 additions and 4 deletions
|
@ -111,7 +111,7 @@ export function doCommentList(
|
||||||
export function doCommentListOwn(
|
export function doCommentListOwn(
|
||||||
channelId: string,
|
channelId: string,
|
||||||
page: number = 1,
|
page: number = 1,
|
||||||
pageSize: number = 99999,
|
pageSize: number = 10,
|
||||||
sortBy: number = SORT_BY.NEWEST_NO_PINS
|
sortBy: number = SORT_BY.NEWEST_NO_PINS
|
||||||
) {
|
) {
|
||||||
return async (dispatch: Dispatch, getState: GetState) => {
|
return async (dispatch: Dispatch, getState: GetState) => {
|
||||||
|
@ -134,6 +134,10 @@ export function doCommentListOwn(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @if process.env.NODE_ENV!='production'
|
||||||
|
console.assert(pageSize <= 50, `claim_search can't resolve > 50 (pageSize=${pageSize})`);
|
||||||
|
// @endif
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.COMMENT_LIST_STARTED,
|
type: ACTIONS.COMMENT_LIST_STARTED,
|
||||||
data: {},
|
data: {},
|
||||||
|
@ -160,7 +164,7 @@ export function doCommentListOwn(
|
||||||
dispatch(
|
dispatch(
|
||||||
doClaimSearch({
|
doClaimSearch({
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: pageSize,
|
||||||
no_totals: true,
|
no_totals: true,
|
||||||
claim_ids: comments.map((c) => c.claim_id),
|
claim_ids: comments.map((c) => c.claim_id),
|
||||||
})
|
})
|
||||||
|
@ -173,9 +177,15 @@ export function doCommentListOwn(
|
||||||
totalItems: total_items,
|
totalItems: total_items,
|
||||||
totalFilteredItems: total_filtered_items,
|
totalFilteredItems: total_filtered_items,
|
||||||
totalPages: total_pages,
|
totalPages: total_pages,
|
||||||
uri: channelClaim.canonical_url, // hijack "Discussion Page"
|
uri: channelClaim.canonical_url, // hijack Discussion Page ¹
|
||||||
claimId: channelClaim.claim_id, // hijack "Discussion Page"
|
claimId: channelClaim.claim_id, // hijack Discussion Page ¹
|
||||||
},
|
},
|
||||||
|
// ¹ Comments are currently stored in an object with the key being
|
||||||
|
// the content claim_id; so as a quick solution, we are using the
|
||||||
|
// channel's claim_id to store Own Comments, which is the same way
|
||||||
|
// as Discussion Page. This idea works based on the assumption
|
||||||
|
// that both Own Comments and Discussion will never appear
|
||||||
|
// simultaneously.
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
Loading…
Reference in a new issue