Integration with GitLab Ecosystem
Motivation:
This integration aims to provide a seamless experience for GitLab users who want to use GitLab Discussions to manage discussions related to their GitLab projects.
Features:
- Discussions:
- Creation: GitLab users can create new discussions from within the GitLab interface.
- Linking: Discussions can be linked to specific GitLab issues, merge requests, or other objects, allowing users to easily track related conversations.
- Notifications: Users receive notifications about new discussions, replies, and mentions.
- Synchronization:
- Data Synchronization: Data related to discussions, including comments, reactions, and users, is synchronized between GitLab and GitLab Discussions.
- Real-time Updates: Changes made to discussions in one platform are reflected in the other platform in real time.
Options:
Integration via API:
This option leverages the GitLab API to interact with GitLab Discussions.
Example: Creating a new discussion from GitLab:
{ "title": "New Discussion", "body": "This is the body of the discussion.", "project_id": 12345, "type": "Discussion" }
Source: GitLab API Documentation
Integration via Webhooks:
- This option uses webhooks to trigger events in GitLab Discussions when specific actions occur in GitLab.
- Example: Triggering a webhook when a new issue is created in GitLab:
{ "object_kind": "issue", "event_name": "issue_create", "project": { "id": 12345 }, "user": { "id": 67890 } }
- Source: GitLab Webhooks Documentation
Integration via GitLab UI:
- This option provides users with a dedicated interface within GitLab to access and manage discussions.
- Example: Adding a discussion to a merge request:
- Users can access the “Discussions” tab within the merge request page.
- They can then create new discussions or view existing ones.
- Source: GitLab UI Documentation
Code Files:
lib/gitlab/integration.rb
: Handles the integration with GitLab, including API calls and webhook processing.app/models/discussion.rb
: Represents a GitLab Discussion in the application.app/views/discussions/_discussion.html.erb
: Renders the discussion UI in GitLab.app/controllers/discussions_controller.rb
: Manages the display and manipulation of discussions in GitLab.