2023-02-04 11:16:53 +01:00
|
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
export async function getMembersToMap(data) {
|
2019-02-12 23:40:12 +01:00
|
|
|
// we will work on the list itself (an ordered array of objects) when a
|
|
|
|
|
// mapping is done, we add a 'wekan' field to the object representing the
|
|
|
|
|
// imported member
|
|
|
|
|
const membersToMap = data.members;
|
|
|
|
|
const users = data.users;
|
|
|
|
|
// auto-map based on username
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
for (const importedMember of membersToMap) {
|
2019-02-12 23:40:12 +01:00
|
|
|
importedMember.id = importedMember.userId;
|
|
|
|
|
delete importedMember.userId;
|
2019-06-28 12:52:09 -05:00
|
|
|
const user = users.filter(user => {
|
2019-02-12 23:40:12 +01:00
|
|
|
return user._id === importedMember.id;
|
|
|
|
|
})[0];
|
|
|
|
|
if (user.profile && user.profile.fullname) {
|
|
|
|
|
importedMember.fullName = user.profile.fullname;
|
|
|
|
|
}
|
|
|
|
|
importedMember.username = user.username;
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
const wekanUser = await ReactiveCache.getUser({ username: importedMember.username });
|
2019-02-12 23:40:12 +01:00
|
|
|
if (wekanUser) {
|
|
|
|
|
importedMember.wekanId = wekanUser._id;
|
|
|
|
|
}
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
}
|
2019-02-12 23:40:12 +01:00
|
|
|
return membersToMap;
|
|
|
|
|
}
|