Skip to content

Commit

Permalink
Chore: Server: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Feb 6, 2023
1 parent ba5f0bc commit 9ed0224
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions packages/app-desktop/runForTesting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# ----------------------------------------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions packages/server/src/models/ShareModel.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
}
}
};

Expand Down
3 changes: 2 additions & 1 deletion packages/server/src/tools/debugTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down

0 comments on commit 9ed0224

Please sign in to comment.