emojis_controller.rb 509 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class EmojisController < ApplicationController
  3. before_action :set_emoji
  4. before_action :set_cache_headers
  5. def show
  6. respond_to do |format|
  7. format.json do
  8. expires_in 3.minutes, public: true
  9. render_with_cache json: @emoji, content_type: 'application/activity+json', serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter
  10. end
  11. end
  12. end
  13. private
  14. def set_emoji
  15. @emoji = CustomEmoji.local.find(params[:id])
  16. end
  17. end