Repository navigation
feat(community): restore legacy community feed UI parity (banner + pane + dialogs) - #4072
Merged
Merged
Conversation
…ne + dialogs)
The /<sort>/hive-* feed pages were missing legacy's community chrome: the
sidebar pane approximated it with a list_communities search and the
CommunityBanner, leadership/rules modules and both dialogs did not exist.
Data layer:
- bridge.get_community wrapper (lib/steem/client.ts) with observer-gated
caching and the shared 'communities' generation scope; public
/api/steem/community route (hive-* validated, 404 for missing)
- /api/steem/community-notifications: public moderation-log endpoint
restricted to hive-* names so it cannot serve as a per-account
notifications oracle (keeps audit N-14 intact)
- Role/ifHive/viewerRole helpers ported from legacy utils/Community.js
UI (legacy CommunityBanner.jsx / CommunityPane.jsx / Dialogs.jsx):
- CommunityBanner: cover (settings -> profile fallback, safeCoverImageUrl +
proxy), avatar, title/about, Subscribe + New Post (Role.canPost gated,
/submit?category= prefill), subscribers/pending/posters stats with
legacy compact formatting, mod Edit:Roles link, nsfw badge
- CommunityPane: consumes a page-level CommunityProvider (single fetch
shared by banner and pane; cachedFetch does not dedupe concurrent cold
requests); leadership team (owner hidden), description, rules, language,
only-approved note, Edit Roles for mods; the previous simplified pane
(list_communities search + subscribe button) is gone
- GlobalModals: communitySubscribers + communityModerationLog dialogs via
the existing globalSlice dialog registry
Feed parity fixes:
- PostsList/PostSummary hideCategory: hide the 'in #tag' prefix on
community feeds (legacy hideCategory={!!community})
- community empty-state copy ('No posts in community yet!' / pending
variant) using the literal word like legacy
- document.title = community title (legacy SSR page_title)
- submit page split into server wrapper + client body so ?category=
prefill works without a useSearchParams Suspense boundary
Out of scope (follow-ups): CommunitySettings editor (admin) and role
editing UI anywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/<sort>/hive-*社区 feed 页此前缺少 legacy 的社区 UI:侧栏 pane 用list_communities(query=)搜索近似实现(拿不到 team/description/flag_text/settings),CommunityBanner、Leadership/Rules 模块与两个弹窗完全缺失。本 PR 以bridge.get_community为数据源成对移植 legacy 的CommunityBanner.jsx/CommunityPane.jsx/Dialogs.jsx,并修复审计中发现的其余 feed 差异。Changes
Data layer
lib/steem/client.ts:getCommunity()(observer 存在时绕过缓存,匿名走withCache+ 共享communitiesgeneration scope);getCommunityNotifications()/api/steem/community(hive-* 校验、不存在 404)与/api/steem/community-notifications(公开、仅接受 hive-* 名称——底层 RPC 本就公开,N-14 门控针对的是按用户账户的 oracle,hive-* 非用户账户,理由自洽)lib/community.ts: legacyutils/Community.js成对移植(Role/canPost/canComment 特判原样保留)+ifHive+viewerRole/viewerSubscribed(hivemind 匿名时context为空对象/数组的防御默认)types/steem.ts: canonicalCommunity类型(team 为元组数组)UI(legacy 对应组件 1:1)
CommunityBanner:封面(settings.cover_url → 社区账号 profile cover 回退,safeCoverImageUrl验证 + 代理)、头像、title/about、Subscribe + New Post(Role.canPost门控,未登录弹登录)、订阅数/$待奖励/活跃发帖人三项统计(<760px 紧凑格式)、mod 的 Edit:Roles、nsfw 徽章、Activity LogCommunityPane(FeedSidebarWidgets):改为消费页面级CommunityProvider(单次取数——cachedFetch 不去重并发冷请求);Leadership(隐藏 owner)、Description、Rules(nl2li)、Language、only-approved 提示、mod 的 Edit Roles;移除旧简化版及其 SubscribeButton(legacy pane 无)globalSlice既有showDialog/hideDialog注册communitySubscribers/communityModerationLog;Activity Log 因 notifications 路由会话门控(N-14)无法直接复用 NotificationsList,改走公开 community-notifications 路由的独立视图(含 hivemind 无前导斜杠 url 的修正;不移植 legacy 会错误广播的 mark-as-read)Feed parity fixes
PostsList/PostSummaryhideCategory:社区 feed 隐藏卡片 "in #tag •" 前缀(legacyhideCategory={!!community})document.title= 社区标题(legacy SSR page_title 的最小对齐)await searchParams)+ client body,/submit?category=预填生效且无需 Suspense 边界Test plan
pnpm lint:0 errors / 7 warnings(存量不变)pnpm test:92 files / 1171 tests 全绿/api/steem/community?name=hive-166405返回完整数据(team 元组、settings、context 两形态均验证);community-notifications返回真实 moderation log;非 hive 名 400;/created/hive-166405、/submit?category=hive-166405、/roles/hive-166405均 200Out of scope(后续任务)