Browse Source

fix(nocodb): revise user project list delete logic

pull/5770/head
Wing-Kam Wong 1 year ago
parent
commit
e3a06191e3
  1. 15
      packages/nocodb/src/models/ProjectUser.ts

15
packages/nocodb/src/models/ProjectUser.ts

@ -194,11 +194,16 @@ export default class ProjectUser {
const { isNoneList } = cachedList; const { isNoneList } = cachedList;
if (!isNoneList && cachedProjectList?.length) { if (!isNoneList && cachedProjectList?.length) {
cachedProjectList = cachedProjectList.filter((p) => p.id !== projectId); cachedProjectList = cachedProjectList.filter((p) => p.id !== projectId);
await NocoCache.setList( // delete the whole list first so that the old one won't be included
CacheScope.USER_PROJECT, await NocoCache.del(`${CacheScope.USER_PROJECT}:${userId}:list`);
[userId], if (cachedProjectList.length > 0) {
cachedProjectList, // set the updated list (i.e. excluding the to-be-deleted project id)
); await NocoCache.setList(
CacheScope.USER_PROJECT,
[userId],
cachedProjectList,
);
}
} }
await NocoCache.del(`${CacheScope.PROJECT_USER}:${projectId}:${userId}`); await NocoCache.del(`${CacheScope.PROJECT_USER}:${projectId}:${userId}`);

Loading…
Cancel
Save