Skip to content

WIP: [POC] Create DB tables for storing mentioned users

Alexandru Croitor requested to merge 21800-mentioned-users-table-migrations into master

What does this MR do?

Creates DB tables for storing mentioned users, groups, projects referenced in a note(for issue, epic, merge requests, commit or snippet), issue, epic, merge request description issuable description

All 5 tables are very similar so I will take issue_user_mentions as an example. We would store all mentions for a given issue in this table by parsing issue description and issue notes.

  • issue_id - is always non null.
  • note_id - is only null if users, projects or groups were mentioned in issue description. We need note_id field mainly to be able to update mentions when note is being updated or deleted.
  • user_id - stores mentioned user ID.
  • project_id - stores mentioned project ID. It will get expanded to all project members when a new notification for given issue needs to be sent out.
  • group_id - stores mentioned group ID. It gets expanded to all group members when a new notification for the given issue needs to be sent out.

So for any given issue can have something like:

issue_id note_id user_id project_id group_id ----
1 null 1 null null
1 null 2 null null
1 null null 1 null
1 null null 2 null
1 null null null 1
1 null null null 2
1 1 1 null null
1 1 2 null null
1 1 null 1 null
1 1 null 2 null
1 1 null null 1
1 1 null null 2

Having this structure helps us easily get the list of directly mentioned users, list of mentioned projects which can then be joined with project members to get the list of users, as well as list of mentioned groups for one or multiple issues.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #21800 (closed)

Edited by Coung Ngo

Merge request reports

Loading