Skip to content

Commit ea2c0c4

Browse files
committed
fix twitter links
1 parent a0c3dc7 commit ea2c0c4

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

backend/src/users/users.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export class UsersService {
6666
});
6767
}
6868

69+
const previousHandle = user.twitterHandle;
70+
6971
// Update Twitter data
7072
user.twitterHandle = twitterHandle;
7173
user.twitterId = twitterId;
@@ -74,7 +76,11 @@ export class UsersService {
7476

7577
await this.userRepository.save(user);
7678

77-
this.logger.log(`Linked Twitter @${twitterHandle} to ${address}`);
79+
if (previousHandle && previousHandle !== twitterHandle) {
80+
this.logger.log(`Refreshed Twitter handle for ${address}: @${previousHandle} → @${twitterHandle}`);
81+
} else {
82+
this.logger.log(`Linked Twitter @${twitterHandle} to ${address}`);
83+
}
7884

7985
return {
8086
address: user.address,

frontend/app/profile/page.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useWallet } from "@/contexts/WalletContext";
55
import Header from "@/components/Header";
66
import Footer from "@/components/Footer";
77
import UnifiedBackground from "@/components/UnifiedBackground";
8-
import { Twitter, CheckCircle, XCircle, Shield } from "lucide-react";
8+
import { Twitter, CheckCircle, XCircle, Shield, RefreshCw } from "lucide-react";
99
import {
1010
generateCodeVerifier,
1111
generateCodeChallenge,
@@ -466,6 +466,20 @@ export default function ProfilePage() {
466466
</p>
467467
</div>
468468

469+
<button
470+
onClick={handleLinkTwitter}
471+
disabled={linking}
472+
className="w-full py-3 px-4 bg-blue-500/20 hover:bg-blue-500/30 border border-blue-500/50 text-blue-400 font-semibold rounded-xl transition disabled:opacity-50 flex items-center justify-center gap-2"
473+
>
474+
<RefreshCw className={`w-4 h-4 ${linking ? "animate-spin" : ""}`} />
475+
{linking ? "Refreshing..." : "Refresh Twitter Info"}
476+
</button>
477+
478+
<p className="text-gray-500 text-xs text-center -mt-2">
479+
Changed your Twitter username or photo? Refresh to update it
480+
here.
481+
</p>
482+
469483
<button
470484
onClick={handleUnlinkTwitter}
471485
disabled={linking}

0 commit comments

Comments
 (0)