Sha256: 688c0a3be154f330de30ed690b3230c74f566a8d4bfbc7a4b40630f8e9ddce6c

Contents?: true

Size: 980 Bytes

Versions: 31

Compression:

Stored size: 980 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_name|
    Card.fetch(set_name)&.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

31 entries across 31 versions & 2 rubygems

Version Path
card-mod-follow-0.14.2 set/type/set.rb
card-mod-follow-0.14.1 set/type/set.rb
card-mod-follow-0.14.0 set/type/set.rb
card-mod-follow-0.13.4 set/type/set.rb
card-mod-follow-0.13.3 set/type/set.rb
card-mod-follow-0.13.2 set/type/set.rb
card-mod-follow-0.13.1 set/type/set.rb
card-mod-follow-0.13.0 set/type/set.rb
card-mod-follow-0.11.7 set/type/set.rb
card-mod-follow-0.12.0 set/type/set.rb
card-mod-follow-0.11.6 set/type/set.rb
card-mod-follow-0.11.5 set/type/set.rb
card-mod-follow-0.11.4 set/type/set.rb
card-mod-follow-0.11.3 set/type/set.rb
card-mod-follow-0.11.2 set/type/set.rb
card-mod-follow-0.11.1 set/type/set.rb
card-mod-follow-0.11.0 set/type/set.rb
card-1.100.0 mod/follow/set/type/set.rb
card-1.99.6 mod/follow/set/type/set.rb
card-1.99.5 mod/follow/set/type/set.rb