Skip to content

Commit

Permalink
FEATURE: support picture api
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMcA committed Aug 21, 2019
1 parent 89a469b commit 7924308
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config/settings.yml
Expand Up @@ -24,6 +24,9 @@ mozilla_iam:
mozilla_iam_person_v2_api_aud:
default: "api.sso.mozilla.com"
shadowed_by_global: true
mozilla_iam_picture_api_url:
default: "https://picture.api.sso.mozilla.com"
shadowed_by_global: true
dinopark_url:
default: "https://people.mozilla.org/"
shadowed_by_global: true
Expand Down
2 changes: 1 addition & 1 deletion lib/mozilla_iam/api/person_v2.rb
Expand Up @@ -76,7 +76,7 @@ def process_full_name
def process_picture
url = process :picture
if !url.blank? && url.starts_with?("/")
SiteSetting.dinopark_url.chomp("/") + url
SiteSetting.mozilla_iam_picture_api_url + url
else
url
end
Expand Down
2 changes: 1 addition & 1 deletion plugin.rb
@@ -1,6 +1,6 @@
# name: mozilla-iam
# about: A plugin to integrate Discourse with Mozilla's Identity and Access Management (IAM) system
# version: 1.3.1
# version: 1.4.0
# authors: Leo McArdle
# url: https://github.com/mozilla/discourse-mozilla-iam

Expand Down
3 changes: 2 additions & 1 deletion spec/components/mozilla_iam/api/person_v2_spec.rb
Expand Up @@ -171,9 +171,10 @@ def profile_with(attributes, value=nil, metadata={})
describe "#picture" do
context "with relative url" do
let(:profile) { profile_with(:picture, "/avatar.png") }
before { SiteSetting.mozilla_iam_picture_api_url = "https://picture.api" }

it "returns absolute url" do
expect(profile.public_send(:picture)).to eq "https://people.mozilla.org/avatar.png"
expect(profile.public_send(:picture)).to eq "https://picture.api/avatar.png"
end
end
end
Expand Down

0 comments on commit 7924308

Please sign in to comment.