Sha256: 4a03c80af6c8202cf6e66671744d8559544ec5922433a6083ecc0a85f207dd48

Contents?: true

Size: 1002 Bytes

Versions: 19

Compression:

Stored size: 1002 Bytes

Contents

module MessageTrain
  # Conversations controller
  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 %w( 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

19 entries across 19 versions & 1 rubygems

Version Path
message_train-0.6.17 app/controllers/message_train/conversations_controller.rb
message_train-0.6.16 app/controllers/message_train/conversations_controller.rb
message_train-0.6.15 app/controllers/message_train/conversations_controller.rb
message_train-0.6.14 app/controllers/message_train/conversations_controller.rb
message_train-0.6.13 app/controllers/message_train/conversations_controller.rb
message_train-0.6.12 app/controllers/message_train/conversations_controller.rb
message_train-0.6.11 app/controllers/message_train/conversations_controller.rb
message_train-0.6.10 app/controllers/message_train/conversations_controller.rb
message_train-0.6.9 app/controllers/message_train/conversations_controller.rb
message_train-0.6.8 app/controllers/message_train/conversations_controller.rb
message_train-0.6.7 app/controllers/message_train/conversations_controller.rb
message_train-0.6.6 app/controllers/message_train/conversations_controller.rb
message_train-0.6.5 app/controllers/message_train/conversations_controller.rb
message_train-0.6.4 app/controllers/message_train/conversations_controller.rb
message_train-0.6.3 app/controllers/message_train/conversations_controller.rb
message_train-0.6.2 app/controllers/message_train/conversations_controller.rb
message_train-0.6.1 app/controllers/message_train/conversations_controller.rb
message_train-0.6.0 app/controllers/message_train/conversations_controller.rb
message_train-0.5.3 app/controllers/message_train/conversations_controller.rb