Module: Participable

Extended by:
ActiveSupport::Concern
Included in:
AwardEmoji, Commit, Issuable, Note, Review, Snippet
Defined in:
app/models/concerns/participable.rb

Overview

Participable concern

Contains functionality related to objects that can have participants, such as an author, an assignee and people mentioned in its description or comments.

Usage:

class Issue < ApplicationRecord
  include Participable

  # ...

  participant :author
  participant :assignee
  participant :notes

  participant -> (current_user, ext) do
    ext.analyze('...')
  end
end

issue = Issue.last
users = issue.participants

Instance Method Summary collapse

Instance Method Details

#participants(current_user = nil) ⇒ Object

Returns the users participating in a discussion.

This method processes attributes of objects in breadth-first order.

Returns an Array of User instances.


59
60
61
# File 'app/models/concerns/participable.rb', line 59

def participants(current_user = nil)
  all_participants[current_user]
end