New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gitlab.com/qor2/notification

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitlab.com/qor2/notification

  • v0.0.0-20190603113838-ef1516112cd8
  • Source
  • Go
  • Socket score

Version published
Created
Source

QOR Notification

QOR Notification provides a way to send notifications to QOR Admin administrators. Notifications can be anything your system needs, like order update, delivery notices, whatever.

Usage

Notification := notification.New(&notification.Config{})

// Add to Admin
Admin.NewResource(Notification)

// Register Database Channel
Notification.RegisterChannel(database.New(&database.Config{DB: db.DB}))

// Send Notification
Notification.Send(message *Message, context *qor.Context)

// Get Notification
Notification.GetNotification(user interface{}, messageID string, context *qor.Context)

// Get Notifications
Notification.GetNotifications(user interface{}, context *qor.Context)

// Get Unresolved Notifications Count
Notification.GetUnresolvedNotificationsCount(user interface{}, context *qor.Context)

The Notifications List in QOR Admin looks a bit like this when populated:

notification

Register Actions for Notification

This example shows how to add a "Dismiss" button to notification. The button will appears in the notification which ResolvedAt is nil. Please read the Action documentation for more details.

Notification.Action(&notification.Action{
  Name:         "Dismiss",
  MessageTypes: []string{"info", "order_processed", "order_returned"},
  Visible: func(data *notification.QorNotification, context *admin.Context) bool {
    return data.ResolvedAt == nil
  },
  Handle: func(argument *notification.ActionArgument) error {
    return argument.Context.GetDB().Model(argument.Message).Update("resolved_at", time.Now()).Error
  },
})

License

Released under the MIT License.

FAQs

Package last updated on 03 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc