🤔   Create quick action for adding internal comments
Summary
Using comment templates are an awesome productivity boost, however there are times that I need to make sure I'm posting a comment as an internal note and currently, there is no way to include that action on comment templates.
Proposal
Create a quick action to add to comments to make the comment an internal note.
Based on the issue and the bot comment requesting an implementation guide, here's a comprehensive implementation plan for creating a quick action to add internal comments:
Implementation Guide
Overview
This feature will add a new quick action (e.g., /internal) that can be used in comment templates to automatically mark comments as internal notes.
Technical Implementation Steps
1. Backend Changes
Quick Action Definition
- Add a new quick action in lib/gitlab/quick_actions/issue_actions.rbandlib/gitlab/quick_actions/merge_request_actions.rb
- Define the /internalcommand similar to existing quick actions
- Location: Look at existing quick actions like /confidentialfor reference patterns
Key files to modify:
- lib/gitlab/quick_actions/issue_actions.rb
- lib/gitlab/quick_actions/merge_request_actions.rb
- 
lib/gitlab/quick_actions/common_actions.rb(if applicable to both)
Implementation pattern:
desc 'Mark comment as internal note'
explanation 'Mark comment as internal note'
types Issue, MergeRequest
condition do
  current_user.can?(:set_note_metadata, quick_action_target)
end
command :internal do
  @updates[:internal] = true
end2. Note Processing Logic
Modify note creation services:
- Update Notes::CreateServiceto handle the internal flag from quick actions
- Ensure the internal attribute is properly set when processing quick actions
- Location: app/services/notes/create_service.rb
3. Frontend Integration
Comment form updates:
- Ensure the comment form can handle the internal flag from quick actions
- Update JavaScript handling for quick action processing
- Location: app/assets/javascripts/notes/directory
4. Database Considerations
The notes table already has an internal column, so no database migrations are needed.
5. Testing Requirements
Unit Tests:
- Test quick action parsing and execution
- Test note creation with internal flag
- Location: spec/lib/gitlab/quick_actions/
Integration Tests:
- Test full workflow from comment submission to internal note creation
- Test with comment templates
- Location: spec/features/notes/orspec/requests/notes/
Test scenarios to cover:
- Quick action works in issues and merge requests
- Permissions are properly checked
- Quick action works within comment templates
- Internal notes are properly marked and displayed
6. Documentation Updates
- Update quick actions documentation
- Add examples showing usage with comment templates
- Location: doc/user/project/quick_actions.md
Similar Code Patterns to Reference
Look at these existing quick actions for implementation patterns:
- 
/confidential- Similar permission-based action
- 
/assign- Shows parameter handling
- 
/label- Shows metadata modification
Breaking Down the Work
- Phase 1: Implement basic quick action backend logic
- Phase 2: Integrate with note creation service
- Phase 3: Add comprehensive testing
- Phase 4: Update documentation
Potential Edge Cases
- Ensure quick action works with existing comment templates
- Handle permission checks properly
- Consider interaction with other quick actions in the same comment
This implementation should provide the functionality to use /internal in comment templates to automatically create internal notes, addressing the productivity need described in the issue.