refactor(core): remove legacy plebbit terminology

This commit is contained in:
Tommaso Casaburi
2026-04-17 10:48:27 +07:00
parent e366dac25c
commit ee7a5b5778
158 changed files with 626 additions and 836 deletions
+5 -9
View File
@@ -1,15 +1,14 @@
type CommentWithLegacyCommunityAddress = {
type CommentWithCommunityAddress = {
communityAddress?: string;
replies?: {
pages?: Record<
string,
| {
comments?: Array<CommentWithLegacyCommunityAddress | undefined>;
comments?: Array<CommentWithCommunityAddress | undefined>;
}
| undefined
>;
};
subplebbitAddress?: string;
};
export const getCommentCommunityAddress = (comment?: unknown) => {
@@ -17,18 +16,15 @@ export const getCommentCommunityAddress = (comment?: unknown) => {
return undefined;
}
const record = comment as { communityAddress?: unknown; subplebbitAddress?: unknown };
const record = comment as { communityAddress?: unknown };
if (typeof record.communityAddress === 'string' && record.communityAddress) {
return record.communityAddress;
}
if (typeof record.subplebbitAddress === 'string' && record.subplebbitAddress) {
return record.subplebbitAddress;
}
return undefined;
};
const withResolvedReplyPages = (replies?: CommentWithLegacyCommunityAddress['replies']) => {
const withResolvedReplyPages = (replies?: CommentWithCommunityAddress['replies']) => {
if (!replies?.pages) {
return replies;
}
@@ -82,7 +78,7 @@ const withResolvedReplyPages = (replies?: CommentWithLegacyCommunityAddress['rep
};
};
export const withResolvedCommentCommunityAddress = <T extends CommentWithLegacyCommunityAddress | undefined | null>(comment: T): T => {
export const withResolvedCommentCommunityAddress = <T extends CommentWithCommunityAddress | undefined | null>(comment: T): T => {
if (!comment) {
return comment;
}