Public | Automated Build

Last pushed: a year ago
Short Description
Notifications routing Ruby library
Full Description

What Happened

Installation

  1. Add What Happened to your Gemfile.

     gem 'what_happened', :git => 'https://github.com/tawan/what-happened.git', :branch => 'master'
    
  2. Add a events and notifications table to your database.

     bundle exec rails generate what_happened:install
     bundle exec rake db:migrate
    

Usage

# config/notification_routing.rb
creating_membership do
  sends_notification :one_of_your_groups_has_a_new_member do
    to { |membership| membership.group.members }
    except_if { |recipient, membership| recipient.id == membership.user_id}
  end

  sends_notification :group_has_new_member do
    to { |membership| membership.group }
    except_if { |recipient, membership| membership.organizer }
  end
end

updating_group do
  skip_attributes(:created_at, :updated_at)

  sends_notification :group_was_renamed do
    to { |group| [ group.members, group ] }
  end
end

Notifications can be disabled with following config setting:

Rails.application.configure do
  # ..
  config.what_happened.disabled = true
end
Docker Pull Command
Owner
tawan
Source Repository

Comments (0)