[MM-16709] Add helper method for plugins using MessageHasBeenPosted (#12539)
The PR introduces a method in helper interface. The method has common code for filtering to be used across plugins which use MessageHasBeenPosted.
Этот коммит содержится в:
коммит произвёл
Ben Schumacher
родитель
9b6a0674f7
Коммит
f2fcfa8f9d
13
model/bot.go
13
model/bot.go
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
@@ -217,3 +218,15 @@ func (l *BotList) Etag() string {
|
||||
func MakeBotNotFoundError(userId string) *AppError {
|
||||
return NewAppError("SqlBotStore.Get", "store.sql_bot.get.missing.app_error", map[string]interface{}{"user_id": userId}, "", http.StatusNotFound)
|
||||
}
|
||||
|
||||
func IsBotDMChannel(channel *Channel, botUserID string) bool {
|
||||
if channel.Type != CHANNEL_DIRECT {
|
||||
return false
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(channel.Name, botUserID+"__") && !strings.HasSuffix(channel.Name, "__"+botUserID) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user