diff --git a/src/components/modals/PublishManagementModal.vue b/src/components/modals/PublishManagementModal.vue index 5e10f392..52726eab 100644 --- a/src/components/modals/PublishManagementModal.vue +++ b/src/components/modals/PublishManagementModal.vue @@ -41,7 +41,7 @@ diff --git a/src/data/simpleModals.js b/src/data/simpleModals.js index f09ea244..9914c7fb 100644 --- a/src/data/simpleModals.js +++ b/src/data/simpleModals.js @@ -72,9 +72,9 @@ export default { '好的,我明白了', ), stripName: simpleModal( - config => `

${config.item.name}包含非法字符。你想剥离它们吗?

`, + config => `

${config.item.name}包含非法字符。你想去掉它们吗?

`, '取消', - '确认剥离', + '确认去掉', ), tempFileDeletion: simpleModal( config => `

您将永久删除临时文件${config.item.name}。你确定吗?

`, diff --git a/src/services/networkSvc.js b/src/services/networkSvc.js index 27217394..f1112372 100644 --- a/src/services/networkSvc.js +++ b/src/services/networkSvc.js @@ -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(); } } diff --git a/src/services/providers/dropboxProvider.js b/src/services/providers/dropboxProvider.js index 3bdb8ec1..9d3ac2bf 100644 --- a/src/services/providers/dropboxProvider.js +++ b/src/services/providers/dropboxProvider.js @@ -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导入。`); } }); }, diff --git a/src/services/providers/giteaProvider.js b/src/services/providers/giteaProvider.js index df88d84c..49c14136 100644 --- a/src/services/providers/giteaProvider.js +++ b/src/services/providers/giteaProvider.js @@ -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) { diff --git a/src/services/providers/giteeProvider.js b/src/services/providers/giteeProvider.js index 207bae47..3acb10ad 100644 --- a/src/services/providers/giteeProvider.js +++ b/src/services/providers/giteeProvider.js @@ -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) { diff --git a/src/services/providers/githubProvider.js b/src/services/providers/githubProvider.js index e23b210a..1f88b096 100644 --- a/src/services/providers/githubProvider.js +++ b/src/services/providers/githubProvider.js @@ -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) { diff --git a/src/services/providers/gitlabProvider.js b/src/services/providers/gitlabProvider.js index 203672ff..c0e07193 100644 --- a/src/services/providers/gitlabProvider.js +++ b/src/services/providers/gitlabProvider.js @@ -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) { diff --git a/src/services/providers/googleDriveProvider.js b/src/services/providers/googleDriveProvider.js index 31ff99a5..0dcb7745 100644 --- a/src/services/providers/googleDriveProvider.js +++ b/src/services/providers/googleDriveProvider.js @@ -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导入。`); } }); }, diff --git a/src/services/providers/helpers/giteeHelper.js b/src/services/providers/helpers/giteeHelper.js index e682f279..54a614aa 100644 --- a/src/services/providers/helpers/giteeHelper.js +++ b/src/services/providers/helpers/giteeHelper.js @@ -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 {}; diff --git a/src/services/publishSvc.js b/src/services/publishSvc.js index a56561aa..653537b9 100644 --- a/src/services/publishSvc.js +++ b/src/services/publishSvc.js @@ -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); } diff --git a/src/services/syncSvc.js b/src/services/syncSvc.js index 2ba2c608..8ad21767 100644 --- a/src/services/syncSvc.js +++ b/src/services/syncSvc.js @@ -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; } diff --git a/src/services/workspaceSvc.js b/src/services/workspaceSvc.js index cb2a55df..c950554a 100644 --- a/src/services/workspaceSvc.js +++ b/src/services/workspaceSvc.js @@ -80,7 +80,7 @@ export default { type: 'unauthorizedName', item, }); - throw new Error('Unauthorized name.'); + throw new Error('未经授权的名称。'); } // Show warning dialogs