diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index da7bd40840..12bf86f161 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -960,7 +960,7 @@ func (s SqlChannelStore) getAllChannelsQuery(opts store.ChannelSearchOpts, forCo } if len(opts.ExcludeChannelNames) > 0 { - query = query.Where(fmt.Sprintf("c.Name NOT IN ('%s')", strings.Join(opts.ExcludeChannelNames, "', '"))) + query = query.Where(sq.NotEq{"c.Name": opts.ExcludeChannelNames}) } return query @@ -2265,7 +2265,7 @@ func (s SqlChannelStore) channelSearchQuery(term string, opts store.ChannelSearc } if len(opts.ExcludeChannelNames) > 0 { - query = query.Where(fmt.Sprintf("c.Name NOT IN ('%s')", strings.Join(opts.ExcludeChannelNames, "', '"))) + query = query.Where(sq.NotEq{"c.Name": opts.ExcludeChannelNames}) } if len(opts.NotAssociatedToGroup) > 0 {