Page MenuHomePhabricator

[identity] don't let linkFarcasterAccount overwrite existing fid for user
ClosedPublic

Authored by varun on Mar 27 2024, 1:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 31, 5:58 AM
Unknown Object (File)
Sun, Mar 30, 2:04 PM
Unknown Object (File)
Sun, Mar 30, 12:54 PM
Unknown Object (File)
Sat, Mar 29, 12:33 PM
Unknown Object (File)
Feb 21 2025, 5:57 AM
Unknown Object (File)
Feb 18 2025, 7:06 PM
Unknown Object (File)
Feb 18 2025, 7:06 PM
Unknown Object (File)
Feb 18 2025, 7:06 PM
Subscribers

Details

Summary
Test Plan

tried calling linkFarcasterAccount multiple times. attempts with the same FID succeeded but attempts with a different FID failed.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun requested review of this revision.Mar 27 2024, 1:40 PM
This comment was removed by ashoat.
bartek added inline comments.
services/identity/src/database/farcaster.rs
68–72 ↗(On Diff #38389)

You don't have to provide the same value twice

88 ↗(On Diff #38389)

Does UpdateExpression if_not_exists fail the operation if given value already exists? The docs don't say this explicitly, but I guess

  • if_not_exists (path, value)

If the item does not contain an attribute at the specified path, if_not_exists evaluates to value; otherwise, it evaluates to path.

means that if the ID already exists, the expression evaluates to SET farcasterID = farcasterID so it's a no-op.

According to your test plan, it succeeds so it's alright

This revision is now accepted and ready to land.Mar 27 2024, 11:20 PM
services/identity/src/database/farcaster.rs
88 ↗(On Diff #38389)

yeah i checked and it succeeds so assuming DDB treats it as a no-op