Skip to content

feat(community): restore legacy community feed UI parity (banner + pane + dialogs) - #4072

Merged
ety001 merged 1 commit into
nextfrom
feat/community-page-parity
Nov 12, 2026
Merged

ety001 merged 1 commit into
nextfrom
feat/community-page-parity

Conversation

@ety001

@ety001 ety001 commented Nov 12, 2026

Copy link
Copy Markdown
Member

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 + 共享 communities generation scope);getCommunityNotifications()
  • 新路由 /api/steem/community(hive-* 校验、不存在 404)与 /api/steem/community-notifications(公开、仅接受 hive-* 名称——底层 RPC 本就公开,N-14 门控针对的是按用户账户的 oracle,hive-* 非用户账户,理由自洽)
  • lib/community.ts: legacy utils/Community.js 成对移植(Role/canPost/canComment 特判原样保留)+ ifHive + viewerRole/viewerSubscribed(hivemind 匿名时 context 为空对象/数组的防御默认)
  • types/steem.ts: canonical Community 类型(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 Log
  • CommunityPane(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/PostSummary hideCategory:社区 feed 隐藏卡片 "in #tag •" 前缀(legacy hideCategory={!!community})
  • 社区空状态文案(created/payout 两变体,字面 "community" 一词)
  • document.title = 社区标题(legacy SSR page_title 的最小对齐)
  • submit 页拆为 server wrapper(await searchParams)+ client body,/submit?category= 预填生效且无需 Suspense 边界

Test plan

  • 新增 4 个测试文件(lib/community、两个 API 路由、CommunityBanner),更新 FeedSidebarWidgets / sort-tag-page 既有用例(共 57 个相关用例)
  • pnpm lint:0 errors / 7 warnings(存量不变)
  • pnpm test:92 files / 1171 tests 全绿
  • dev 冒烟:/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 均 200
  • 视觉对照:部署后与 https://steemit.com/created/hive-166405 逐项核对(本会话无浏览器工具,请 reviewer 验证)

Out of scope(后续任务)

  • CommunitySettings 编辑器(admin 的 Settings 弹窗)与所有角色编辑 UI
  • PostFull 的 community 上下文(muted 投票行为)、编辑器内 PostCategoryBanner

…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.
@ety001
ety001 merged commit b792896 into next Nov 12, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant