Class: Decidim::Meetings::Meeting

Inherits:
ApplicationRecord show all
Includes:
Comments::Commentable, Followable, HasAttachments, HasCategory, HasFeature, HasReference, HasScope, Resourceable
Defined in:
decidim-meetings/app/models/decidim/meetings/meeting.rb

Overview

The data store for a Meeting in the Decidim::Meetings component. It stores a title, description and any other useful information to render a custom meeting.

Instance Method Summary collapse

Instance Method Details

#accepts_new_comments?Boolean

Public: Overrides the ‘accepts_new_comments?` Commentable concern method.



48
49
50
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 48

def accepts_new_comments?
  commentable? && !feature.current_settings.comments_blocked
end

#closed?Boolean



25
26
27
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 25

def closed?
  closed_at.present?
end

#commentable?Boolean

Public: Overrides the ‘commentable?` Commentable concern method.



43
44
45
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 43

def commentable?
  feature.settings.comments_enabled?
end

#comments_have_alignment?Boolean

Public: Overrides the ‘comments_have_alignment?` Commentable concern method.



53
54
55
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 53

def comments_have_alignment?
  true
end

#comments_have_votes?Boolean

Public: Overrides the ‘comments_have_votes?` Commentable concern method.



58
59
60
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 58

def comments_have_votes?
  true
end

#has_available_slots?Boolean



29
30
31
32
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 29

def has_available_slots?
  return true if available_slots.zero?
  available_slots > registrations.count
end

#has_registration_for?(user) ⇒ Boolean



38
39
40
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 38

def has_registration_for?(user)
  registrations.where(user: user).any?
end

#remaining_slotsObject



34
35
36
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 34

def remaining_slots
  available_slots - registrations.count
end

#users_to_notify_on_comment_createdObject

Public: Override Commentable concern method ‘users_to_notify_on_comment_created`



63
64
65
# File 'decidim-meetings/app/models/decidim/meetings/meeting.rb', line 63

def users_to_notify_on_comment_created
  followers
end