Skip to content

feat(core): align connection note and connection history item IDs… #1289

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

Open
wants to merge 16 commits into
base: feature/VT20-1908-updates-to-creation-and-deletion-of-connections
Choose a base branch
from

Conversation

Sotatek-DucPhung
Copy link
Collaborator

@Sotatek-DucPhung Sotatek-DucPhung commented Jul 30, 2025

Description

Align connection note and connection history item IDs in the cloud with new schema

  • Ensure the account identifier prefixes the connection note and connection history item IDs
  • Ensure when fetching the connection for a given account, that only notes and history items for the selected account are returned
  • Ensure the correct createdAt date is returned
  • Removed ConnectionRecord and update all logics related

Checklist before requesting a review

Issue ticket number and link

  • This PR has a valid ticket number or issue: VT20-1912

Testing & Validation

  • This PR has been tested/validated in iOS, Android and browser.
  • Added new unit tests, if relevant.

if (identifier) {
const connectionPair = await this.connectionPairStorage.findById(
`${identifier}:${contactId}`
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move this logic to getConnectionShortDetailById so it's easier to follow. getContactMetadataById should just return a contact, not a full connection.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then we can remove the ContactDetailsRecord type

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think so. We have the getConnectionShortDetails function calling this, and it requires the full connection. Also, getConnectionShortDetails is called from many places

@@ -313,14 +316,15 @@ class ConnectionService extends AgentService {
contactId: record.id,
...(record.groupId
? { groupId: record.groupId }
: { identifier: record.identifier }),
: { identifier: record.identifier ?? "" }),
};
}

@OnlineOnly
async getConnectionById(
id: string,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to id to contactId everywhere we are passing the contact ID tbh

@@ -109,7 +109,8 @@ const CredentialDetailModule = ({
await Agent.agent.connections.getConnectionShortDetailById(
connectionId
);
setConnectionShortDetails(shortDetails);
// Credentials are only associated with regular connections
setConnectionShortDetails(shortDetails as RegularConnectionDetails);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets use function overloads to tighten things, and remove our usage of as.

  async getConnectionShortDetailById(id: string): Promise<MultisigConnectionDetails>
  async getConnectionShortDetailById(id: string, identifier: string): Promise<RegularConnectionDetails>;
  async getConnectionShortDetailById(
    id: string,
    identifier?: string
  ): Promise<MultisigConnectionDetails | RegularConnectionDetails> {

We might be able to remove ConnectionShortDetails completely which forces our functions to overload correctly like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

setNotes(connectionDetails.notes || []);
setConnectionHistory(connectionDetails.historyItems || []);
// Since this component only handles regular connections, cast to RegularConnectionDetailsFull
setConnectionDetails(connectionDetails as RegularConnectionDetailsFull);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here I presume

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -120,7 +120,8 @@ const Connections = () => {
const getConnectionShortDetails = async (connectionId: string) => {
const shortDetails =
await Agent.agent.connections.getConnectionShortDetailById(connectionId);
setConnectionShortDetails(shortDetails);
// Connections page only shows details for regular connections
setConnectionShortDetails(shortDetails as RegularConnectionDetails);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

iFergal and others added 5 commits July 31, 2025 13:59
@jimcase jimcase self-requested a review August 1, 2025 09:35
* feat: recovery contacts per identifier

* fix: getAllIdentifiers

* fix: vuln id

* fix: contact.createdAt

* fix: date in unit test
@jimcase jimcase requested a review from obstar August 1, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants