Skip to content

feat: @ 提及適配論壇 atplus 插件 - #147

Merged
Carinoasd merged 1 commit into
masterfrom
feat/atplus-mention
Sep 30, 2026
Merged

Carinoasd merged 1 commit into
masterfrom
feat/atplus-mention

Conversation

@Carinoasd

Copy link
Copy Markdown
Owner

修改內容

論壇把 @ 功能換成 atplus 插件後,伺服器只認「@ + U+2063 + 用戶名 + U+2063」這種由網頁 @ 面板插入的格式,App 送出的純 @用戶名 變成普通文字,對方收不到提醒。

  • 送出格式改成跟網頁面板一樣的帶標記格式(toOfficialMentions)。
  • 選人面板先問插件:op=init 取「最近 @ 過」與好友,輸入時用 op=search 搜全站用戶(用戶名或 UID)。論壇沒有插件或插件沒回應時,退回原本的好友頁與 getatuser 名單。
  • 三語翻譯、CHANGELOG、spec §44。
  • 整組 @(U+2064)與 @ 名片暫不支援。

測試結果

  • 以測試帳號唯讀實測插件 API 的回應格式(init/search),fixture 用假資料。
  • test_022、test_049 更新為新格式;新增 atplus 群組:解析、插件優先且不問舊來源、訪客不問、cubit 搜尋、選人面板挑選全站搜尋結果。
  • 完整 flutter test 1781 通過、1 略過;analyze 80(=基線);嚴格分析通過。

尚未驗證

  • 沒有真的發出 @ 來確認對方收到提醒(會打擾到真實用戶);需要用兩個自己的帳號實測。

🤖 Generated with Claude Code

…s, search users through it

The forum replaced stock Discuz! mentions with the atplus plugin: the server
only turns "@" + U+2063 + username + U+2063 into a mention now, a bare "@name"
stays plain text, so mentions sent by the app no longer reached anyone.

- toOfficialMentions emits the marked form, like the web @ panel.
- The mention picker asks the plugin first (op=init: recently mentioned users
  and friends) and searches the whole site by name or uid (op=search); without
  the plugin it falls back to the friends pages and the getatuser list.
- Group mentions (U+2064) are not supported yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T00:04:42.930005Z fe278b6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe278b63d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

final k = state.keyword;
if (!state.siteSearch ||
k.isEmpty ||
(state.searchKeyword == k && state.searchStatus != UserMentionStatus.failure)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset abandoned searches before deduplicating keywords

When a user starts searching for a term, clears the field before the response arrives, waits for that response to be discarded at line 75, and then enters the same term again, searchKeyword still equals the term and searchStatus remains loading. This guard therefore suppresses the new request and leaves the site-search section showing a progress indicator indefinitely. Clearing the keyword should invalidate/reset the pending search state, or requests should use a generation token rather than this state-based deduplication.

Useful? React with 👍 / 👎.

/// Users of the whole site matching the keyword (`atplus`), shown only while a keyword is typed.
List<Widget> _searchSection(UserMentionState state) {
final tr = context.t.bbcodeEditor.userMention;
if (!state.siteSearch || state.keyword.isEmpty) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve UID searches before accepting keyboard submission

When site search is available and the user enters a UID, pressing the keyboard submit action still invokes the existing onSubmitted callback, which immediately pops the raw input as the selected username instead of waiting for or selecting the matching search result. The editor consequently inserts a marked mention such as @⁣1003⁣, although the atplus format requires the username returned for UID 1003, so the advertised UID-search flow can produce a nonfunctional mention unless the user explicitly taps the result row.

Useful? React with 👍 / 👎.

final name = m.group(1)!.trim();
final followedByWhitespace = m.end < bbcode.length && bbcode[m.end].trim().isEmpty;
return followedByWhitespace ? '@$name' : '@$name ';
final mention = '@$atplusUserMark$name$atplusUserMark';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the legacy send format when atplus is absent

When the atplus plugin is genuinely not installed or has been disabled, loadCandidates explicitly falls back to the stock friends and getatuser sources, but every selected chip is still unconditionally serialized with the atplus-only U+2063 markers here. Stock Discuz expects the previous bare @name form, so the documented no-plugin fallback presents valid candidates while posts made from them no longer generate mention notifications. The selected output format therefore needs to follow the detected plugin capability rather than always using the marked form.

Useful? React with 👍 / 👎.

@Carinoasd
Carinoasd merged commit 6a47830 into master Sep 30, 2026
9 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