1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: Server: Clean up

This commit is contained in:
Laurent Cozic 2023-02-06 18:58:51 +00:00
parent ba5f0bc6e3
commit 9ed022458b
3 changed files with 4 additions and 10 deletions

View File

@ -22,6 +22,8 @@
# ./runForTesting.sh 1 createUsers,createData,reset,sync && ./runForTesting.sh 2 reset,sync && ./runForTesting.sh 1
# ./runForTesting.sh 1 createUsers,createData,reset,sync && ./runForTesting.sh 2 reset,sync && ./runForTesting.sh 3 reset,sync && ./runForTesting.sh 1
# ----------------------------------------------------------------------------------
# To create two client profiles, in sync, both used by the same user:
# ----------------------------------------------------------------------------------

View File

@ -1,4 +1,3 @@
import { ModelType } from '@joplin/lib/BaseModel';
import { resourceBlobPath } from '../utils/joplinUtils';
import { Change, ChangeType, Item, Share, ShareType, ShareUserStatus, User, Uuid } from '../services/database/types';
import { unique } from '../utils/array';
@ -198,20 +197,12 @@ export default class ShareModel extends BaseModel<Share> {
};
const handleCreated = async (change: Change, item: Item, share: Share) => {
// console.info('CREATE ITEM', item);
// console.info('CHANGE', change);
// if (![ModelType.Note, ModelType.Folder, ModelType.Resource].includes(item.jop_type)) return;
if (!item.jop_share_id) return;
const shareUserIds = await this.allShareUserIds(share);
for (const shareUserId of shareUserIds) {
if (shareUserId === change.user_id) continue;
await addUserItem(shareUserId, item.id);
if (item.jop_type === ModelType.Resource) {
// const resourceItem = await this.models().item().loadByName(change.user_id, resourceBlobPath(
}
}
};

View File

@ -54,11 +54,12 @@ export async function createTestUsers(db: DbConnection, config: Config, options:
await dropTables(db);
await migrateLatest(db);
for (let userNum = 1; userNum <= 2; userNum++) {
for (let userNum = 1; userNum <= 3; userNum++) {
await models.user().save({
email: `user${userNum}@example.com`,
password,
full_name: `User ${userNum}`,
account_type: AccountType.Pro,
});
}