Add: allow saveUsercss to build style

This commit is contained in:
eight 2017-09-10 22:04:43 +08:00
parent 3daff40acf
commit cb23f89b6a

View File

@ -290,7 +290,14 @@ function filterUsercss(req) {
function saveUsercss(style) {
// This function use `saveStyle`, however the response is different.
return saveStyle(style)
return Promise.resolve()
.then(() => {
if (!style.name || !style.namespace) {
return Object.assign(usercss.buildMeta(style.source), style);
}
return style;
})
.then(saveStyle)
.then(result => ({
status: 'success',
style: result