1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

JS-5769: fix

This commit is contained in:
Andrew Simachev 2024-11-07 11:26:15 +01:00
parent 3c61d189f6
commit 59a8499054
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF
2 changed files with 2 additions and 31 deletions

View file

@ -244,7 +244,6 @@ class Dispatcher {
if (id == rootId) {
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
};
updateParents = true;
@ -816,7 +815,6 @@ class Dispatcher {
S.Detail.delete(rootId, id, keys);
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
updateMarkup = true;
break;
@ -1073,7 +1071,6 @@ class Dispatcher {
};
S.Block.checkBlockType(rootId);
S.Block.checkBlockChat(rootId);
};
if (undefined !== details.setOf) {
@ -1178,7 +1175,6 @@ class Dispatcher {
S.Block.updateNumbers(contextId);
S.Block.updateMarkup(contextId);
S.Block.checkBlockType(contextId);
S.Block.checkBlockChat(contextId);
keyboard.setWindowTitle();
};

View file

@ -585,8 +585,9 @@ class BlockStore {
checkBlockType (rootId: string) {
const { header, type } = J.Constant.blockId;
const element = this.getMapElement(rootId, header);
const canWrite = U.Space.canMyParticipantWrite();
if (!element) {
if (!element || !canWrite) {
return;
};
@ -606,32 +607,6 @@ class BlockStore {
return header ? header.childrenIds.includes(J.Constant.blockId.type) : false;
};
checkBlockChat (rootId: string) {
return;
const element = this.getMapElement(rootId, rootId);
if (!element) {
return;
};
const object = S.Detail.get(rootId, rootId, [ 'layout', 'chatId' ], true);
if (U.Object.isChatLayout(object.layout)) {
return;
};
if (object.chatId && !this.checkBlockChatExists(rootId)) {
const childrenIds = element.childrenIds.concat(J.Constant.blockId.chat);
this.updateStructure(rootId, rootId, childrenIds);
};
};
checkBlockChatExists (rootId: string): boolean {
const element = this.getMapElement(rootId, rootId);
return element ? element.childrenIds.includes(J.Constant.blockId.chat) : false;
};
getLayoutIds (rootId: string, ids: string[]) {
if (!ids.length) {
return [];