[MM-15297] Migrate "Preference.Get" to Sync by default #10721 (#10811)

* modify Get method in preference_store

* modify interface to match changes on preference store Get method

* modify variable initialization

* fix behavior on GetPreferenceByCategoryAndNameForUser
Этот коммит содержится в:
Ivana Irene Thomas
2019-05-15 19:20:26 +07:00
коммит произвёл Miguel de la Cruz
родитель b3e09715df
Коммит a68ad55151
8 изменённых файлов: 56 добавлений и 52 удалений

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

@@ -5,11 +5,12 @@ package app
import (
"fmt"
"github.com/pkg/errors"
"hash/fnv"
"net/http"
"strings"
"github.com/pkg/errors"
"github.com/mattermost/go-i18n/i18n"
"github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
@@ -151,10 +152,10 @@ func (a *App) sendPushNotification(notification *postNotification, user *model.U
post := notification.post
var nameFormat string
if result := <-a.Srv.Store.Preference().Get(user.Id, model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS, model.PREFERENCE_NAME_NAME_FORMAT); result.Err != nil {
if data, err := a.Srv.Store.Preference().Get(user.Id, model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS, model.PREFERENCE_NAME_NAME_FORMAT); err != nil {
nameFormat = *a.Config().TeamSettings.TeammateNameDisplay
} else {
nameFormat = result.Data.(model.Preference).Value
nameFormat = data.Value
}
channelName := notification.GetChannelName(nameFormat, user.Id)