Skip to content

Commit

Permalink
Fix swapped strict_match check and wrong approval access
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasstoffers committed Dec 22, 2023
1 parent 227d01d commit 29f12f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/services/gitlab/events/comment/comment_event_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def __is_command_invocation(self, event: CommentEvent, command: Command):
message = message.lower()

if command.strict_match:
return keyword in message
return keyword == message
return keyword == message
return keyword in message

def __handle_merge_comment(self, event: CommentEvent):
if event.merge_request is None:
Expand Down
2 changes: 1 addition & 1 deletion src/services/gitlab/gitlab_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_merge_request(self, project_id: int, merge_request_iid: int) -> ProjectM
def is_merge_request_approved_by(self, merge_request: ProjectMergeRequest, username: str) -> bool:
approvals: ProjectMergeRequestApproval = merge_request.approvals.get()
for approval in approvals.attributes["approved_by"]:
if approval.user is not None and approval.user.username == username:
if approval['user']['username'] == username:
return True
return False

Expand Down

0 comments on commit 29f12f9

Please sign in to comment.