Fix missing profile messages on notification dashboards (#28297)

Этот коммит содержится в:
Daniel Espino García
2024-09-25 12:07:24 +02:00
коммит произвёл GitHub
родитель 6d51307ddf
Коммит 1e8ef05338
2 изменённых файлов: 51 добавлений и 21 удалений

Просмотреть файл

@@ -334,26 +334,34 @@ func (o *Channel) IsShared() bool {
}
func (o *Channel) GetOtherUserIdForDM(userId string) string {
if o.Type != ChannelTypeDirect {
user1, user2 := o.GetBothUsersForDM()
if user2 == "" {
return ""
}
if user1 == userId {
return user2
}
return user1
}
func (o *Channel) GetBothUsersForDM() (string, string) {
if o.Type != ChannelTypeDirect {
return "", ""
}
userIds := strings.Split(o.Name, "__")
if len(userIds) != 2 {
return ""
return "", ""
}
var otherUserId string
if userIds[0] != userIds[1] {
if userIds[0] == userId {
otherUserId = userIds[1]
} else {
otherUserId = userIds[0]
}
if userIds[0] == userIds[1] {
return userIds[0], ""
}
return otherUserId
return userIds[0], userIds[1]
}
func (o *Channel) Sanitize() Channel {