MM-59360 add telemetry for paid features related to guests (#28295)

* add telemetry for paid features related to guests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Guillermo Vayá
2024-10-07 13:30:19 +02:00
коммит произвёл GitHub
родитель 18388a8c64
Коммит 662e59865c
4 изменённых файлов: 126 добавлений и 22 удалений

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

@@ -13,6 +13,7 @@ import (
"strings"
"github.com/mattermost/mattermost/server/v8/channels/utils"
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
@@ -1568,6 +1569,13 @@ func (a *App) addUserToChannel(c request.CTX, user *model.User, channel *model.C
return nil, model.NewAppError("AddUserToChannel", "app.channel_member_history.log_join_event.internal_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
}
if user.IsGuest() {
a.Srv().telemetryService.SendTelemetryForFeature(
telemetry.TrackGuestFeature,
"add_guest_to_channel",
map[string]any{"user_actual_id": user.Id})
}
a.Srv().Platform().InvalidateChannelCacheForUser(user.Id)
a.invalidateCacheForChannelMembers(channel.Id)

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

@@ -19,6 +19,7 @@ import (
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/v8/channels/store"
"github.com/mattermost/mattermost/server/v8/platform/services/telemetry"
)
func (a *App) canSendPushNotifications() bool {
@@ -877,6 +878,27 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea
mlog.String("post_id", post.Id),
)
for id, reason := range mentions.Mentions {
user, ok := profileMap[id]
if !ok {
continue
}
if user.IsGuest() {
if reason == KeywordMention {
a.Srv().telemetryService.SendTelemetryForFeature(
telemetry.TrackGuestFeature,
"post_mentioned_guest",
map[string]any{"user_actual_id": user.Id, "post_owner_id": sender.Id},
)
} else if reason == DMMention {
a.Srv().telemetryService.SendTelemetryForFeature(
telemetry.TrackGuestFeature,
"direct_message_to_guest",
map[string]any{"user_actual_id": user.Id, "post_owner_id": sender.Id},
)
}
}
}
return mentionedUsersList, nil
}