Page MenuHomePhabricator

[keyserver][lib] Add ACKNOWLEDGE relationship action
ClosedPublic

Authored by inka on Jun 4 2024, 7:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 6, 1:15 AM
Unknown Object (File)
Wed, Dec 4, 6:21 PM
Unknown Object (File)
Nov 13 2024, 12:45 AM
Unknown Object (File)
Nov 11 2024, 2:44 AM
Unknown Object (File)
Nov 10 2024, 6:46 PM
Unknown Object (File)
Nov 10 2024, 6:45 PM
Unknown Object (File)
Nov 10 2024, 12:55 PM
Unknown Object (File)
Oct 11 2024, 5:46 AM
Subscribers

Details

Summary

issue: ENG-7822
We need to fetch avatars for users the client has become aware of. We want the keyserver to remember that the users now know of each other and send an update to the second user.
So we will use the updates to obtain the avatar - we will call an endpoint that will update the relationshipt to "KNOW_OF", if there is no other undirected relationship. This endpoint will create updates if needed

Test Plan

Dispatched updateRelationship with relationshipActions.ACKNOWLEDGE and checked that both users get and update, and if the user has an avatar set, this avatar is sent in the update. Checked in the keyserver db that the users now have a KNOW_OF relationship

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

keyserver/src/updaters/relationship-updaters.js
257 ↗(On Diff #40962)

updateChangedUndirectedRelationships only updates the relationship if there was none, or the relationship status provided it greater than the one in the db. This will not be the case here, because KNOW_OF is 0-the lowest possible value. So we will not override a more meaningful relationship.

inka requested review of this revision.Jun 4 2024, 8:12 AM
tomek added inline comments.
keyserver/src/updaters/relationship-updaters.js
257 ↗(On Diff #40962)

Makes sense, but is there an easy way of checking if the relationship doesn't need to be updated?

This revision is now accepted and ready to land.Jun 5 2024, 2:26 AM
keyserver/src/updaters/relationship-updaters.js
257 ↗(On Diff #40962)

The only thing this function does is checking if the relationship needs to be updated, and if so updates it. So I don't think it makes sense to duplicate this logic.
We discussed this offline and agreed that this code makes sense and can be left as is.