feat: click a user in the user list to prefill an @-mention in chat#19
Merged
JohnMcLear merged 1 commit intomainfrom May 3, 2026
Merged
feat: click a user in the user list to prefill an @-mention in chat#19JohnMcLear merged 1 commit intomainfrom
JohnMcLear merged 1 commit intomainfrom
Conversation
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
5 tasks
JohnMcLear
added a commit
that referenced
this pull request
May 2, 2026
…ndler PR #19 originally landed an entire user-list click handler inside ep_ai_chat. That logic was generic — clicking a user in the user list to prefill an @-mention is a discoverability win for any multi-user pad, AI or no AI — and as @JohnMcLear pointed out, it belongs in Etherpad core, not in this plugin. The generic feature is now ether/etherpad#7660. This commit shrinks ep_ai_chat's contribution to the only AI-specific bit: when the clicked author is the AI, override the default "@AI_Assistant " prefill with the configured trigger ("@ai " by default) so the input lands in a useful state. Implementation: - Drop the in-plugin click delegation, the chatbox/chaticon DOM poking, and the input-prefill logic. Core handles all of that uniformly now. - Add a chatPrefillFromUser client hook that returns the trigger string when the clicked authorId matches the AI's. The clientVars hook (added earlier in this PR) still exposes the trigger and authorId; nothing changes there. - On older cores the new hook is never fired, so this is a no-op on a stock install — graceful degradation. Net diff vs main is now: a tiny clientVars exposure on the server and a ~10-line client hook handler. Everything else is core's job.
…lay name
Override the default "@<name> " chat-input prefill with the configured
AI trigger ("@ai " by default) when a user clicks the AI's row in the
user list. Without this, clicking the AI chip would prefill
"@AI_Assistant ", which doesn't match anything the server-side mention
extractor recognises.
What this PR adds:
- clientVars server hook exposing { trigger, authorName, authorId } at
clientVars.ep_ai_chat so the client can recognise the AI's row.
- chatPrefillFromUser client hook that returns the trigger string when
the clicked authorId matches the AI's; otherwise returns nothing so
core's default ("@<name> ") wins.
- Mocha unit test (static/tests/backend/specs/chat_prefill.ts) covering
AI/non-AI/missing-clientVars/custom-trigger/missing-trigger paths.
Depends on ether/etherpad#7660 which adds the chatPrefillFromUser hook
to core. On older cores the hook is never fired and this PR is a
benign no-op — graceful degradation, no install requirement bump.
Originally this PR shipped the entire user-list click handler inside
the plugin. Per review feedback, the generic "click a user → prefill
@-mention" UX belongs in core (it's a discoverability win for any
multi-user pad, AI or no AI), so the bulk moved to ether/etherpad#7660
and this PR is now ~40 lines of glue.
(Replaces the previous 3-commit history on this branch with a clean
rebase against the new main, which absorbed PRs #18 and #20 since the
branch was opened.)
bf549f7 to
68cce00
Compare
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
Override the default
@<name>chat-input prefill with the configured AI trigger (@aiby default) when a user clicks the AI's row in the user list.This used to be a self-contained user-list click handler inside this plugin. Per review, the generic "click a user → prefill @-mention" behavior belongs in Etherpad core, since it's a discoverability win for any multi-user pad. That generic feature is now ether/etherpad#7660, which adds the
chatPrefillFromUserclient hook.This PR is now the small, AI-specific consumer of that hook.
Depends on
ether/etherpad#7660 — must merge first. On older cores this PR is a no-op (the hook is never fired).
What this PR does
clientVarsserver hook — exposes{ trigger, authorName, authorId }underclientVars.ep_ai_chat.chatPrefillFromUserclient hook — when the clicked authorId is the AI's, returns the trigger string. Otherwise returns nothing and core's default wins.~18 lines of glue.
Test plan (after #7660 merges)
@<name>.@ai.