修复publish随MD文件移动循环请求的bug
This commit is contained in:
parent
c6d5ddfe3d
commit
04ee93237d
@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal__button-bar">
|
||||
<button class="button button--resolve" @click="config.resolve()">Close</button>
|
||||
<button class="button button--resolve" @click="config.resolve()">关闭</button>
|
||||
</div>
|
||||
</modal-inner>
|
||||
</template>
|
||||
|
@ -72,9 +72,9 @@ export default {
|
||||
'好的,我明白了',
|
||||
),
|
||||
stripName: simpleModal(
|
||||
config => `<p><b>${config.item.name}</b>包含非法字符。你想剥离它们吗?</p>`,
|
||||
config => `<p><b>${config.item.name}</b>包含非法字符。你想去掉它们吗?</p>`,
|
||||
'取消',
|
||||
'确认剥离',
|
||||
'确认去掉',
|
||||
),
|
||||
tempFileDeletion: simpleModal(
|
||||
config => `<p>您将永久删除临时文件<b>${config.item.name}</b>。你确定吗?</p>`,
|
||||
|
@ -89,9 +89,9 @@ export default {
|
||||
if (store.state.offline !== offline) {
|
||||
store.commit('setOffline', offline);
|
||||
if (offline) {
|
||||
store.dispatch('notification/error', 'You are offline.');
|
||||
store.dispatch('notification/error', '已离线!');
|
||||
} else {
|
||||
store.dispatch('notification/info', 'You are back online!');
|
||||
store.dispatch('notification/info', '恢复上线了!');
|
||||
this.getServerConf();
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ export default new Provider({
|
||||
...syncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from Dropbox.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从Dropbox导入。`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -117,7 +117,7 @@ export default new Provider({
|
||||
...updatedSyncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from Gitea.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从Gitea导入。`);
|
||||
}
|
||||
},
|
||||
makeLocation(token, projectPath, branch, path) {
|
||||
|
@ -103,7 +103,7 @@ export default new Provider({
|
||||
...syncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from Gitee.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从Gitee导入。`);
|
||||
}
|
||||
},
|
||||
makeLocation(token, owner, repo, branch, path) {
|
||||
|
@ -103,7 +103,7 @@ export default new Provider({
|
||||
...syncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from GitHub.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从GitHub导入。`);
|
||||
}
|
||||
},
|
||||
makeLocation(token, owner, repo, branch, path) {
|
||||
|
@ -117,7 +117,7 @@ export default new Provider({
|
||||
...updatedSyncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from GitLab.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从GitLab导入。`);
|
||||
}
|
||||
},
|
||||
makeLocation(token, projectPath, branch, path) {
|
||||
|
@ -174,7 +174,7 @@ export default new Provider({
|
||||
...syncLocation,
|
||||
fileId: item.id,
|
||||
});
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name} was imported from Google Drive.`);
|
||||
store.dispatch('notification/info', `${store.getters['file/current'].name}已从Google Drive导入。`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -329,9 +329,10 @@ export default {
|
||||
params: { ref: branch },
|
||||
});
|
||||
if (sha) {
|
||||
const data = utils.decodeBase64(content);
|
||||
return {
|
||||
sha,
|
||||
data: utils.decodeBase64(content),
|
||||
data: data === ' ' ? '' : data,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
|
@ -94,7 +94,7 @@ const publishFile = async (fileId) => {
|
||||
});
|
||||
});
|
||||
const file = store.state.file.itemsById[fileId];
|
||||
store.dispatch('notification/info', `"${file.name}" was published to ${counter} location(s).`);
|
||||
store.dispatch('notification/info', `"${file.name}"已发布到${counter}个位置。`);
|
||||
} finally {
|
||||
await localDbSvc.unloadContents();
|
||||
}
|
||||
@ -133,7 +133,7 @@ const createPublishLocation = (publishLocation, featureId) => {
|
||||
async () => {
|
||||
const publishLocationToStore = await publish(publishLocation);
|
||||
workspaceSvc.addPublishLocation(publishLocationToStore);
|
||||
store.dispatch('notification/info', `A new publication location was added to "${currentFile.name}".`);
|
||||
store.dispatch('notification/info', `添加了一个新的发布位置 "${currentFile.name}".`);
|
||||
if (featureId) {
|
||||
badgeSvc.addBadge(featureId);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ const createSyncLocation = (syncLocation) => {
|
||||
|
||||
store.commit('syncedContent/patchItem', newSyncedContent);
|
||||
workspaceSvc.addSyncLocation(updatedSyncLocation);
|
||||
store.dispatch('notification/info', `A new synchronized location was added to "${currentFile.name}".`);
|
||||
store.dispatch('notification/info', `将新的同步位置添加到"${currentFile.name}"中。`);
|
||||
},
|
||||
);
|
||||
};
|
||||
@ -665,6 +665,8 @@ const syncWorkspace = async (skipContents = false) => {
|
||||
|| (isGit && item.type === 'folder')
|
||||
// Add file only if content has been added
|
||||
|| (item.type === 'file' && !syncDataByItemId[`${id}/content`])
|
||||
// 如果是发布位置 文件不存在了 则不需要更新 等待后续删除
|
||||
|| (item.type === 'publishLocation' && (!item.fileId || !syncDataByItemId[`${item.fileId}/content`]))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@ -688,13 +690,16 @@ const syncWorkspace = async (skipContents = false) => {
|
||||
await utils.awaitSome(() => ifNotTooLate(async () => {
|
||||
let getItem;
|
||||
let getFileItem;
|
||||
let getOriginFileItem;
|
||||
if (store.getters['workspace/currentWorkspaceIsGit']) {
|
||||
const { itemsByGitPath } = store.getters;
|
||||
getItem = syncData => itemsByGitPath[syncData.id];
|
||||
getOriginFileItem = syncData => itemsByGitPath[syncData.fileId];
|
||||
getFileItem = syncData => itemsByGitPath[syncData.id.slice(1)]; // Remove leading /
|
||||
} else {
|
||||
const { allItemsById } = store.getters;
|
||||
getItem = syncData => allItemsById[syncData.itemId];
|
||||
getOriginFileItem = syncData => allItemsById[syncData.fileId];
|
||||
getFileItem = syncData => allItemsById[syncData.itemId.split('/')[0]];
|
||||
}
|
||||
|
||||
@ -707,6 +712,8 @@ const syncWorkspace = async (skipContents = false) => {
|
||||
|| syncData.type === 'data'
|
||||
// Remove content only if file has been removed
|
||||
|| (syncData.type === 'content' && getFileItem(syncData))
|
||||
// 发布位置 如果对应的文件不存在了 也需要删除
|
||||
|| (syncData.type === 'publishLocation' && syncData.fileId && getOriginFileItem(syncData))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export default {
|
||||
type: 'unauthorizedName',
|
||||
item,
|
||||
});
|
||||
throw new Error('Unauthorized name.');
|
||||
throw new Error('未经授权的名称。');
|
||||
}
|
||||
|
||||
// Show warning dialogs
|
||||
|
Loading…
Reference in New Issue
Block a user