Sha256: e4c1c6268835c15e88605b67abb44a1546d6824fd7b659fcbf9f9da56b06a0b1
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
module Thredded class PrivateTopicsController < Thredded::ApplicationController def index if cannot? :read, messageboard error = 'You are not authorized access to this messageboard.' redirect_to default_home, flash: { error: error } else @private_topics = private_topics end end 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 def private_topics PrivateTopic .for_messageboard(messageboard) .including_roles_for(current_user) .for_user(current_user) .order_by_stuck_and_updated_time .on_page(params[:page]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thredded-0.0.9 | app/controllers/thredded/private_topics_controller.rb |
thredded-0.0.8 | app/controllers/thredded/private_topics_controller.rb |