Sha256: 603560063929b000b400c1eadc36fc46b43bbef6c676e2a34a518bcd9ded4c09

Contents?: true

Size: 968 Bytes

Versions: 12

Compression:

Stored size: 968 Bytes

Contents

event :cache_expired_for_new_set, :store, on: :create do
  Card.follow_caches_expired
end

def list_direct_followers?
  true
end

def follow_label
  if (klass = subclass_for_set)
    klass.short_label name.left_name
  else
    ""
  end
end

def follow_rule_name user=nil
  Card::Name[[name, user, :follow].compact]
end

def followed_by? user_id=nil
  all_members_followed_by? user_id
end

def follow_set_card
  self
end

def all_members_followed?
  all_members_followed_by? Auth.current_id
end

def all_members_followed_by? user_id=nil
  return false unless prototype.followed_by?(user_id)

  directly_followed_by?(user_id) || broader_set_followed_by?(user_id)
end

def broader_set_followed_by? user_id
  broader_sets.find do |set_card|
    set_card&.directly_followed_by? user_id
  end
end

def directly_followed?
  directly_followed_by? Auth.current_id
end

def directly_followed_by? user_id=nil
  return true if user_id && follow_rule?(user_id)

  follow_rule?
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-follow-0.18.1 set/type/set.rb
card-mod-follow-0.18.0 set/type/set.rb
card-mod-follow-0.17.0 set/type/set.rb
card-mod-follow-0.16.0 set/type/set.rb
card-mod-follow-0.15.6 set/type/set.rb
card-mod-follow-0.15.5 set/type/set.rb
card-mod-follow-0.15.4 set/type/set.rb
card-mod-follow-0.15.3 set/type/set.rb
card-mod-follow-0.15.2.pre1 set/type/set.rb
card-mod-follow-0.15.1.1 set/type/set.rb
card-mod-follow-0.15.1 set/type/set.rb
card-mod-follow-0.15.0 set/type/set.rb