From 21278f05fc1dacec18cf552bb4d1cbbee0d16a0f Mon Sep 17 00:00:00 2001 From: Gustavo de Bona Garcia Date: Fri, 2 Nov 2018 20:18:48 -0300 Subject: [PATCH 1/3] add (meta)Data []byte with size of 65532(same as body) to Message/QorNotification --- channels/database/database.go | 1 + message.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/channels/database/database.go b/channels/database/database.go index 02cd91f..3334816 100644 --- a/channels/database/database.go +++ b/channels/database/database.go @@ -34,6 +34,7 @@ func (database *Database) Send(message *notification.Message, context *qor.Conte Title: message.Title, Body: message.Body, MessageType: message.MessageType, + Data: message.Data, ResolvedAt: message.ResolvedAt, } diff --git a/message.go b/message.go index ebf5f54..28ccf68 100644 --- a/message.go +++ b/message.go @@ -13,6 +13,7 @@ type Message struct { Title string Body string MessageType string + Data []byte ResolvedAt *time.Time } @@ -23,6 +24,7 @@ type QorNotification struct { Title string Body string `sql:"size:65532"` MessageType string + Data []byte `sql:"size:65532"` ResolvedAt *time.Time } From 4d796e105ea035dfc2e84447a588720425255257 Mon Sep 17 00:00:00 2001 From: Gustavo de Bona Garcia Date: Sat, 3 Nov 2018 00:58:18 -0300 Subject: [PATCH 2/3] fix generated data-url when running on domains root --- channels/database/database.go | 2 +- views/notifications/notification.tmpl | 50 +++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/channels/database/database.go b/channels/database/database.go index 3334816..c85ce60 100644 --- a/channels/database/database.go +++ b/channels/database/database.go @@ -6,7 +6,7 @@ import ( "strconv" "github.com/jinzhu/gorm" - "github.com/qor/notification" + "github.com/gstvg/notification" "github.com/qor/qor" ) diff --git a/views/notifications/notification.tmpl b/views/notifications/notification.tmpl index 157e080..f62567c 100644 --- a/views/notifications/notification.tmpl +++ b/views/notifications/notification.tmpl @@ -2,42 +2,42 @@ {{$context := .}}
-

+

{{$message.Title}} -

+ -
+
{{raw $message.Body}} -
+
-
+
{{range $action := $message.Actions $context}} - {{if (and $action.URL (eq $action.Method "GET"))}} + {{if (and $action.URL (eq $action.Method "GET"))}} - {{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}} + {{t (printf "qor_notification.actions.%v" $action.Label) $action.Label}} - {{else}} + {{else}} - + - {{end}} {{end}} -
+ {{end}} +
From 19d4ac6d24f9a68414252f40933a60467ca03c05 Mon Sep 17 00:00:00 2001 From: Gustavo de Bona Garcia Date: Sat, 3 Nov 2018 01:00:33 -0300 Subject: [PATCH 3/3] fix imports --- channels/database/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/database/database.go b/channels/database/database.go index c85ce60..3334816 100644 --- a/channels/database/database.go +++ b/channels/database/database.go @@ -6,7 +6,7 @@ import ( "strconv" "github.com/jinzhu/gorm" - "github.com/gstvg/notification" + "github.com/qor/notification" "github.com/qor/qor" )