1
0
mirror of https://github.com/laurent22/joplin.git synced 2026-04-18 19:42:23 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Laurent Cozic 4a5a125360 update 2026-04-17 08:26:32 +01:00
2 changed files with 9 additions and 7 deletions
+8 -2
View File
@@ -1026,10 +1026,16 @@ export default class ItemModel extends BaseModel<Item> {
// but it would be nice to get to the bottom of this bug.
public processOrphanedItems = async () => {
await this.withTransaction(async () => {
// Find items that have no corresponding entry in user_items.
// NOT EXISTS is used instead of LEFT JOIN for performance as it
// allows Postgres to short-circuit on the first match per item.
const orphanedItems: Item[] = await this.db(this.tableName)
.select(['items.id', 'items.owner_id'])
.leftJoin('user_items', 'user_items.item_id', 'items.id')
.whereNull('user_items.user_id');
.whereNotExists(
this.db('user_items')
.select(this.db.raw('1'))
.whereRaw('user_items.item_id = items.id'),
);
const userIds: string[] = orphanedItems.map(i => i.owner_id);
const users = await this.models().user().loadByIds(userIds, { fields: ['id'] });
+1 -5
View File
@@ -31,11 +31,7 @@ const subRoutes: Record<string, RouteHandler> = {
try {
await ctx.joplin.models.user().sendResetPasswordEmail(fields.email || '');
} catch (error) {
if (error instanceof ErrorNotFound) {
logger.info(`Could not send reset email for ${fields.email}`, error);
} else {
logger.warn(`Could not send reset email for ${fields.email}`, error);
}
logger.warn(`Could not send reset email for ${fields.email}`, error);
}
confirmationMessage = 'If we have an account that matches your email, you should receive an email with instructions on how to reset your password shortly.';