DEV: Include `login_required` attribute in basic info endpoint (#14064)

This is useful in the DiscourseHub mobile app, currently the app queries
the `about.json` endpoint, which can raise a CORS issue in some cases,
for example when the site only accepts logins from an external provider.
This commit is contained in:
Penar Musaraj 2021-08-17 14:05:51 -04:00 committed by GitHub
parent db8c33ad92
commit 08a3aa546b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -34,7 +34,8 @@ class SiteController < ApplicationController
title: SiteSetting.title,
description: SiteSetting.site_description,
header_primary_color: ColorScheme.hex_for_name('header_primary') || '333333',
header_background_color: ColorScheme.hex_for_name('header_background') || 'ffffff'
header_background_color: ColorScheme.hex_for_name('header_background') || 'ffffff',
login_required: SiteSetting.login_required
}
if mobile_logo_url = SiteSetting.site_mobile_logo_url.presence

View File

@ -29,6 +29,7 @@ describe SiteController do
expect(json["mobile_logo_url"]).to eq(expected_url)
expect(json["header_primary_color"]).to eq("333333")
expect(json["header_background_color"]).to eq("ffffff")
expect(json["login_required"]).to eq(true)
end
end