summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorDmitri Aizenberg <dmitri.aiz@gmail.com>2016-08-31 06:24:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2016-08-31 09:24:14 -0400
commitdc09b7781ac310646014f05db23844ab2c6d63f4 (patch)
tree906f13501b8e30be3551fa18078429445e5ee094 /model
parentdb660bdf9cbea09197d8292a8ec8efda8ac41f38 (diff)
downloadchat-dc09b7781ac310646014f05db23844ab2c6d63f4.tar.gz
chat-dc09b7781ac310646014f05db23844ab2c6d63f4.tar.bz2
chat-dc09b7781ac310646014f05db23844ab2c6d63f4.zip
PLT-1527 Add a slash command to set yourself away (#3752)
* added handlers for slash commands * added manual status persistance * added tests * removed extra debug output and comments * rebase - fixing the PR * making echo messages after slash commands ephemeral
Diffstat (limited to 'model')
-rw-r--r--model/status.go1
-rw-r--r--model/status_test.go6
2 files changed, 6 insertions, 1 deletions
diff --git a/model/status.go b/model/status.go
index 8bf26f2f0..477b750d5 100644
--- a/model/status.go
+++ b/model/status.go
@@ -18,6 +18,7 @@ const (
type Status struct {
UserId string `json:"user_id"`
Status string `json:"status"`
+ Manual bool `json:"manual"`
LastActivityAt int64 `json:"last_activity_at"`
}
diff --git a/model/status_test.go b/model/status_test.go
index ccdac53b6..b5e876bc5 100644
--- a/model/status_test.go
+++ b/model/status_test.go
@@ -9,7 +9,7 @@ import (
)
func TestStatus(t *testing.T) {
- status := Status{NewId(), STATUS_ONLINE, 0}
+ status := Status{NewId(), STATUS_ONLINE, true, 0}
json := status.ToJson()
status2 := StatusFromJson(strings.NewReader(json))
@@ -24,4 +24,8 @@ func TestStatus(t *testing.T) {
if status.LastActivityAt != status2.LastActivityAt {
t.Fatal("LastActivityAt should have matched")
}
+
+ if status.Manual != status2.Manual {
+ t.Fatal("Manual should have matched")
+ }
}