Этот коммит содержится в:
Ben Schumacher
2019-10-29 07:45:09 +01:00
коммит произвёл GitHub
родитель d7649fbf31
Коммит 7a665aacdd
16 изменённых файлов: 33 добавлений и 47 удалений

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

@@ -366,8 +366,8 @@ func ShouldSendPushNotification(user *model.User, channelNotifyProps model.Strin
func DoesNotifyPropsAllowPushNotification(user *model.User, channelNotifyProps model.StringMap, post *model.Post, wasMentioned bool) bool {
userNotifyProps := user.NotifyProps
userNotify := userNotifyProps[model.PUSH_NOTIFY_PROP]
channelNotify, _ := channelNotifyProps[model.PUSH_NOTIFY_PROP]
if channelNotify == "" {
channelNotify, ok := channelNotifyProps[model.PUSH_NOTIFY_PROP]
if !ok || channelNotify == "" {
channelNotify = model.CHANNEL_NOTIFY_DEFAULT
}

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

@@ -73,8 +73,6 @@ func (a *App) OverrideIconURLIfEmoji(post *model.Post) {
} else {
mlog.Warn("Failed to retrieve URL for overriden profile icon (emoji)", mlog.String("emojiName", emojiName), mlog.Err(err))
}
return
}
func (a *App) PreparePostForClient(originalPost *model.Post, isNewPost bool, isEditPost bool) *model.Post {

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

@@ -307,18 +307,22 @@ func TestPreparePostForClient(t *testing.T) {
t.Run("does not override icon URL", func(t *testing.T) {
clientPost := prepare(false, url, emoji)
s, _ := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
s, ok := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
assert.True(t, ok)
assert.EqualValues(t, url, s)
s, _ = clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_EMOJI]
s, ok = clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_EMOJI]
assert.True(t, ok)
assert.EqualValues(t, emoji, s)
})
t.Run("overrides icon URL", func(t *testing.T) {
clientPost := prepare(true, url, emoji)
s, _ := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
s, ok := clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_URL]
assert.True(t, ok)
assert.EqualValues(t, overridenUrl, s)
s, _ = clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_EMOJI]
s, ok = clientPost.Props[model.POST_PROPS_OVERRIDE_ICON_EMOJI]
assert.True(t, ok)
assert.EqualValues(t, emoji, s)
})

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

@@ -633,7 +633,7 @@ func (a *App) OriginChecker() func(*http.Request) bool {
func (s *Server) checkPushNotificationServerUrl() {
notificationServer := *s.Config().EmailSettings.PushNotificationServer
if strings.HasPrefix(notificationServer, "http://") == true {
if strings.HasPrefix(notificationServer, "http://") {
mlog.Warn("Your push notification server is configured with HTTP. For improved security, update to HTTPS in your configuration.")
}
}

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

@@ -331,10 +331,7 @@ func (webCon *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
// If the event is destined to a specific user
if len(msg.Broadcast.UserId) > 0 {
if webCon.UserId == msg.Broadcast.UserId {
return true
}
return false
return webCon.UserId == msg.Broadcast.UserId
}
// if the user is omitted don't send the message
@@ -397,10 +394,5 @@ func (webCon *WebConn) IsMemberOfTeam(teamId string) bool {
currentSession = session
}
member := currentSession.GetTeamByTeamId(teamId)
if member != nil {
return true
}
return false
return currentSession.GetTeamByTeamId(teamId) != nil
}