-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: write own device info when creating and adding projects #297
Merged
Merged
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
669bda5
fix: write device info to projects when instatiating
achou11 48b6f37
expose method on project for manager to call instead
achou11 aabd9c5
Merge branch 'main' into 289/project-device-info-init
achou11 5ee69d1
fix device info tests failing
achou11 d1d11ba
replace unit tests for MemberApi with e2e for member namespace
achou11 decf3df
Merge branch 'main' into 289/project-device-info-init
achou11 98d9f8c
simplify device info tests
achou11 f5faf8c
Merge branch 'main' into 289/project-device-info-init
achou11 4d16c83
Merge branch 'main' into 289/project-device-info-init
achou11 978b2e9
Merge branch 'main' into 289/project-device-info-init
achou11 e057b4f
Merge branch 'main' into 289/project-device-info-init
achou11 03b0f75
fix failing device info test
achou11 9582f71
Merge branch 'main' into 289/project-device-info-init
achou11 3da7966
Merge branch 'main' into 289/project-device-info-init
achou11 0eb9bd8
update getById and getMany methods in member api
achou11 b2389bf
Merge branch 'main' into 289/project-device-info-init
achou11 c0a7fa1
Merge branch 'main' into 289/project-device-info-init
achou11 2231458
Merge branch 'main' into 289/project-device-info-init
achou11 81e8d7b
make setOwnDeviceInfo private symbol prop
achou11 1a62ea8
update member api constructor deviceKey prop to deviceId
achou11 b98fb79
remove todo comment
achou11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,10 +219,16 @@ export class MapeoManager { | |
// 5. Write project name and any other relevant metadata to project instance | ||
await project.$setProjectSettings(settings) | ||
|
||
// 6. Write device info into project | ||
const deviceInfo = await this.getDeviceInfo() | ||
if (deviceInfo.name) { | ||
await project.$setOwnDeviceInfo({ name: deviceInfo.name }) | ||
} | ||
|
||
// TODO: Close the project instance instead of keeping it around | ||
this.#activeProjects.set(projectPublicId, project) | ||
|
||
// 6. Return project public id | ||
// 7. Return project public id | ||
return projectPublicId | ||
} | ||
|
||
|
@@ -365,6 +371,14 @@ export class MapeoManager { | |
projectInfo, | ||
}) | ||
|
||
// 5. Write device info into project | ||
const deviceInfo = await this.getDeviceInfo() | ||
|
||
if (deviceInfo.name) { | ||
const project = await this.getProject(projectPublicId) | ||
await project.$setOwnDeviceInfo({ name: deviceInfo.name }) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same concern as previously stated regarding needing to call |
||
|
||
return projectPublicId | ||
} | ||
|
||
|
@@ -382,6 +396,15 @@ export class MapeoManager { | |
set: values, | ||
}) | ||
.run() | ||
|
||
const listedProjects = await this.listProjects() | ||
|
||
await Promise.all( | ||
listedProjects.map(async ({ projectId }) => { | ||
const project = await this.getProject(projectId) | ||
await project.$setOwnDeviceInfo(deviceInfo) | ||
}) | ||
) | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if this is desired behavior or not. keeping this means that one should call
manager.setDeviceInfo()
before adding or creating a project. Otherwise, attempting to use the$member
namespace causes issues.