Sha256: 18c4296ce138f5f8966ea54165f86bb1ee7b7310ccee5437a8d354fc372e8843

Contents?: true

Size: 926 Bytes

Versions: 4

Compression:

Stored size: 926 Bytes

Contents

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

    # GET /box/in/conversations/1
    def show
      @messages = @conversation.messages.page(params[:page])
      render :show
    end

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

    # DELETE /box/in/conversations/1
    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

4 entries across 4 versions & 1 rubygems

Version Path
message_train-0.1.3 app/controllers/message_train/conversations_controller.rb
message_train-0.1.2 app/controllers/message_train/conversations_controller.rb
message_train-0.1.1 app/controllers/message_train/conversations_controller.rb
message_train-0.1.0 app/controllers/message_train/conversations_controller.rb