MM-60331 - Scheduled post telemetry (#29132)
* Added scheduled posts telemetry * Tracking scheudled post creation via webapp to filter by platform * Fixed keys * Lint fix
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
65ed87bda0
Коммит
f812104a92
@@ -4,6 +4,10 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
import FormData from 'form-data';
|
||||
import {
|
||||
TrackPropertyUser,
|
||||
TrackPropertyUserAgent, TrackScheduledPostsFeature,
|
||||
} from 'mattermost-webapp/src/packages/mattermost-redux/src/constants/telemetry';
|
||||
|
||||
import type {ClusterInfo, AnalyticsRow, SchemaMigration, LogFilterQuery} from '@mattermost/types/admin';
|
||||
import type {AppBinding, AppCallRequest, AppCallResponse} from '@mattermost/types/apps';
|
||||
@@ -2174,7 +2178,7 @@ export default class Client4 {
|
||||
`${this.getPostsRoute()}`,
|
||||
{method: 'post', body: JSON.stringify(post)},
|
||||
);
|
||||
const analyticsData = {channel_id: result.channel_id, post_id: result.id, user_actual_id: result.user_id, root_id: result.root_id} as PostAnalytics;
|
||||
const analyticsData = {channel_id: result.channel_id, post_id: result.id, [TrackPropertyUser]: result.user_id, root_id: result.root_id} as PostAnalytics;
|
||||
if (post.metadata?.priority) {
|
||||
analyticsData.priority = post.metadata.priority.priority;
|
||||
analyticsData.requested_ack = post.metadata.priority.requested_ack;
|
||||
@@ -3885,7 +3889,7 @@ export default class Client4 {
|
||||
context: {
|
||||
...call.context,
|
||||
track_as_submit: trackAsSubmit,
|
||||
user_agent: 'webapp',
|
||||
[TrackPropertyUserAgent]: 'webapp',
|
||||
},
|
||||
};
|
||||
return this.doFetch<AppCallResponse>(
|
||||
@@ -3898,7 +3902,7 @@ export default class Client4 {
|
||||
const params = {
|
||||
channel_id: channelID,
|
||||
team_id: teamID,
|
||||
user_agent: 'webapp',
|
||||
[TrackPropertyUserAgent]: 'webapp',
|
||||
};
|
||||
|
||||
return this.doFetch<AppBinding[]>(
|
||||
@@ -4423,6 +4427,8 @@ export default class Client4 {
|
||||
|
||||
// Schedule Post methods
|
||||
createScheduledPost = (schedulePost: ScheduledPost, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'create_scheduled_post', {[TrackPropertyUser]: schedulePost.user_id, [TrackPropertyUserAgent]: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule`,
|
||||
{method: 'post', body: JSON.stringify(schedulePost), headers: {'Connection-Id': connectionId}},
|
||||
@@ -4438,13 +4444,17 @@ export default class Client4 {
|
||||
};
|
||||
|
||||
updateScheduledPost = (schedulePost: ScheduledPost, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'update_scheduled_post', {[TrackPropertyUser]: schedulePost.user_id, [TrackPropertyUserAgent]: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule/${schedulePost.id}`,
|
||||
{method: 'put', body: JSON.stringify(schedulePost), headers: {'Connection-Id': connectionId}},
|
||||
);
|
||||
};
|
||||
|
||||
deleteScheduledPost = (schedulePostId: string, connectionId: string) => {
|
||||
deleteScheduledPost = (userId: string, schedulePostId: string, connectionId: string) => {
|
||||
this.trackFeatureEvent(TrackScheduledPostsFeature, 'delete_scheduled_post', {[TrackPropertyUser]: userId, [TrackPropertyUserAgent]: 'desktop'});
|
||||
|
||||
return this.doFetchWithResponse<ScheduledPost>(
|
||||
`${this.getPostsRoute()}/schedule/${schedulePostId}`,
|
||||
{method: 'delete', headers: {'Connection-Id': connectionId}},
|
||||
|
||||
Ссылка в новой задаче
Block a user