class Decidim::Meetings::Meeting

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

def self.log_presenter_class_for(_log)

def self.log_presenter_class_for(_log)
  Decidim::Meetings::AdminLog::MeetingPresenter
end

def self.participants_iframe_embed_types

def self.participants_iframe_embed_types
  iframe_embed_types.except(:open_in_live_event_page)
end

def self.ransack(params = {}, options = {})

def self.ransack(params = {}, options = {})
  MeetingSearch.new(self, params, options)
end

def self.ransackable_scopes(_auth_object = nil)

def self.ransackable_scopes(_auth_object = nil)
  [:with_any_type, :with_any_date, :with_any_space, :with_any_origin, :with_any_scope, :with_any_category, :with_any_global_category]
end

def self.sort_by_translated_title_asc

def self.sort_by_translated_title_asc
  field = Arel::Nodes::InfixOperation.new("->>", arel_table[:title], Arel::Nodes.build_quoted(I18n.locale))
  order(Arel::Nodes::InfixOperation.new("", field, Arel.sql("ASC")))
end

def self.sort_by_translated_title_desc

def self.sort_by_translated_title_desc
  field = Arel::Nodes::InfixOperation.new("->>", arel_table[:title], Arel::Nodes.build_quoted(I18n.locale))
  order(Arel::Nodes::InfixOperation.new("", field, Arel.sql("DESC")))
end

def accepts_new_comments?

Public: Overrides the `accepts_new_comments?` CommentableWithComponent concern method.
def accepts_new_comments?
  commentable? && !component.current_settings.comments_blocked && comments_allowed?
end

def allow_resource_permissions?

Public: Overrides the `allow_resource_permissions?` Resourceable concern method.
def allow_resource_permissions?
  component.settings.resources_permissions_enabled
end

def authored_proposals

def authored_proposals
  return [] unless Decidim::Meetings.enable_proposal_linking
  Decidim::Proposals::Proposal
    .joins(:coauthorships)
    .where(
      decidim_coauthorships: {
        decidim_author_type: "Decidim::Meetings::Meeting",
        decidim_author_id: id
      }
    )
end

def can_be_joined_by?(user)

def can_be_joined_by?(user)
  !closed? && registrations_enabled? && can_participate?(user)
end

def can_participate?(user)

def can_participate?(user)
  can_participate_in_space?(user) && can_participate_in_meeting?(user)
end

def can_participate_in_meeting?(user)

def can_participate_in_meeting?(user)
  return true unless private_meeting?
  return false unless user
  registrations.exists?(decidim_user_id: user.id)
end

def can_register_invitation?(user)

def can_register_invitation?(user)
  !closed? && registrations_enabled? &&
    can_participate_in_space?(user) && user_has_invitation_for_meeting?(user)
end

def closed?

def closed?
  closed_at.present?
end

def comments_have_alignment?

Public: Overrides the `comments_have_alignment?` Commentable concern method.
def comments_have_alignment?
  true
end

def comments_have_votes?

Public: Overrides the `comments_have_votes?` Commentable concern method.
def comments_have_votes?
  true
end

def current_user_can_visit_meeting?(user)

def current_user_can_visit_meeting?(user)
  Decidim::Meetings::Meeting.visible_for(user).exists?(id: id)
end

def emendation?

def emendation?
  false
end

def has_attendees?

def has_attendees?
  !!attendees_count && attendees_count.positive?
end

def has_available_slots?

def has_available_slots?
  return true if available_slots.zero?
  (available_slots - reserved_slots) > registrations.count
end

def has_contributions?

def has_contributions?
  !!contributions_count && contributions_count.positive?
end

def has_registration_for?(user)

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

def iframe_access_level_allowed_for_user?(user)

def iframe_access_level_allowed_for_user?(user)
  case iframe_access_level
  when "all"
    true
  when "signed_in"
    user.present?
  else
    has_registration_for?(user)
  end
end

def live?

def live?
  start_time &&
    end_time &&
    Time.current >= (start_time - 10.minutes) &&
    Time.current <= end_time
end

def maps_enabled?

def maps_enabled?
  component.settings.maps_enabled?
end

def meeting_duration

Return the duration of the meeting in minutes
def meeting_duration
  @meeting_duration ||= ((end_time - start_time) / 1.minute).abs
end

def on_different_platform?

def on_different_platform?
  registration_type == "on_different_platform"
end

def on_this_platform?

def on_this_platform?
  registration_type == "on_this_platform"
end

def pad_is_visible?

when to display a pad or not.
Overwrites method from Paddable to add custom rules in order to know
def pad_is_visible?
  return false unless pad
  (start_time - Time.current) <= 24.hours
end

def pad_is_writable?

when a pad is writable or not.
Overwrites method from Paddable to add custom rules in order to know
def pad_is_writable?
  return false unless pad_is_visible?
  (Time.current - end_time) < 72.hours
end

def past?

def past?
  end_time < Time.current
end

def presenter

Required by ActsAsAuthor.
Returns the presenter for this author, to be used in the views.
def presenter
  Decidim::Meetings::MeetingPresenter.new(self)
end

def registration_disabled?

def registration_disabled?
  registration_type == "registration_disabled"
end

def remaining_slots

def remaining_slots
  available_slots - reserved_slots - registrations.count
end

def reported_attributes

Public: Overrides the `reported_attributes` Reportable concern method.
def reported_attributes
  [:description]
end

def reported_content_url

Public: Overrides the `reported_content_url` Reportable concern method.
def reported_content_url
  ResourceLocatorPresenter.new(self).url
end

def reported_searchable_content_extras

Public: Overrides the `reported_searchable_content_extras` Reportable concern method.
def reported_searchable_content_extras
  [normalized_author.name]
end

def resource_visible?

def resource_visible?
  return false if hidden?
  !private_meeting? || transparent?
end

def set_default_salt

salt is used to generate secure hash in pads
def set_default_salt
  self.salt ||= Tokenizer.random_salt
end

def user_group_registrations

Return registrations of a particular meeting made by users representing a group
def user_group_registrations
  registrations.where.not(decidim_user_group_id: nil)
end

def user_has_invitation_for_meeting?(user)

def user_has_invitation_for_meeting?(user)
  return true unless private_meeting?
  return false unless user
  invites.exists?(decidim_user_id: user.id)
end

def users_to_notify_on_comment_created

Public: Override Commentable concern method `users_to_notify_on_comment_created`
def users_to_notify_on_comment_created
  followers
end

def withdrawable_by?(user)

past meetings cannot be withdrawn
user - the user to check for withdrawability.

Checks whether the user can withdraw the given meeting.
def withdrawable_by?(user)
  user && !withdrawn? && !past? && authored_by?(user)
end

def withdrawn?

Returns Boolean.

Public: Checks if the author has withdrawn the meeting.
def withdrawn?
  state == "withdrawn"
end