summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-17 12:57:52 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-17 12:57:52 -0400
commitbd225dca738400495a8ef8fea0fc81fd11d225c7 (patch)
treeff9f6fa2e119e6dd62081d73b91a63aad9a55071 /model
parent876ef15ac126f0a9aec0b9ad4e98a35223641167 (diff)
parent919fb8274bc13beaa260602f8f77bbb5a526f1a3 (diff)
downloadchat-bd225dca738400495a8ef8fea0fc81fd11d225c7.tar.gz
chat-bd225dca738400495a8ef8fea0fc81fd11d225c7.tar.bz2
chat-bd225dca738400495a8ef8fea0fc81fd11d225c7.zip
Merge pull request #2418 from ZBoxApp/PLT-2053
PLT-2053: Option to enable full snippets in push notifications
Diffstat (limited to 'model')
-rw-r--r--model/config.go9
-rw-r--r--model/push_notification.go4
-rw-r--r--model/utils.go12
3 files changed, 25 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index 11ce260ee..d684c72b2 100644
--- a/model/config.go
+++ b/model/config.go
@@ -25,6 +25,9 @@ const (
WEBSERVER_MODE_REGULAR = "regular"
WEBSERVER_MODE_GZIP = "gzip"
WEBSERVER_MODE_DISABLED = "disabled"
+
+ GENERIC_NOTIFICATION = "generic"
+ FULL_NOTIFICATION = "full"
)
type ServiceSettings struct {
@@ -121,6 +124,7 @@ type EmailSettings struct {
PasswordResetSalt string
SendPushNotifications *bool
PushNotificationServer *string
+ PushNotificationContents *string
}
type RateLimitSettings struct {
@@ -299,6 +303,11 @@ func (o *Config) SetDefaults() {
*o.EmailSettings.PushNotificationServer = ""
}
+ if o.EmailSettings.PushNotificationContents == nil {
+ o.EmailSettings.PushNotificationContents = new(string)
+ *o.EmailSettings.PushNotificationContents = GENERIC_NOTIFICATION
+ }
+
if o.SupportSettings.TermsOfServiceLink == nil {
o.SupportSettings.TermsOfServiceLink = new(string)
*o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html"
diff --git a/model/push_notification.go b/model/push_notification.go
index 76f5bd125..9196a44dd 100644
--- a/model/push_notification.go
+++ b/model/push_notification.go
@@ -11,6 +11,8 @@ import (
const (
PUSH_NOTIFY_APPLE = "apple"
PUSH_NOTIFY_ANDROID = "android"
+
+ CATEGORY_DM = "DIRECT_MESSAGE"
)
type PushNotification struct {
@@ -22,6 +24,8 @@ type PushNotification struct {
Message string `json:"message"`
Badge int `json:"badge"`
ContentAvailable int `json:"cont_ava"`
+ ChannelId string `json:"channel_id"`
+ ChannelName string `json:"channel_name"`
}
func (me *PushNotification) ToJson() string {
diff --git a/model/utils.go b/model/utils.go
index 808c89e30..1ce41bb30 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -367,3 +367,15 @@ func IsValidHttpUrl(rawUrl string) bool {
return true
}
+
+func IsValidHttpsUrl(rawUrl string) bool {
+ if strings.Index(rawUrl, "https://") != 0 {
+ return false
+ }
+
+ if _, err := url.ParseRequestURI(rawUrl); err != nil {
+ return false
+ }
+
+ return true
+}