fix: set textFormat to PlainText for notification title - #1749
Merged
deepin-bot[bot] merged 1 commit intoSep 22, 2026
Merged
deepin-bot[bot] merged 1 commit into
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a single QML property to prevent HTML-like notification titles from being rendered as styled links, while preserving link support in notification bodies and covering all views that reuse NotifyItemContent. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
|
这pr里不应该有两个提交, |
The notification title Text element in NotifyItemContent.qml did not set textFormat, so Qt defaulted to Text.AutoText which detects and renders HTML tags. When a notification summary contains HTML <a> tags, the title was rendered as a blue underlined link instead of plain text. Add textFormat: Text.PlainText to the title Text to ensure the title is always rendered as plain text, preventing HTML tag rendering. Log: fix notification title showing link style with HTML tags Bug: https://pms.uniontech.com/bug-view-377829.html Change-Id: IF3B5F7F293B005B5
robertkill
force-pushed
the
agent/pms-bug-bot/286c9fdd80e1
branch
from
September 22, 2026 07:21
0e50b87 to
3ef3361
Compare
18202781743
approved these changes
Sep 22, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, robertkill The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
|
/forcemerege |
Contributor
|
/forcemerge |
|
This pr force merged! (status: blocked) |
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.
Root Cause Analysis
The notification title
Textelement inNotifyItemContent.qmldid not settextFormat, so Qt defaulted toText.AutoTextmode, which automatically detects and renders HTML tags. When a notification summary contains HTML<a>tags, the title was rendered as a blue underlined link instead of plain text.Key evidence:
NotifyItemContent.qml:262— titleTextelement has notextFormatsetNotifyItemContent.qml:284-307— bodyTextelement deliberately supports links (linkColor,onLinkActivated,HoverHandler), confirming the title's lack oftextFormatis an omissionFix
Add
textFormat: Text.PlainTextto the titleTextelement inNotifyItemContent.qml, ensuring the title is always rendered as plain text without HTML parsing.Change Safety Assessment
Code Safety: Low risk. Only one QML property added (
textFormat: Text.PlainText), no existing logic modified, no function signatures changed, no new dependencies introduced.Business Impact: Notification titles (in banners and notification center) will no longer render HTML tags as link styles — they will display as plain text. Notification body text still supports links as designed. All notification views (Bubble, NormalNotify, OverlapNotify) share the
NotifyItemContentcomponent, so this one-line fix covers all scenarios.Regression Testing: Send a notification with
notify-send '<a href="https://example.com">test</a> title' "body"and verify the title displays as plain text without blue/underline styling.根因分析
通知标题
Text元素未设置textFormat,Qt 默认使用Text.AutoText模式,自动检测并渲染 HTML 标记。当通知标题包含 HTML<a>标签时,标题被渲染为蓝色下划线链接样式,而非纯文本。关键证据:
NotifyItemContent.qml:262— 标题Text元素未设置textFormatNotifyItemContent.qml:284-307— 正文Text元素刻意支持链接(linkColor、onLinkActivated、HoverHandler),佐证标题缺少textFormat是遗漏修复方案
在
NotifyItemContent.qml的标题Text元素中添加textFormat: Text.PlainText,使标题始终以纯文本形式渲染,不解析 HTML 标记。改动安全评估
代码安全:低风险。仅新增一个 QML 属性(
textFormat: Text.PlainText),不修改任何已有逻辑,不改变函数签名,不引入新依赖。业务影响范围:通知标题(横幅和通知中心)将不再将 HTML 标记渲染为链接样式,改为纯文本展示。通知正文仍保留链接支持。所有通知视图(Bubble、NormalNotify、OverlapNotify)共用
NotifyItemContent组件,一处修复覆盖全部场景。验证建议:使用
notify-send '<a href="https://example.com">test</a> title' "body"发送通知,验证标题以纯文本展示,无蓝色/下划线样式。Summary by Sourcery
Bug Fixes: