Skip to content

Commit 7fd23d0

Browse files
committed
Add support for reviewer changes in merge requests
The merge request event webhook is called for reviwers updates, however this is ignored by the GitlabChanges class. Therefore these updates are not forwarded to Matrix. By adding the reviewers section to both the GitlabChanges and to the issue_update template (which is used for merge request updates) the bot reports about changes in reviewers.
1 parent 2cd6d88 commit 7fd23d0

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

gitlab_matrix/types.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ class GitlabAssigneeChanges(GitlabChangeWrapper, SerializableAttrs):
252252
current: List[GitlabUser]
253253

254254

255+
@dataclass
256+
class GitlabReviewersChanges(GitlabChangeWrapper, SerializableAttrs):
257+
previous: List[GitlabUser]
258+
current: List[GitlabUser]
259+
260+
255261
@dataclass
256262
class GitlabLabelChanges(GitlabChangeWrapper, SerializableAttrs):
257263
previous: List[GitlabLabel]
@@ -290,6 +296,7 @@ class GitlabChanges(SerializableAttrs):
290296
title: Optional[GitlabStringChange] = None
291297
labels: Optional[GitlabLabelChanges] = None
292298
assignees: Optional[GitlabAssigneeChanges] = None
299+
reviewers: Optional[GitlabReviewersChanges] = None
293300
time_estimate: Optional[GitlabIntChange] = None
294301
total_time_spent: Optional[GitlabIntChange] = None
295302
weight: Optional[GitlabIntChange] = None

templates/macros.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@
7373
{%- macro assignee_changes(added, removed) -%}
7474
{{ list_changes(added, removed, "assigned", "unassigned", user_link) }}
7575
{%- endmacro -%}
76+
{%- macro reviewers_changes(added, removed) -%}
77+
{{ list_changes(added, removed, "assigned", "unassigned", user_link) }}
78+
{%- endmacro -%}

templates/messages/issue_update.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
{% elif changes.assignees %}
1313
{{ assignee_changes(changes.assignees.added, changes.assignees.removed) }}
1414
{{ issue_or_merge_link(object_attributes) }}
15+
{% elif changes.reviewers %}
16+
{{ reviewers_changes(changes.reviewers.added, changes.reviewers.removed) }}
17+
{{ issue_or_merge_link(object_attributes) }}
1518
{% elif changes.time_estimate %}
1619
{% if not changes.time_estimate.current %}
1720
removed the time estimate of {{ issue_or_merge_link(object_attributes) }}

0 commit comments

Comments
 (0)