Sha256: 16928859cdb009499376820fe81034c457e24ef0ebb47a5b3e06ed4e25595c4b

Contents?: true

Size: 986 Bytes

Versions: 26

Compression:

Stored size: 986 Bytes

Contents

module MessageTrain
  class ConversationsController < MessageTrain::ApplicationController
    before_filter :load_conversation
    after_filter :mark_as_read

    # GET /box/:division/conversations/:id
    def show
      @messages = @conversation.messages.page(params[:page])
      render :show
      @box.mark :read, @messages
    end

    # PATCH/PUT /box/:division/conversations/:id
    def update
      if params[:mark_to_set].present? && @objects.present?
        @box.mark params[:mark_to_set], @objects
      end
      respond_to_marking
    end

    # DELETE /box/:division/conversations/:id
    def destroy
      if ['ignore', 'unignore'].include? params[:mark_to_set]
        @box.send(params[:mark_to_set], @conversation)
      end
      respond_to_marking
    end

    private

      def load_conversation
        @conversation = @box.find_conversation(params[:id])
      end

      def mark_as_read
        @box.mark :read, conversations: @conversation
      end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
message_train-0.5.2 app/controllers/message_train/conversations_controller.rb
message_train-0.5.1 app/controllers/message_train/conversations_controller.rb
message_train-0.5.0 app/controllers/message_train/conversations_controller.rb
message_train-0.4.6 app/controllers/message_train/conversations_controller.rb
message_train-0.4.5 app/controllers/message_train/conversations_controller.rb
message_train-0.4.4 app/controllers/message_train/conversations_controller.rb
message_train-0.4.3 app/controllers/message_train/conversations_controller.rb
message_train-0.4.2 app/controllers/message_train/conversations_controller.rb
message_train-0.4.1 app/controllers/message_train/conversations_controller.rb
message_train-0.4.0 app/controllers/message_train/conversations_controller.rb
message_train-0.3.1 app/controllers/message_train/conversations_controller.rb
message_train-0.3.0 app/controllers/message_train/conversations_controller.rb
message_train-0.2.12 app/controllers/message_train/conversations_controller.rb
message_train-0.2.11 app/controllers/message_train/conversations_controller.rb
message_train-0.2.10 app/controllers/message_train/conversations_controller.rb
message_train-0.2.9 app/controllers/message_train/conversations_controller.rb
message_train-0.2.8 app/controllers/message_train/conversations_controller.rb
message_train-0.2.7 app/controllers/message_train/conversations_controller.rb
message_train-0.2.6 app/controllers/message_train/conversations_controller.rb
message_train-0.2.5 app/controllers/message_train/conversations_controller.rb