mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added accentColor
and description
parameters to /authentication/setup
route
refs https://github.com/TryGhost/Team/issues/1382 - Added two possible new setup values: `accentColor` and `description` to define the brand colour and site description on initial setup - Updated tests to reflect those changes - Only the params when passed and fall back to default site description
This commit is contained in:
parent
ebab652919
commit
92d9029500
3 changed files with 21 additions and 2 deletions
|
@ -42,6 +42,8 @@ module.exports = {
|
|||
password: frame.data.setup[0].password,
|
||||
blogTitle: frame.data.setup[0].blogTitle,
|
||||
theme: frame.data.setup[0].theme,
|
||||
accentColor: frame.data.setup[0].accentColor,
|
||||
description: frame.data.setup[0].description,
|
||||
status: 'active'
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ async function doSettings(data, settingsAPI) {
|
|||
const context = {context: {user: data.user.id}};
|
||||
const user = data.user;
|
||||
const blogTitle = data.userData.blogTitle;
|
||||
const description = data.userData.description;
|
||||
|
||||
let userSettings;
|
||||
|
||||
|
@ -84,11 +85,21 @@ async function doSettings(data, settingsAPI) {
|
|||
return user;
|
||||
}
|
||||
|
||||
if (!description || typeof description !== 'string') {
|
||||
return user;
|
||||
}
|
||||
|
||||
userSettings = [
|
||||
{key: 'title', value: blogTitle.trim()},
|
||||
{key: 'description', value: tpl(messages.sampleBlogDescription)}
|
||||
{key: 'description', value: description.trim() || tpl(messages.sampleBlogDescription)}
|
||||
];
|
||||
|
||||
if (data.userData.accentColor) {
|
||||
userSettings.push({
|
||||
key: 'accent_color', value: data.userData.accentColor
|
||||
});
|
||||
}
|
||||
|
||||
await settingsAPI.edit({settings: userSettings}, context);
|
||||
|
||||
return user;
|
||||
|
|
|
@ -48,7 +48,9 @@ describe('Authentication API', function () {
|
|||
email: 'test@example.com',
|
||||
password: 'thisissupersafe',
|
||||
blogTitle: 'a test blog',
|
||||
theme: 'TryGhost/Dawn'
|
||||
theme: 'TryGhost/Dawn',
|
||||
accentColor: '#85FF00',
|
||||
description: 'Custom Site Description on Setup — great for everyone'
|
||||
}]
|
||||
})
|
||||
.expectStatus(201)
|
||||
|
@ -70,7 +72,11 @@ describe('Authentication API', function () {
|
|||
assert.equal(requestMock.isDone(), true, 'The dawn github URL should have been used');
|
||||
|
||||
const activeTheme = await settingsCache.get('active_theme');
|
||||
const accentColor = await settingsCache.get('accent_color');
|
||||
const description = await settingsCache.get('description');
|
||||
assert.equal(activeTheme, 'dawn', 'The theme dawn should have been installed');
|
||||
assert.equal(accentColor, '#85FF00', 'The accent color should have been set');
|
||||
assert.equal(description, 'Custom Site Description on Setup — great for everyone', 'The site description should have been set');
|
||||
});
|
||||
|
||||
it('is setup? yes', async function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue