From bc1cf1372cbdf339b0538f9c8f5a23737acc8f2a Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Tue, 23 Apr 2024 13:26:25 -0600 Subject: [PATCH] Hide connect message, hide attachment message on update (#621) (#622) (cherry picked from commit 4526af42b066ef1086f3bcbf1030e8dd247c0e33) --- server/bot_messages.go | 6 ++++-- server/handlers/handlers.go | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/server/bot_messages.go b/server/bot_messages.go index 8f55db5bd..edb9d2cfd 100644 --- a/server/bot_messages.go +++ b/server/bot_messages.go @@ -21,8 +21,10 @@ func (p *Plugin) botSendDirectMessage(userID, message string) error { } func (p *Plugin) handlePromptForConnection(userID, channelID string) { - message := "Some users in this conversation rely on Microsoft Teams to receive your messages, but your account isn't connected. " - p.SendConnectMessage(channelID, userID, message) + // For now, don't display the connect message + + // message := "Some users in this conversation rely on Microsoft Teams to receive your messages, but your account isn't connected. " + // p.SendConnectMessage(channelID, userID, message) } func (p *Plugin) SendConnectMessage(channelID string, userID string, message string) { diff --git a/server/handlers/handlers.go b/server/handlers/handlers.go index 3fdb09aa3..ddf72135d 100644 --- a/server/handlers/handlers.go +++ b/server/handlers/handlers.go @@ -470,21 +470,22 @@ func (ah *ActivityHandler) handleUpdatedActivity(msg *clientmodels.Message, subs return metrics.DiscardedReasonInactiveUser } - post, skippedFileAttachments, _ := ah.msgToPost(channelID, senderID, msg, chat, true) + post, _, _ := ah.msgToPost(channelID, senderID, msg, chat, true) post.Id = postInfo.MattermostID - if skippedFileAttachments { - _, appErr := ah.plugin.GetAPI().CreatePost(&model.Post{ - ChannelId: post.ChannelId, - UserId: ah.plugin.GetBotUserID(), - Message: "Attachments added to an existing post in Microsoft Teams aren't delivered to Mattermost.", - // Anchor the post immediately after (never before) the post that was edited. - CreateAt: post.CreateAt + 1, - }) - if appErr != nil { - ah.plugin.GetAPI().LogWarn("Failed to notify channel of skipped attachment", "channel_id", post.ChannelId, "post_id", post.Id, "error", appErr) - } - } + // For now, don't display this message on update + // if skippedFileAttachments { + // _, appErr := ah.plugin.GetAPI().CreatePost(&model.Post{ + // ChannelId: post.ChannelId, + // UserId: ah.plugin.GetBotUserID(), + // Message: "Attachments added to an existing post in Microsoft Teams aren't delivered to Mattermost.", + // // Anchor the post immediately after (never before) the post that was edited. + // CreateAt: post.CreateAt + 1, + // }) + // if appErr != nil { + // ah.plugin.GetAPI().LogWarn("Failed to notify channel of skipped attachment", "channel_id", post.ChannelId, "post_id", post.Id, "error", appErr) + // } + // } ah.IgnorePluginHooksMap.Store(fmt.Sprintf("post_%s", post.Id), true) if _, appErr := ah.plugin.GetAPI().UpdatePost(post); appErr != nil {