Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vapid_key to the application entity in the REST API #10058

Merged
merged 1 commit into from
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/api/v1/apps/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class Api::V1::Apps::CredentialsController < Api::BaseController
respond_to :json

def show
render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer
render json: doorkeeper_token.application, serializer: REST::ApplicationSerializer, fields: %i(name website vapid_key)
end
end
6 changes: 5 additions & 1 deletion app/serializers/rest/application_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class REST::ApplicationSerializer < ActiveModel::Serializer
attributes :id, :name, :website, :redirect_uri,
:client_id, :client_secret
:client_id, :client_secret, :vapid_key

def id
object.id.to_s
Expand All @@ -19,4 +19,8 @@ def client_secret
def website
object.website.presence
end

def vapid_key
Rails.configuration.x.vapid_public_key
end
end