mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor: migrate 5chan to the community hooks API (#1073)
* refactor(community-api): migrate 5chan to community hooks * fix(review): address PR feedback * fix(review): preserve legacy board context fallbacks * fix(review): address latest bot feedback * fix(review): use communityAddress in edit menu privileges
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { getCommentCommunityAddress } from './comment-utils';
|
||||
|
||||
export type PostMenuProps = {
|
||||
cid?: string;
|
||||
postCid?: string;
|
||||
parentCid?: string;
|
||||
communityAddress?: string;
|
||||
subplebbitAddress?: string;
|
||||
authorAddress?: string;
|
||||
link?: string;
|
||||
@@ -14,16 +16,21 @@ export type PostMenuProps = {
|
||||
removed?: boolean;
|
||||
};
|
||||
|
||||
export const selectPostMenuProps = (post?: Comment): PostMenuProps => ({
|
||||
cid: post?.cid,
|
||||
postCid: post?.postCid,
|
||||
parentCid: post?.parentCid,
|
||||
subplebbitAddress: post?.subplebbitAddress,
|
||||
authorAddress: post?.author?.address,
|
||||
link: post?.link,
|
||||
linkWidth: post?.linkWidth,
|
||||
linkHeight: post?.linkHeight,
|
||||
thumbnailUrl: post?.thumbnailUrl,
|
||||
deleted: post?.deleted,
|
||||
removed: post?.removed,
|
||||
});
|
||||
export const selectPostMenuProps = (post?: Comment): PostMenuProps => {
|
||||
const communityAddress = getCommentCommunityAddress(post);
|
||||
|
||||
return {
|
||||
cid: post?.cid,
|
||||
postCid: post?.postCid,
|
||||
parentCid: post?.parentCid,
|
||||
communityAddress,
|
||||
subplebbitAddress: post?.subplebbitAddress,
|
||||
authorAddress: post?.author?.address,
|
||||
link: post?.link,
|
||||
linkWidth: post?.linkWidth,
|
||||
linkHeight: post?.linkHeight,
|
||||
thumbnailUrl: post?.thumbnailUrl,
|
||||
deleted: post?.deleted,
|
||||
removed: post?.removed,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user