42wim/matterircd

Matterircd adds mentions for all messages including join/parts when there is no words that trigger mentions

kot0dama opened this issue · 2 comments

I recently connected to a new Mattermost instance through Matterircd, and every single message or join/part coming from that instance is being appended with (mentions: kotodama).

I have not been tagged on the message (obviously not on the join/parts), have no keyword set up as a highlights and disabled @all and such mentions on Mattermost. I also visited the web version of Mattermost since being last tagged in a thread, and am receiving this on the #town-square channel where I never spoke nor was tagged.

I have a debug session I need to sanitize for confidential data and will post it later.

I think I found the issue:

package main

import (
    "fmt"
    "strings"
)

func main() {
    mentionkeys := ""

    MentionKeys := strings.Split(mentionkeys, ",")

    text := "somedude joined the team."

    fmt.Println(fmt.Sprintf("HAW: '%v'", MentionKeys))
    for _, m := range MentionKeys {
        fmt.Println("k: ", m)

        if strings.Contains(text, m) {
            fmt.Println("match!")
        }
    }
}

Produces:

$ go run test-mention-keys-split.go
HAW: '[]'
k:
match!

Confirmed:

  • PR #562 fixes it
  • adding at least one word that trigger mentions fixes it

Thank you!