Sha256: feed89f9e17e5122a68fd87f7e2b0ee5e272eca903e2ad7f452b91728f666b3e

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

module Thredded
  class PrivateTopicsController < ApplicationController
    before_filter :ensure_messageboard_exists

    def new
      @private_topic = messageboard.private_topics.build
      @private_topic.posts.build(
        filter: current_user.try(:post_filter)
      )

      unless can? :create, @private_topic
        error = 'Sorry, you are not authorized to post on this messageboard.'
        redirect_to messageboard_topics_url(messageboard),
          flash: { error: error }
      end
    end

    def create
      params[:topic][:user_id] << current_user.id
      merge_default_topics_params
      @private_topic = PrivateTopic.create(params[:topic])
      redirect_to messageboard_topics_url(messageboard)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thredded-0.0.1 app/controllers/thredded/private_topics_controller.rb