[MM-59361] custom groups & read only channels (#28892)

* added group mention, read only view and post event tracking

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Guillermo Vayá
2024-10-28 13:41:29 +01:00
коммит произвёл GitHub
родитель c64215f6c2
Коммит a532b70317
13 изменённых файлов: 309 добавлений и 12 удалений

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

@@ -1585,7 +1585,7 @@ func (a *App) addUserToChannel(c request.CTX, user *model.User, channel *model.C
a.Srv().telemetryService.SendTelemetryForFeature(
telemetry.TrackGuestFeature,
"add_guest_to_channel",
map[string]any{"user_actual_id": user.Id})
map[string]any{telemetry.TrackPropertyUser: user.Id})
}
a.Srv().Platform().InvalidateChannelCacheForUser(user.Id)
@@ -2663,10 +2663,12 @@ func (a *App) SetActiveChannel(c request.CTX, userID string, channelID string) *
oldStatus := model.StatusOffline
oldChannelID := ""
if err != nil {
status = &model.Status{UserId: userID, Status: model.StatusOnline, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: channelID}
} else {
oldStatus = status.Status
oldChannelID = status.ActiveChannel
status.ActiveChannel = channelID
if !status.Manual && channelID != "" {
status.Status = model.StatusOnline
@@ -2680,6 +2682,24 @@ func (a *App) SetActiveChannel(c request.CTX, userID string, channelID string) *
a.Srv().Platform().BroadcastStatus(status)
}
if channelID != "" && oldChannelID != channelID {
// is this a read-only channel?
isReadOnly, ircErr := a.Srv().Store().Channel().IsReadOnlyChannel(channelID)
if ircErr != nil {
mlog.Warn("Error trying to check if it is a readonly channel", mlog.Err(ircErr))
}
if isReadOnly {
a.Srv().telemetryService.SendTelemetryForFeature(
telemetry.TrackReadOnlyFeature,
"read_only_channel_viewed",
map[string]any{
telemetry.TrackPropertyUser: userID,
telemetry.TrackPropertyChannel: channelID,
},
)
}
}
return nil
}