Skip to content

Commit

Permalink
[MM-517]: Fixed the issue #517 'Unable to subscribe to groups or subg…
Browse files Browse the repository at this point in the history
…roups' (#518)
  • Loading branch information
Kshitij-Katiyar authored Nov 29, 2024
1 parent 25b4802 commit 87c2865
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,13 @@ func (p *Plugin) subscriptionsAddCommand(ctx context.Context, info *gitlab.UserI
return err.Error()
}

if hasPermission := p.permissionToProject(ctx, info.UserID, namespace, project); !hasPermission {
msg := "You don't have the permissions to create subscriptions for this project."
p.client.Log.Warn(msg)
return msg
// Only check the permissions for a project if the project subscription is created (Not a group or a subgroup subscription)
if project != "" {
if hasPermission := p.permissionToProject(ctx, info.UserID, namespace, project); !hasPermission {
msg := "You don't have the permissions to create subscriptions for this project."
p.client.Log.Warn(msg)
return msg
}
}

updatedSubscriptions, subscribeErr := p.Subscribe(info, namespace, project, channelID, features)
Expand Down

0 comments on commit 87c2865

Please sign in to comment.