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

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb,
platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb,
platypus/tmp/set/gem-defaults/mod028-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

Methods included from I18nScope

#mod_name, #scope

Methods included from Registrar

#extended, #finalize_load, #process_base_modules, #register_set

Methods included from Helpers

#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name

Methods included from Card::Set::AdvancedApi

#assign_type, #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 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 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 8

def follower_stash
  @follower_stash
end

Class Method Details

.source_locationObject



7
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 7

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

Instance Method Details

#event: notify_followers_after_deleteObject



34
35
36
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 34

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

#event: notify_followers_after_saveObject



20
21
22
23
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 20

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

#event: silence_notificationsObject



12
13
14
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 12

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



29
30
31
32
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 29

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)


45
46
47
48
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 45

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

#notify_followersObject



38
39
40
41
42
43
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 38

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

  act.reload
  notify_followers_of act
end

#silence_notifications?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 16

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

#silent_change?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify.rb', line 50

def silent_change?
  silent_change
end