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

Extended by:
Card::Set
Defined in:
tmpsets/set/mod013-email/all/notify.rb

Defined Under Namespace

Classes: FollowerStash

Constant Summary

Constants included from Format

Format::TEMPLATE_DIR

Instance Method Summary collapse

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

#abstract_set?, #all_set?, #num_set_parts, #shortname

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #before, #define_on_format, #format, #register_set_format, #view, #view_for_override

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event::Api

#event

Instance Method Details

#act_cardObject



61
62
63
# File 'tmpsets/set/mod013-email/all/notify.rb', line 61

def act_card
  @supercard || self
end

#current_act_card?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'tmpsets/set/mod013-email/all/notify.rb', line 82

def current_act_card?
  current_act && current_act.card_id == id
end

#followable?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'tmpsets/set/mod013-email/all/notify.rb', line 65

def followable?
  true
end

#notable_change?Boolean

Returns:

  • (Boolean)


77
78
79
80
# File 'tmpsets/set/mod013-email/all/notify.rb', line 77

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

#notify_followersObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'tmpsets/set/mod013-email/all/notify.rb', line 104

def notify_followers
  @current_act.reload
  @follower_stash ||= FollowerStash.new
  @current_act.actions.each do |a|
    next if !a.card || a.card.silent_change?
    @follower_stash.add_affected_card a.card
  end
  @follower_stash.each_follower_with_reason do |follower, reason|
    if follower. && follower != @current_act.actor
      follower..send_change_notice @current_act, reason[:set_card].name,
                                          reason[:option]
    end
  end
# this error handling should apply to all extend callback exceptions
rescue => e
  Rails.logger.info "\nController exception: #{e.message}"
  Card::Error.current = e
  notable_exception_raised
end

#silent_changeObject



69
70
71
# File 'tmpsets/set/mod013-email/all/notify.rb', line 69

def silent_change
  @silent_change || (@supercard && @supercard.silent_change)
end

#silent_change?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'tmpsets/set/mod013-email/all/notify.rb', line 73

def silent_change?
  silent_change.nil? ? !Card::Env[:controller] : silent_change
end