Fix /share-channel slash command failing on non-leader HA nodes (#35292)

The Active() check was incorrectly preventing the slash command from working on non-leader nodes in HA clusters. Active() only returns true on the cluster leader (which runs the sync loop), but slash commands can be routed to any node via the load balancer. A nil check is sufficient to verify the service is licensed and configured.
This commit is contained in:
Doug Lauder 2026-02-16 03:49:49 -05:00 committed by GitHub
parent f3d73defcf
commit 944c345687
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,13 +127,14 @@ func (sp *ShareProvider) DoCommand(a *app.App, rctx request.CTX, args *model.Com
return response(args.T("api.command_share.permission_required", map[string]any{"Permission": "manage_shared_channels"}))
}
syncService := a.Srv().GetSharedChannelSyncService()
if syncService == nil || !syncService.Active() {
// Only check that the services are non-nil (licensed and configured). Do not check Active()
// here because Active() only returns true on the cluster leader node. In HA deployments,
// slash commands can be routed to any node via the load balancer, not just the leader.
if a.Srv().GetSharedChannelSyncService() == nil {
return response(args.T("api.command_share.service_disabled"))
}
rcService := a.Srv().GetRemoteClusterService()
if rcService == nil || !rcService.Active() {
if a.Srv().GetRemoteClusterService() == nil {
return response(args.T("api.command_remote.service_disabled"))
}