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'
  • Loading branch information
Kshitij-Katiyar committed Aug 20, 2024
1 parent f1ec0c9 commit 27f979f
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 @@ -639,10 +639,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 27f979f

Please sign in to comment.