PLT-3942 Add real-time updates for center channel profile picture popover (#3871)

* PLT-3942 Add real-time updates for center channel profile picture pop-over

* Send user data with the websocket event to prevent further requests

* Add helper for profile sanitation
Этот коммит содержится в:
enahum
2016-08-24 18:10:49 -03:00
коммит произвёл GitHub
родитель deb1361a0d
Коммит e6d15f77e8
5 изменённых файлов: 50 добавлений и 44 удалений

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

@@ -251,6 +251,22 @@ func (u *User) ClearNonProfileFields() {
u.FailedAttempts = 0
}
func (u *User) SanitizeProfile(isSystemAdmin, pwdupdate, fullname, email bool) {
options := map[string]bool{}
options["passwordupdate"] = pwdupdate
if isSystemAdmin {
options["fullname"] = true
options["email"] = true
} else {
options["fullname"] = fullname
options["email"] = email
u.ClearNonProfileFields()
}
u.Sanitize(options)
}
func (u *User) MakeNonNil() {
if u.Props == nil {
u.Props = make(map[string]string)

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

@@ -19,6 +19,7 @@ const (
WEBSOCKET_EVENT_NEW_USER = "new_user"
WEBSOCKET_EVENT_LEAVE_TEAM = "leave_team"
WEBSOCKET_EVENT_USER_ADDED = "user_added"
WEBSOCKET_EVENT_USER_UPDATED = "user_updated"
WEBSOCKET_EVENT_USER_REMOVED = "user_removed"
WEBSOCKET_EVENT_PREFERENCE_CHANGED = "preference_changed"
WEBSOCKET_EVENT_EPHEMERAL_MESSAGE = "ephemeral_message"