Class: Pageflow::Review::CommentThreadsController Private

Inherits:
ApplicationController show all
Defined in:
app/controllers/pageflow/review/comment_threads_controller.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/pageflow/review/comment_threads_controller.rb', line 17

def create
  entry = DraftEntry.find(params[:entry_id])
  authorize!(:read, entry.to_model)

  @comment_thread = entry.comment_threads.build(thread_params)
  @comment_thread.creator = current_user

  first_comment = @comment_thread.comments.build(first_comment_params)
  first_comment.creator = current_user

  @comment_thread.save!
  render :create, status: :created
end

#indexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
# File 'app/controllers/pageflow/review/comment_threads_controller.rb', line 8

def index
  entry = DraftEntry.find(params[:entry_id])
  authorize!(:read, entry.to_model)

  @comment_threads = entry.comment_threads.includes(:resolver, comments: :creator)
  @read_at_by_perma_id =
    CommentThreadRead.read_at_by_perma_id(entry: entry.to_model, user: current_user)
end

#updateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/pageflow/review/comment_threads_controller.rb', line 31

def update
  entry = DraftEntry.find(params[:entry_id])
  authorize!(:read, entry.to_model)

  @comment_thread = entry.comment_threads.find(params[:id])

  if ActiveModel::Type::Boolean.new.cast(params[:comment_thread][:resolved])
    @comment_thread.resolve(current_user)
  else
    @comment_thread.unresolve
  end

  render :create
end