-
Notifications
You must be signed in to change notification settings - Fork 981
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
178b875
feat: Add user mentions to incident comments with Quill editor integrβ¦
hemangsk 262bff5
Merge branch 'main' into hmg/tag
talboren 1da28cc
chore: merge migration heads
skynetigor fb79e17
fix: update migration head
Kiryous ccf545e
fix: proper quill-mention import and styles polish
Kiryous 2ebe419
refactor: Implement fixes suggested by greptile
hemangsk 96b35b5
refactor: Use IncidentActivity type in IncidentActivityItem()
hemangsk c2ca497
refactor: Fix tests for incident comment
hemangsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
keep-ui/app/(keep)/incidents/[id]/activity/lib/extractTaggedUsers.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Extracts tagged user IDs from Quill editor content | ||
* This is called when a comment is submitted to get the final list of mentions | ||
* | ||
* @param content - HTML content from the Quill editor | ||
* @returns Array of user IDs that were mentioned in the content | ||
*/ | ||
export function extractTaggedUsers(content: string): string[] { | ||
const mentionRegex = /data-id="([^"]+)"/g; | ||
const ids = Array.from(content.matchAll(mentionRegex)).map(match => match[1]) || []; | ||
return ids; | ||
} |
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
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
17 changes: 17 additions & 0 deletions
17
keep-ui/app/(keep)/incidents/[id]/activity/ui/IncidentCommentInput.dynamic.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import dynamic from "next/dynamic"; | ||
|
||
const IncidentCommentInput = dynamic( | ||
() => | ||
import("./IncidentCommentInput").then((mod) => mod.IncidentCommentInput), | ||
{ | ||
ssr: false, | ||
// mimic the quill editor while loading | ||
loading: () => ( | ||
<div className="w-full h-11 px-[11px] py-[16px] leading-[1.42] text-tremor-default font-[Helvetica,Arial,sans-serif] text-[#0009] italic"> | ||
Add a comment... | ||
</div> | ||
), | ||
} | ||
); | ||
|
||
export { IncidentCommentInput }; |
50 changes: 50 additions & 0 deletions
50
keep-ui/app/(keep)/incidents/[id]/activity/ui/IncidentCommentInput.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.incident-comment-input .ql-container { | ||
@apply text-tremor-default; | ||
} | ||
|
||
.mention { | ||
background-color: #e8f4fe; | ||
border-radius: 4px; | ||
padding: 0 2px; | ||
color: #0366d6; | ||
} | ||
|
||
.mention-container { | ||
display: block !important; | ||
position: absolute !important; | ||
background-color: white; | ||
border: 1px solid #ddd; | ||
border-radius: 4px; | ||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); | ||
z-index: 9999 !important; | ||
max-height: 100%; | ||
overflow-y: auto; | ||
padding: 5px 0; | ||
min-width: 180px; | ||
} | ||
|
||
.mention-list { | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.mention-item { | ||
display: block; | ||
padding: 8px 12px; | ||
cursor: pointer; | ||
color: #333; | ||
} | ||
|
||
.mention-item:hover { | ||
background-color: #f0f0f0; | ||
} | ||
|
||
.mention-item.selected { | ||
background-color: #e8f4fe; | ||
} | ||
|
||
/* Prevent hidden overflow that could hide the dropdown */ | ||
.ql-editor p { | ||
overflow: visible; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.