From 27f979fb2fbdb9a98e2d5acb590e97b62d5ff7c0 Mon Sep 17 00:00:00 2001 From: Kshitij Katiyar Date: Tue, 20 Aug 2024 15:50:33 +0530 Subject: [PATCH] [MM-517]: Fixed the issue #517 'Unable to subscribe to groups or subgroups' --- server/command.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/command.go b/server/command.go index 70394ec4..e151b0e8 100644 --- a/server/command.go +++ b/server/command.go @@ -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)