Skip to content

Commit

Permalink
🔀 Merge #1833 to deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Sep 25, 2024
2 parents d96e119 + be7db60 commit bd1f7ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion functions/.env.civic-liker-develop
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ AUTHCORE_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKY6MShC7UrSkekyczKKvZQXuxFKD
Rd0DEgV6r9XeDAZoYPPTvgx3oNBTatFJjSOJ/qRrBbqvbZDiPOLpJ7vlaQ==
-----END PUBLIC KEY-----"
CRISP_WEBSITE_ID=4e80ff4a-e151-4393-a09b-14e6342ad11d/inbox/
CRISP_WEBSITE_ID=4e80ff4a-e151-4393-a09b-14e6342ad11d
16 changes: 10 additions & 6 deletions src/server/api/util/crisp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ function getCrispUserHash(email) {

async function upsertCrispProfile(email, { displayName, wallet, loginMethod }) {
if (!isCrispPluginEnabled) return;
let peopleExists = false;
let people = null;
try {
await CrispClient.website.checkPeopleProfileExists(CRISP_WEBSITE_ID, email);
peopleExists = true;
} catch {}
if (peopleExists) {
people = await CrispClient.website.getPeopleProfile(
CRISP_WEBSITE_ID,
email
);
} catch {
// do nothing
}
if (people) {
await CrispClient.website.updatePeopleProfile(CRISP_WEBSITE_ID, email, {
person: {
nickname: displayName || wallet,
Expand All @@ -47,7 +51,7 @@ async function upsertCrispProfile(email, { displayName, wallet, loginMethod }) {
await CrispClient.website.addNewPeopleProfile(CRISP_WEBSITE_ID, {
email,
person: {
nickname: displayName || wallet,
nickname: displayName || wallet || email.split('@')[0],
},
active: Math.floor(Date.now() / 1000),
});
Expand Down

0 comments on commit bd1f7ad

Please sign in to comment.