Mattermost-server: [MM-28980] Inconsistent behaviour in channel mentions in message attachments

Created on 2 Oct 2020  路  1Comment  路  Source: mattermost/mattermost-server

Summary

This ticket was originally filed on Jira: https://mattermost.atlassian.net/browse/MM-28980
When creating a channel mention link with fmt.Sprintf("~%s", channel.Name) in a message attachment, the behaviour is both inconsistent and buggy:

  • If the link is contained in the Title field, it does not render as a link on mobile, but it works on webapp.
  • If the link is contained in the Pretext field, the link works on both, but does force a page refresh on webapp (this is not expected).
  • If the link is contained in the Text field, it works on mobile, but it ends in a Not Found page on webapp.

Steps to reproduce

  1. Build a post such as
post := &model.Post{
    Message: message,
    Props: map[string]interface{}{
        "attachments": []*model.SlackAttachment{
            {
                Title: fmt.Sprintf("~%s", channel.Name),
                Text:    fmt.Sprintf("~%s", channel.Name),
                Pretext: fmt.Sprintf("~%s", channel.Name),
            },
        },
    },
}
  1. Send the post to a user.
  2. Read the post from the webapp and test all three links.
  3. Read the post from the mobile app and test all three links.

Expected behavior

The link should in all cases redirect to the channel without a page refresh nor opening a different tab.

Possible fixes

For the mobile problem, probably the text is just not parsed through the Markdown parser.
For webapp, there might be problems in the markdown parser, so it mark the links properly as internal links.

AreIntegrations Medium Hacktoberfest Help Wanted PR Exists TecReact Native TecReactJS

Most helpful comment

FYI, my PR is only for the webapp issue

>All comments

FYI, my PR is only for the webapp issue

Was this page helpful?
0 / 5 - 0 ratings