Fix: popup doesn't use getStyle/getStylesByUrl correctly
This commit is contained in:
parent
cdc922dc9b
commit
3acdf8fea7
|
@ -138,20 +138,23 @@ const styleManager = (() => {
|
|||
.then(newData => handleSave(newData, 'import'));
|
||||
}
|
||||
|
||||
function installStyle(data) {
|
||||
function installStyle(data, reason = null) {
|
||||
const style = styles.get(data.id);
|
||||
if (!style) {
|
||||
data = Object.assign(createNewStyle(), data);
|
||||
} else {
|
||||
data = Object.assign({}, style.data, data);
|
||||
}
|
||||
if (!reason) {
|
||||
reason = style ? 'update' : 'install';
|
||||
}
|
||||
// FIXME: update updateDate? what about usercss config?
|
||||
return calcStyleDigest(data)
|
||||
.then(digest => {
|
||||
data.originalDigest = digest;
|
||||
return saveStyle(data);
|
||||
})
|
||||
.then(newData => handleSave(newData, style ? 'update' : 'install'));
|
||||
.then(newData => handleSave(newData, reason));
|
||||
}
|
||||
|
||||
function editSave(data) {
|
||||
|
|
|
@ -490,7 +490,7 @@ function handleUpdate({style, reason}) {
|
|||
return Promise.resolve(style);
|
||||
}
|
||||
return API.getStylesByUrl(tabURL, style.id)
|
||||
.then(([style]) => style);
|
||||
.then(([result]) => result && Object.assign(result.data, result));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user