summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/status.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/status.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/vendor/github.com/mattermost/platform/model/status.go b/vendor/github.com/mattermost/platform/model/status.go
index fc155788..d838eea0 100644
--- a/vendor/github.com/mattermost/platform/model/status.go
+++ b/vendor/github.com/mattermost/platform/model/status.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
@@ -22,7 +22,7 @@ type Status struct {
Status string `json:"status"`
Manual bool `json:"manual"`
LastActivityAt int64 `json:"last_activity_at"`
- ActiveChannel string `json:"active_channel" db:"-"`
+ ActiveChannel string `json:"-" db:"-"`
}
func (o *Status) ToJson() string {
@@ -45,6 +45,26 @@ func StatusFromJson(data io.Reader) *Status {
}
}
+func StatusListToJson(u []*Status) string {
+ b, err := json.Marshal(u)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func StatusListFromJson(data io.Reader) []*Status {
+ decoder := json.NewDecoder(data)
+ var statuses []*Status
+ err := decoder.Decode(&statuses)
+ if err == nil {
+ return statuses
+ } else {
+ return nil
+ }
+}
+
func StatusMapToInterfaceMap(statusMap map[string]*Status) map[string]interface{} {
interfaceMap := map[string]interface{}{}
for _, s := range statusMap {