Comments: hide avatars when the site turns them off

未关闭
#26,413 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ios, swift
领域
frontend, mobile

调研方向

Start with CommentAvatarView, CommentListItem, CommentDetail, and the detail header in the WordPressComments screens; the issue describes the draft’s proposed CommentAvatar value and its .hidden and .image(URL?) cases. Check how the avatar view handles a missing author_avatar_urls map versus a map without a 96px address. Done means no avatar is drawn when the map is missing, while the grey circle remains when the map exists without that address.

由索引模型根据 Issue 内容生成。

描述

[Type] Bug Comments

From Claude:

When a self-hosted site turns off Settings → Discussion → Show Avatars, the new comments screens show an empty grey circle for every commenter, where the site owner asked for no avatars at all.

What happens

WordPress leaves author_avatar_urls out of every comment in the REST API while "Show Avatars" is off. It only adds the field to the comments schema when the show_avatars option is on (class-wp-rest-comments-controller.php, get_item_schema()).

Until wordpress-rs 0.9.1, that made the whole comment response fail to parse, so those sites showed no comments. wordpress-rs trunk makes author_avatar_urls optional (Automattic/wordpress-rs#1664), and #26393 adopts it. Comments now load, but the avatar address is nil, and CommentAvatarView draws its placeholder: a plain grey circle.

Who is affected

Anyone viewing comments in the WordPressComments screens (comment list and comment detail) for a site with "Show Avatars" off.

Suggested fix

Treat a missing author_avatar_urls as "avatars are off" and draw no avatar, while keeping the grey circle when the map is there but has no 96px address (the site shows avatars, this author has none to show).

The missing map is a reliable signal. /wp/v2/settings doesn't expose show_avatars, so there's no other way to read the setting. The one exception is a request that uses _fields and leaves author_avatar_urls out; the app doesn't make one today.

A draft is on jkmassel/hide-comment-avatars-when-off, stacked on #26393: a CommentAvatar value (.hidden or .image(URL?)) replaces avatarURL in CommentListItem, CommentDetail and the detail header.

Not covered

The older UIKit comment screens fall back to a Gravatar looked up from the commenter's email when there's no avatar address, which also ignores the setting. That predates #26393 and isn't changed by the draft.

主要语言
Swift
星标
3.9k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
136

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wordpress-mobile/WordPress-iOS 的其他 Issue

查看 wordpress-mobile/WordPress-iOS 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。