feat: @ 提及適配論壇 atplus 插件 - #147
Conversation
…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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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)) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 👍 / 👎.
修改內容
論壇把 @ 功能換成 atplus 插件後,伺服器只認「@ + U+2063 + 用戶名 + U+2063」這種由網頁 @ 面板插入的格式,App 送出的純
@用戶名變成普通文字,對方收不到提醒。toOfficialMentions)。op=init取「最近 @ 過」與好友,輸入時用op=search搜全站用戶(用戶名或 UID)。論壇沒有插件或插件沒回應時,退回原本的好友頁與 getatuser 名單。測試結果
flutter test1781 通過、1 略過;analyze 80(=基線);嚴格分析通過。尚未驗證
🤖 Generated with Claude Code