Class: NewsmastMastodon::Api::V1::Patchwork::ConversationsController
- Inherits:
-
Api::BaseController
- Object
- Api::BaseController
- NewsmastMastodon::Api::V1::Patchwork::ConversationsController
- Defined in:
- app/controllers/newsmast_mastodon/api/v1/patchwork/conversations_controller.rb
Constant Summary collapse
- LIMIT =
1
Instance Method Summary collapse
Instance Method Details
#check_conversation ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/newsmast_mastodon/api/v1/patchwork/conversations_controller.rb', line 12 def check_conversation @conversations = paginated_conversations return render json: {}, status: 200 unless @conversations.any? render json: @conversations.last, serializer: REST::ConversationSerializer, relationships: StatusRelationshipsPresenter.new(@conversations.map(&:last_status), current_user&.account_id) end |
#read_all ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/newsmast_mastodon/api/v1/patchwork/conversations_controller.rb', line 19 def read_all @conversations = AccountConversation.where(account: current_account, unread: true) updated_count = @conversations.update_all(unread: false) render json: {success: true, updated_count: updated_count, message: "Marked #{updated_count} conversation(s) as read"}, each_serializer: REST::ConversationSerializer, relationships: StatusRelationshipsPresenter.new(@conversations.map(&:last_status), current_user&.account_id) end |