Skip to content

feat: Add user mention functionality to incident comments #4649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hemangsk
Copy link

@hemangsk hemangsk commented Apr 29, 2025

Added proper support for @mentions in incident comments. Created a dedicated CommentMention model with relationships to AlertAudit.

Closes #2187

📑 Description

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Screenshot 2025-04-29 at 5 19 10 PM

/claim #2187

Copy link

vercel bot commented Apr 29, 2025

@hemangsk is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 29, 2025
@CLAassistant
Copy link

CLAassistant commented Apr 29, 2025

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added the Feature A new feature label Apr 29, 2025
@hemangsk hemangsk force-pushed the hmg/tag branch 2 times, most recently from d2bdd19 to 8c758a1 Compare April 29, 2025 12:12
@hemangsk
Copy link
Author

hemangsk commented May 1, 2025

@talboren @shahargl , could you please take a look if this fulfils the requirements? Let me know if there are any changes required to the approach. I'm working on tests atm.

@talboren
Copy link
Member

talboren commented May 1, 2025

@greptile

@talboren
Copy link
Member

talboren commented May 1, 2025

@Kiryous may I ask your help with reviewing the UI part here? 🙏🏼

@talboren
Copy link
Member

talboren commented May 1, 2025

@talboren @shahargl , could you please take a look if this fulfils the requirements? Let me know if there are any changes required to the approach. I'm working on tests atm.

The functionality looks great! I'm just wondering if it's not a bit complex under the hood. Let me review a bit further.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added user mention functionality to incident comments, including a new CommentMention table and UI components for handling @mentions in the activity feed.

  • Added new CommentMention table with proper indexes and foreign key constraints in /keep/api/models/db/migrations/2025-04-29-15-21_1b12e6d6ad1f.py
  • Implemented mention dropdown UI with keyboard navigation in /keep-ui/app/(keep)/incidents/[id]/activity/ui/IncidentActivityComment.tsx
  • Added mention highlighting and user data fetching in /keep-ui/app/(keep)/incidents/[id]/activity/ui/IncidentActivityItem.tsx
  • Modified /keep/api/routes/incidents.py to handle tagged users in comments with proper transaction management
  • Added CommentMentionDto interface and updated AuditEvent type in /keep-ui/entities/alerts/model/types.ts

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

9 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels May 2, 2025
@skynetigor
Copy link
Contributor

Hey!
Quick question — since we’re already using ReactQuill, could we integrate quill-mention to handle mentions instead of building a custom input from scratch?
It seems like a lighter approach, given that Quill is already part of our stack.

@hemangsk
Copy link
Author

hemangsk commented May 6, 2025

@skynetigor Thanks for the review! I'll get right on it

@hemangsk hemangsk force-pushed the hmg/tag branch 4 times, most recently from 1ea6e5a to c8507ad Compare May 6, 2025 19:42
@hemangsk
Copy link
Author

hemangsk commented May 6, 2025

@skynetigor , I've updated the MR with quill-mention package and here's the comment box in action.

Screenshot 2025-05-07 at 3 27 59 AM

}: IncidentCommentInputProps) {
const [mentionModuleReady, setMentionModuleReady] = useState(false);

useEffect(() => {
Copy link
Author

Choose a reason for hiding this comment

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

@skynetigor , I had to resort to some script tag voodoo to get quill-mention working. Regular imports were just throwing "Cannot resolve module" errors no matter what I tried. What worked is.. Manually adding the script onto the DOM, setting window.Quill first and then the loading order.

@hemangsk
Copy link
Author

hemangsk commented May 6, 2025

I've done all the requested changes. PTAL

@skynetigor
Copy link
Contributor

@hemangsk could you please record a video how it works and attach to the PR?

@hemangsk
Copy link
Author

@skynetigor Here's a screengrab of the feature:

Screen.Recording.2025-05-13.at.12.10.25.AM.mov

@hemangsk
Copy link
Author

@skynetigor , Here's a screenrecording after the quill-mention integration (the last video was of original implementation without quill mention):

quillmention.mov

Copy link
Contributor

@Kiryous Kiryous left a comment

Choose a reason for hiding this comment

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

Please check the comment on quill-mention.js lib

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushing a minified version of the lib to public is not a sustainable way forward. Let's handle it the proper way, I can help resolve issues if any with bundler.

Copy link
Author

Choose a reason for hiding this comment

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

@Kiryous Agreed, The problem right now is that after installing quill-mention via npm

npm i quill-mention --save

When I try to use it with :

import "quill-mention/autoregister";

or

import {Mention, MentionBlot} from "quill-mention";

Quill.register({ "blots/mention": MentionBlot, "modules/mention": Mention });

The application fails to compile with the error Module not found: Can't resolve 'quill-mention/autoregister', and I can confirm that autoregister definitely exists in node_modules folder.

Copy link
Author

Choose a reason for hiding this comment

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

@Kiryous I've described the issue above, it'll be really great if you could provide some help or direction on how to resolve it. A straightforward npm installation and import of quill-mention is not working atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Bounty claim Feature A new feature size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🔨 Enhancement]: Allow tagging in Incident comment
5 participants