Class: InstagramConnect::ConversationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- InstagramConnect::ConversationsController
- Defined in:
- app/controllers/instagram_connect/conversations_controller.rb
Overview
The DM inbox: a paginated list of threads and a single thread view.
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
4 5 6 7 8 |
# File 'app/controllers/instagram_connect/conversations_controller.rb', line 4 def index per = InstagramConnect.configuration.default_per_page @page = [ params[:page].to_i, 1 ].max @conversations = Conversation.recent.limit(per).offset((@page - 1) * per) end |
#show ⇒ Object
10 11 12 13 14 15 |
# File 'app/controllers/instagram_connect/conversations_controller.rb', line 10 def show @conversation = Conversation.find(params[:id]) @messages = @conversation..chronological @conversation.update!(unread_count: 0) if @conversation.unread_count.positive? @window = MessagingWindow.new(last_inbound_at: @conversation.last_inbound_at) end |