summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/channel.go9
-rw-r--r--api/post.go1
-rw-r--r--api/team.go3
3 files changed, 12 insertions, 1 deletions
diff --git a/api/channel.go b/api/channel.go
index f17594c0a..b85de3071 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -679,6 +679,15 @@ func updateLastViewedAt(c *Context, w http.ResponseWriter, r *http.Request) {
Srv.Store.Channel().UpdateLastViewedAt(id, c.Session.UserId)
+ preference := model.Preference{
+ UserId: c.Session.UserId,
+ Category: model.PREFERENCE_CATEGORY_LAST,
+ Name: model.PREFERENCE_NAME_LAST_CHANNEL,
+ Value: id,
+ }
+
+ Srv.Store.Preference().Save(&model.Preferences{preference})
+
message := model.NewMessage(c.Session.TeamId, id, c.Session.UserId, model.ACTION_CHANNEL_VIEWED)
message.Add("channel_id", id)
diff --git a/api/post.go b/api/post.go
index 6c1d4bbd1..958479427 100644
--- a/api/post.go
+++ b/api/post.go
@@ -650,6 +650,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
httpClient := http.Client{}
request, _ := http.NewRequest("POST", *utils.Cfg.EmailSettings.PushNotificationServer+"/api/v1/send_push", strings.NewReader(msg.ToJson()))
+ l4g.Debug("Sending push notification to " + msg.DeviceId + " with msg of '" + msg.Message + "'")
if _, err := httpClient.Do(request); err != nil {
l4g.Error("Failed to send push notificationid=%v, err=%v", id, err)
}
diff --git a/api/team.go b/api/team.go
index dd9bd0bac..fbcb301a9 100644
--- a/api/team.go
+++ b/api/team.go
@@ -9,6 +9,7 @@ import (
"fmt"
"github.com/gorilla/mux"
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
"net/http"
"net/url"
@@ -480,7 +481,7 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) {
var invNum int64 = 0
for i, invite := range invites.Invites {
- if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != "We couldn't find the existing account" {
+ if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != store.MISSING_ACCOUNT_ERROR {
invNum = int64(i)
c.Err = model.NewAppError("invite_members", "This person is already on your team", strconv.FormatInt(invNum, 10))
return