Skip to content

fix(notifications): respect showContactPicture setting for notification avatars#10786

Merged
rafaeltonholo merged 1 commit intothunderbird:mainfrom
mvanhorn:fix/notification-avatar-setting
May 6, 2026
Merged

fix(notifications): respect showContactPicture setting for notification avatars#10786
rafaeltonholo merged 1 commit intothunderbird:mainfrom
mvanhorn:fix/notification-avatar-setting

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 3, 2026

Summary

When contact pictures are disabled in the message list settings, notification avatars are still shown. This checks the isShowContactPicture preference before loading contact avatars for new mail notifications.

Why this matters

PR #9652 added avatar support to notifications but didn't check the existing contact picture visibility setting. Users who disable contact pictures in the message list expect notifications to also respect that preference.

Changes

  • SingleMessageNotificationCreator.kt: Added MessageListPreferencesManager as a constructor dependency and an early return in setAvatar() when isShowContactPicture is false (line 68)
  • CoreNotificationKoinModule.kt: Injected messageListPreferencesManager into SingleMessageNotificationCreator

Testing

  • Verified the preference check reads from the same showContactPicture key used by the message list UI (MessageViewHolder.kt:63)
  • When isShowContactPicture is false, setAvatar() returns without loading or setting the large icon
  • When isShowContactPicture is true (default), behavior is unchanged

Fixes #10750

This contribution was developed with AI assistance (Claude Code).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

Missing report label. Set exactly one of: report: include, report: exclude OR report: highlight.

@rafaeltonholo rafaeltonholo added merge block: soft freeze PR to main is blocked: risky code or feature flag enablement must wait until soft freeze lifts. report: include Include changes in user-facing reports. labels Apr 6, 2026
@wmontwe wmontwe removed the merge block: soft freeze PR to main is blocked: risky code or feature flag enablement must wait until soft freeze lifts. label Apr 10, 2026
Copy link
Copy Markdown
Member

@rafaeltonholo rafaeltonholo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mvanhorn,

Thank you for taking the time to work on this PR.

While your current change allows users to enable or disable the Avatar in notifications, the configuration you're using is incorrect.

The MessageListPreferencesManager is meant for the Message List screen, not for Notifications. There may be instances where users prefer not to have Avatars displayed in notifications but still want to see them in the Message List, and vice versa.

To properly address issue #10750, we should add a new user preference under NotificationPreference. This would allow users to disable Avatars specifically for notifications.

For reference, you can look at commit 8dfa32e, which demonstrates how to add a new Boolean preference using the NotificationPreferenceManager.

Thank you!

@mvanhorn mvanhorn force-pushed the fix/notification-avatar-setting branch from 3e12625 to d847439 Compare April 29, 2026 14:57
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Thanks for the review, @rafaeltonholo. Reworked this in d847439 to use a dedicated NotificationPreference value instead of the message-list contact picture preference.

Changes:

  • Added isShowContactPictureInNotification to NotificationPreference (defaults to true to preserve current behavior).
  • Persisted via KEY_SHOW_CONTACT_PICTURE_IN_NOTIFICATION in DefaultNotificationPreferenceManager.
  • SingleMessageNotificationCreator.setAvatar() now reads from NotificationPreferenceManager instead of MessageListPreferencesManager.
  • Added a separate "Show contact pictures in notifications" toggle in general settings, alongside the existing notification preferences.
  • Pattern mirrors commit 8dfa32e you referenced.
  • Added focused unit coverage (SingleMessageNotificationCreatorTest) for both branches of the new preference.

Force-pushed to replace the original commit since the underlying approach changed.

Copy link
Copy Markdown
Member

@rafaeltonholo rafaeltonholo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please, just update your branch with the latest main version, so we can get rid of the CI failure.

Closes thunderbird#10750.

Per @rafaeltonholo's review: MessageListPreferencesManager controls
avatars on the message list, not in notifications. A user may want
avatars in one place but not the other.

Adds a new isShowContactPictureInNotification field on
NotificationPreference, persists it via NotificationPreferenceManager,
and reads it from SingleMessageNotificationCreator.setAvatar(). Adds a
matching toggle in general settings.

Defaults to true to preserve current behavior. Pattern mirrors commit
8dfa32e.
@mvanhorn mvanhorn force-pushed the fix/notification-avatar-setting branch from d847439 to 172694b Compare May 6, 2026 16:50
@mvanhorn
Copy link
Copy Markdown
Contributor Author

mvanhorn commented May 6, 2026

Thanks for the approval @rafaeltonholo. Rebased onto current main (172694b on top of fb1baad) and force-pushed. The diff is unchanged.

The require-report-label check is gated on a report: include/report: exclude/report: highlight label that I can't add as a non-maintainer; if you can drop one of those on the PR I think the rest of the gate clears.

@rafaeltonholo
Copy link
Copy Markdown
Member

rafaeltonholo commented May 6, 2026

Thanks for the approval @rafaeltonholo. Rebased onto current main (172694b on top of fb1baad) and force-pushed. The diff is unchanged.

The require-report-label check is gated on a report: include/report: exclude/report: highlight label that I can't add as a non-maintainer; if you can drop one of those on the PR I think the rest of the gate clears.

I've placed the label already; you should be good now. Once the CI finishes, we can merge these changes! Thanks for this contribution!

@rafaeltonholo rafaeltonholo merged commit 280f073 into thunderbird:main May 6, 2026
16 checks passed
@thunderbird-botmobile
Copy link
Copy Markdown
Contributor

Thanks for your contribution! Your pull request has been merged and will be part of Thunderbird 20. We appreciate the time and effort you put into improving Thunderbird. If you haven’t already, you’re welcome to join our Matrix chat for contributors. It’s where we discuss development and help each other out. https://matrix.to/#/#tb-android-dev:mozilla.org
Hope to see you there! 🚀📱🐦

@thunderbird-botmobile thunderbird-botmobile Bot added this to the Thunderbird 20 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

report: include Include changes in user-facing reports.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Mail notification: disable avatar

3 participants