diff --git a/app/controllers/api/v1/conversations_controller.rb b/app/controllers/api/v1/conversations_controller.rb index 63644f85e..b3ca2f790 100644 --- a/app/controllers/api/v1/conversations_controller.rb +++ b/app/controllers/api/v1/conversations_controller.rb @@ -19,6 +19,11 @@ class Api::V1::ConversationsController < Api::BaseController render json: @conversation, serializer: REST::ConversationSerializer end + def unread + @conversation.update!(unread: true) + render json: @conversation, serializer: REST::ConversationSerializer + end + def destroy @conversation.destroy! render_empty diff --git a/config/routes/api.rb b/config/routes/api.rb index 19c583b3e..a10e8058a 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -81,6 +81,7 @@ namespace :api, format: false do resources :conversations, only: [:index, :destroy] do member do post :read + post :unread end end