[MM-57356] Make use of go1.21 features (#26620)

Этот коммит содержится в:
Ben Schumacher
2024-04-04 13:44:03 +02:00
коммит произвёл GitHub
родитель 3c45c44cb1
Коммит 1e0de8f559
24 изменённых файлов: 59 добавлений и 507 удалений

Просмотреть файл

@@ -6,12 +6,12 @@ package platform
import (
"context"
"fmt"
"slices"
"github.com/pkg/errors"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/public/utils"
"github.com/mattermost/mattermost/server/v8/platform/services/sharedchannel"
)
@@ -59,7 +59,7 @@ func (ps *PlatformService) SharedChannelSyncHandler(event *model.WebSocketEvent)
func isEligibleForEvents(syncService SharedChannelServiceIFace, event *model.WebSocketEvent, events []model.WebsocketEventType) bool {
return syncServiceEnabled(syncService) &&
eventHasChannel(event) &&
utils.Contains(events, event.EventType())
slices.Contains(events, event.EventType())
}
func eventHasChannel(event *model.WebSocketEvent) bool {

Просмотреть файл

@@ -11,6 +11,7 @@ import (
"fmt"
"net"
"net/http"
"slices"
"strconv"
"strings"
"sync"
@@ -25,7 +26,6 @@ import (
"github.com/mattermost/mattermost/server/public/shared/i18n"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/public/utils"
)
const (
@@ -877,7 +877,7 @@ func (wc *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
// For typing events, we don't send them to users who don't have
// that channel or thread opened.
if wc.Platform.Config().FeatureFlags.WebSocketEventScope &&
utils.Contains([]model.WebsocketEventType{
slices.Contains([]model.WebsocketEventType{
model.WebsocketEventTyping,
model.WebsocketEventReactionAdded,
model.WebsocketEventReactionRemoved,