Skip to content

Commit

Permalink
feat: save self-hosted server details on member info
Browse files Browse the repository at this point in the history
We added support for self-hosted servers in
98d9981. This saves the details to
project-level member info.

This is a follow-up to 1913694.
  • Loading branch information
EvanHahn committed Oct 28, 2024
1 parent 03a2927 commit 818ec15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mapeo-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ export class MapeoProject extends TypedEmitter {
}

/**
* @param {Pick<import('@comapeo/schema').DeviceInfoValue, 'name' | 'deviceType'>} value
* @param {Pick<import('@comapeo/schema').DeviceInfoValue, 'name' | 'deviceType' | 'selfHostedServerDetails'>} value
* @returns {Promise<import('@comapeo/schema').DeviceInfo>}
*/
async [kSetOwnDeviceInfo](value) {
Expand All @@ -640,6 +640,7 @@ export class MapeoProject extends TypedEmitter {
const doc = {
name: value.name,
deviceType: value.deviceType,
selfHostedServerDetails: value.selfHostedServerDetails,
schemaName: /** @type {const} */ ('deviceInfo'),
}

Expand Down
4 changes: 4 additions & 0 deletions src/member-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import { ROLES, isRoleIdForNewInvite } from './roles.js'
* @prop {DeviceInfo['name']} [name]
* @prop {DeviceInfo['deviceType']} [deviceType]
* @prop {DeviceInfo['createdAt']} [joinedAt]
* @prop {object} [selfHostedServerDetails]
* @prop {string} selfHostedServerDetails.baseUrl
*/

export class MemberApi extends TypedEmitter {
Expand Down Expand Up @@ -304,6 +306,8 @@ export class MemberApi extends TypedEmitter {
memberInfo.name = deviceInfo?.name
memberInfo.deviceType = deviceInfo?.deviceType
memberInfo.joinedAt = deviceInfo?.createdAt
memberInfo.selfHostedServerDetails =
deviceInfo?.selfHostedServerDetails
} catch (err) {
// Attempting to get someone else may throw because sync hasn't occurred or completed
// Only throw if attempting to get themself since the relevant information should be available
Expand Down

0 comments on commit 818ec15

Please sign in to comment.