Skip to content

Commit

Permalink
Hide connect message, hide attachment message on update (#621) (#622)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4526af4)
  • Loading branch information
sbishel authored Apr 23, 2024
1 parent 8795b55 commit bc1cf13
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
6 changes: 4 additions & 2 deletions server/bot_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
27 changes: 14 additions & 13 deletions server/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bc1cf13

Please sign in to comment.