Module: Card::Set::All::Notify

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod025-card-mod-follow/all/notify.rb,
card/tmpsets/set/mod025-card-mod-follow/all/notify/base_views.rb,
card/tmpsets/set/mod025-card-mod-follow/all/notify/html_views.rb,
card/tmpsets/set/mod026-card-mod-follow/all/notify.rb,
card/tmpsets/set/mod026-card-mod-follow/all/notify/base_views.rb,
card/tmpsets/set/mod026-card-mod-follow/all/notify/html_views.rb

Overview

Set: All cards (Notify)

Defined Under Namespace

Modules: BaseViews, HtmlViews

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset_modules

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Instance Attribute Details

#follower_stashObject

Returns the value of attribute follower_stash.



8
9
10
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 8

def follower_stash
  @follower_stash
end

Class Method Details

.source_locationObject



7
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-follow/set/all/notify.rb"; end

Instance Method Details

#event: notify_followers_after_deleteObject



33
34
35
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 33

event :notify_followers_after_delete, :integrate, on: :delete, when: :notable_change? do
  notify_followers
end

#event: notify_followers_after_saveObject



19
20
21
22
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 19

event :notify_followers_after_save,
      :integrate_with_delay, on: :save, when: :notable_change? do
  notify_followers
end

#event: silence_notificationsObject



11
12
13
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 11

event :silence_notifications, :initialize, when: :silence_notifications? do
  @silent_change = true
end

#event: stash_followersObject

in the delete case we have to calculate the follower_stash beforehand but we can’t pass the follower_stash through the ActiveJob queue. We have to deal with the notifications in the integrate phase instead of the integrate_with_delay phase



28
29
30
31
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 28

event :stash_followers, :store, on: :delete, when: :notable_change? do
  act_card.follower_stash ||= FollowerStash.new
  act_card.follower_stash.check_card self
end

#notable_change?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 44

def notable_change?
  !silent_change? && current_act_card? &&
    (Card::Auth.current_id != WagnBotID) && followable?
end

#notify_followersObject



37
38
39
40
41
42
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 37

def notify_followers
  return unless (act = Card::Director.act)

  act.reload
  notify_followers_of act
end

#silence_notifications?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 15

def silence_notifications?
  !(Card::Env[:controller] || force_notifications)
end

#silent_change?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'card/tmpsets/set/mod025-card-mod-follow/all/notify.rb', line 49

def silent_change?
  silent_change
end