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
@@ -9,9 +9,7 @@ describe('buildEditableAccountJson', () => {
author: { address: '0x123', shortAddress: '0x1...3', avatar: { url: 'https://example.com' } },
pkc: { someOption: true },
pkcReactOptions: { foo: 'baz' },
plebbit: { someOption: true },
karma: 42,
plebbitReactOptions: { foo: 'bar' },
unreadNotificationCount: 5,
};
const result = JSON.parse(buildEditableAccountJson(account));
@@ -21,9 +19,7 @@ describe('buildEditableAccountJson', () => {
expect(result.account.author.avatar).toBeUndefined();
expect(result.account.pkc).toBeUndefined();
expect(result.account.pkcReactOptions).toBeUndefined();
expect(result.account.plebbit).toBeUndefined();
expect(result.account.karma).toBeUndefined();
expect(result.account.plebbitReactOptions).toBeUndefined();
expect(result.account.unreadNotificationCount).toBeUndefined();
});
@@ -26,14 +26,14 @@ describe('challenge-utils', () => {
challengeSuccess: false,
reason: 'try again later',
} as never,
{ subplebbitAddress: 'business-and-finance.bso' },
{ communityAddress: 'business-and-finance.bso' },
);
expect(warnSpy).toHaveBeenCalledWith(
'Challenge Verification Failed:',
expect.objectContaining({ challengeSuccess: false }),
'Publication:',
expect.objectContaining({ subplebbitAddress: 'business-and-finance.bso' }),
expect.objectContaining({ communityAddress: 'business-and-finance.bso' }),
);
expect(alertMock).toHaveBeenCalledWith('Error from /biz/: invalid captcha try again later');
});
@@ -44,13 +44,13 @@ describe('challenge-utils', () => {
challengeErrors: ['first error', 'second error'],
challengeSuccess: false,
} as never,
{ subplebbitAddress: 'unknown-board.eth' },
{ communityAddress: 'unknown-board.eth' },
);
expect(alertMock).toHaveBeenCalledWith('Error from unknown-board.eth: first error second error');
});
it('uses communityAddress when the upgraded publication no longer exposes subplebbitAddress', () => {
it('uses communityAddress when the upgraded publication no longer exposes communityAddress', () => {
alertChallengeVerificationFailed(
{
challengeErrors: ['first error'],
@@ -76,7 +76,7 @@ describe('challenge-utils', () => {
});
it('logs successful challenge verification instead of alerting', () => {
alertChallengeVerificationFailed({ challengeSuccess: true } as never, { subplebbitAddress: 'business-and-finance.bso' });
alertChallengeVerificationFailed({ challengeSuccess: true } as never, { communityAddress: 'business-and-finance.bso' });
expect(logSpy).toHaveBeenCalledWith('Challenge verification succeeded:', expect.objectContaining({ challengeSuccess: true }));
expect(alertMock).not.toHaveBeenCalled();
@@ -72,18 +72,18 @@ describe('pattern-utils', () => {
it('matches roles with moderator aliases and rejects missing role metadata', () => {
const modComment = {
author: { address: 'author-1' },
subplebbitAddress: 'music-posting.eth',
communityAddress: 'music-posting.eth',
};
const ownerComment = {
author: { address: 'author-2' },
subplebbitAddress: 'music-posting.eth',
communityAddress: 'music-posting.eth',
};
expect(userHasRole(modComment as never, 'moderator')).toBe(true);
expect(userHasRole(modComment as never, 'mod')).toBe(true);
expect(userHasRole(ownerComment as never, 'owner')).toBe(true);
expect(userHasRole(ownerComment as never, 'admin')).toBe(false);
expect(userHasRole({ author: { address: 'missing' }, subplebbitAddress: 'unknown.eth' } as never, 'moderator')).toBe(false);
expect(userHasRole({ author: { address: 'missing' }, communityAddress: 'unknown.eth' } as never, 'moderator')).toBe(false);
});
it('parses mixed special filters and content filters', () => {
@@ -109,7 +109,7 @@ describe('pattern-utils', () => {
shortAddress: 'auth1',
},
content: 'That feel when the girlfriend texts back',
subplebbitAddress: 'music-posting.eth',
communityAddress: 'music-posting.eth',
title: 'TFW',
};
@@ -14,13 +14,13 @@ describe('post-page-resolution', () => {
it('only accepts strict board feed options for the active single-board feed', () => {
const baseOptions = {
sortType: 'active',
subplebbitAddresses: ['music.eth'],
communityAddresses: ['music.eth'],
};
expect(isBoardFeedOptions(baseOptions, 'music.eth')).toBe(true);
expect(isBoardFeedOptions({ ...baseOptions, sortType: 'new' }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, subplebbitAddresses: ['music.eth', 'tech.eth'] }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, subplebbitAddresses: ['tech.eth'] }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, communityAddresses: ['music.eth', 'tech.eth'] }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, communityAddresses: ['tech.eth'] }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, filter: { title: 'test' } }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, newerThan: 3600 }, 'music.eth')).toBe(false);
expect(isBoardFeedOptions({ ...baseOptions, modQueue: true }, 'music.eth')).toBe(false);
@@ -31,16 +31,16 @@ describe('post-page-resolution', () => {
const feedsOptions = {
allFeed: {
sortType: 'active',
subplebbitAddresses: ['all.eth'],
communityAddresses: ['all.eth'],
},
catalogFilterFeed: {
filter: { title: 'match' },
sortType: 'active',
subplebbitAddresses: ['music.eth'],
communityAddresses: ['music.eth'],
},
boardFeed: {
sortType: 'active',
subplebbitAddresses: ['music.eth'],
communityAddresses: ['music.eth'],
},
};
const loadedFeeds = {
@@ -6,7 +6,7 @@ const createReply = (overrides: Partial<Comment> = {}) =>
({
cid: 'reply-cid',
parentCid: 'target-cid',
subplebbitAddress: 'music.eth',
communityAddress: 'music.eth',
...overrides,
}) as Comment;
+4 -4
View File
@@ -6,7 +6,7 @@ import {
getFeedCacheKey,
getFeedType,
getPageFromFeedPath,
getSubplebbitAddress,
getCommunityAddress,
isArchiveRoute,
isBoardModRoute,
isDirectoryBoard,
@@ -44,9 +44,9 @@ describe('directory mapping helpers', () => {
expect(getBoardPath('12D3KooWQdQ6TkVA1Xe9zzaFP6vXBgsLeMAewpLpLwbsAYKivnQy', communities)).toBe('mu');
expect(getBoardPath('unknown.example', communities)).toBe('unknown.example');
expect(getSubplebbitAddress('biz', communities)).toBe('business.eth');
expect(getSubplebbitAddress('b', communities)).toBe('random.eth');
expect(getSubplebbitAddress('unknown.example', communities)).toBe('unknown.example');
expect(getCommunityAddress('biz', communities)).toBe('business.eth');
expect(getCommunityAddress('b', communities)).toBe('random.eth');
expect(getCommunityAddress('unknown.example', communities)).toBe('unknown.example');
});
it('compares aliases and directory identifiers correctly', () => {
+2 -2
View File
@@ -38,9 +38,9 @@ describe('view-utils', () => {
expect(isSettingsView('/music.eth/thread/cid-123/settings', params)).toBe(true);
});
it('supports deprecated subplebbitAddress params and marks unknown routes as not found', () => {
it('supports emoji board identifiers and marks unknown routes as not found', () => {
const params = {
subplebbitAddress: 'emoji-🎵.eth',
boardIdentifier: 'emoji-🎵.eth',
commentCid: 'cid-123',
};