Module: Mumuki::Domain::Status::Discussion

Includes:
Mumuki::Domain::Status
Included in:
Closed, Opened, PendingReview, Solved
Defined in:
lib/mumuki/domain/status/discussion/discussion.rb,
lib/mumuki/domain/status/discussion/discussion.rb

Defined Under Namespace

Modules: Closed, Opened, PendingReview, Solved

Constant Summary collapse

STATUSES =
[Opened, Closed, Solved, PendingReview]

Instance Method Summary collapse

Methods included from Mumuki::Domain::Status

#==, #as_json, #dup, #to_i, #to_s, #to_sym

Instance Method Details

#reachable_statuses_for(user, discussion) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/mumuki/domain/status/discussion/discussion.rb', line 29

def reachable_statuses_for(user, discussion)
  if user.moderator_here?
    reachable_statuses_for_moderator(discussion)
  else
    reachable_statuses_for_initiator(discussion)
  end
end

#reachable_statuses_for_initiatorObject



21
22
23
# File 'lib/mumuki/domain/status/discussion/discussion.rb', line 21

def reachable_statuses_for_initiator(*)
  []
end

#reachable_statuses_for_moderatorObject



17
18
19
# File 'lib/mumuki/domain/status/discussion/discussion.rb', line 17

def reachable_statuses_for_moderator(*)
  []
end

#should_be_shown?(count, user) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/mumuki/domain/status/discussion/discussion.rb', line 25

def should_be_shown?(count, user)
  count > 0 || user&.moderator_here?
end