Skip to content
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 verified check because of identity time drift #6306

Merged
merged 9 commits into from
Oct 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,44 @@ export default async ({ user_id, blocknumber }) => {
const is_verified = current.is_verified
const handle = current.handle

const data = await retry(
async (_) => {
const { data } = await axios
.get(social_handle_url(handle))
.catch(console.error)
let source: str
raymondjacobson marked this conversation as resolved.
Show resolved Hide resolved
try {
const data = await retry(
async (_) => {
const { data } = await axios
.get(social_handle_url(handle))
.catch(console.error)

if (Object.keys(data).length === 0) {
// wait for identity to load
await new Promise((resolve) => {
setTimeout(resolve, 1000)
})
throw new Error('social handles not in identity yet')
}
if (Object.keys(data).length === 0) {
// wait for identity to load
await new Promise((resolve) => {
setTimeout(resolve, 5000)
})
throw new Error('social handles not in identity yet')
}

return data
},
{ retries: 5 }
)
return data
},
{ retries: 100 }
)
const { twitterVerified, instagramVerified, tikTokVerified } = data

const { twitterVerified, instagramVerified, tikTokVerified } = data

let source = 'unknown'
if (twitterVerified) {
source = 'twitter'
}
if (instagramVerified) {
source = 'instagram'
}
if (tikTokVerified) {
source = 'tiktok'
if (twitterVerified) {
source = 'twitter'
}
if (instagramVerified) {
source = 'instagram'
}
if (tikTokVerified) {
source = 'tiktok'
}
} catch (e) {
source = "could not figure out source!"
console.error(e)
}

const header = `User *${handle}* ${
is_verified ? 'is now' : 'is no longer'
} verified via ${source}!`
const header = `User *${handle}* ${is_verified ? 'is now' : 'is no longer'
} verified via ${source}!`

const body = {
userId: user_id,
Expand Down