PLT-5012 Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API (#4840)

* Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API

* Remove preference DB writes
This commit is contained in:
Joram Wilander
2016-12-21 16:35:01 -05:00
committed by Christopher Speller
parent 139cb52c99
commit ba6e370ca7
17 changed files with 386 additions and 276 deletions

35
model/channel_view.go Normal file
View File

@@ -0,0 +1,35 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"encoding/json"
"io"
)
type ChannelView struct {
ChannelId string `json:"channel_id"`
PrevChannelId string `json:"prev_channel_id"`
Time int64 `json:"time"`
}
func (o *ChannelView) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
return ""
} else {
return string(b)
}
}
func ChannelViewFromJson(data io.Reader) *ChannelView {
decoder := json.NewDecoder(data)
var o ChannelView
err := decoder.Decode(&o)
if err == nil {
return &o
} else {
return nil
}
}