summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/channel.go8
-rw-r--r--api/channel_test.go3
-rw-r--r--api/post.go5
-rw-r--r--api/templates/signup_team_subject.html2
4 files changed, 10 insertions, 8 deletions
diff --git a/api/channel.go b/api/channel.go
index 75ca9680d..99640e71a 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -205,9 +205,11 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
if oldChannel.Name == model.DEFAULT_CHANNEL {
- c.Err = model.NewAppError("updateChannel", "Cannot update the default channel "+model.DEFAULT_CHANNEL, "")
- c.Err.StatusCode = http.StatusForbidden
- return
+ if (len(channel.Name) > 0 && channel.Name != oldChannel.Name) || (len(channel.Type) > 0 && channel.Type != oldChannel.Type) {
+ c.Err = model.NewAppError("updateChannel", "Tried to perform an invalid update of the default channel "+model.DEFAULT_CHANNEL, "")
+ c.Err.StatusCode = http.StatusForbidden
+ return
+ }
}
oldChannel.Header = channel.Header
diff --git a/api/channel_test.go b/api/channel_test.go
index faed387dd..e7e1f4eb0 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -215,8 +215,9 @@ func TestUpdateChannel(t *testing.T) {
for _, c := range data.Channels {
if c.Name == model.DEFAULT_CHANNEL {
c.Header = "new header"
+ c.Name = "pseudo-square"
if _, err := Client.UpdateChannel(c); err == nil {
- t.Fatal("should have errored on updating default channel")
+ t.Fatal("should have errored on updating default channel name")
}
break
}
diff --git a/api/post.go b/api/post.go
index ef70e1336..0860fd299 100644
--- a/api/post.go
+++ b/api/post.go
@@ -544,11 +544,10 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
alreadySeen := make(map[string]string)
for _, session := range sessions {
- if len(session.DeviceId) > 0 && alreadySeen[session.DeviceId] == "" {
-
+ if len(session.DeviceId) > 0 && alreadySeen[session.DeviceId] == "" && strings.HasPrefix(session.DeviceId, "apple:") {
alreadySeen[session.DeviceId] = session.DeviceId
- utils.SendAppleNotifyAndForget(session.DeviceId, subjectPage.Render(), 1)
+ utils.SendAppleNotifyAndForget(strings.TrimPrefix(session.DeviceId, "apple:"), subjectPage.Render(), 1)
}
}
}
diff --git a/api/templates/signup_team_subject.html b/api/templates/signup_team_subject.html
index 236b288fa..4fc5b3d72 100644
--- a/api/templates/signup_team_subject.html
+++ b/api/templates/signup_team_subject.html
@@ -1 +1 @@
-{{define "signup_team_subject"}}Invitation to {{ .ClientCfg.SiteName }}{{end}} \ No newline at end of file
+{{define "signup_team_subject"}}{{ .ClientCfg.SiteName }} Team Setup{{end}} \ No newline at end of file