Skip to content

Commit 50ccd9a

Browse files
improved assept invititation
1 parent 8821845 commit 50ccd9a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Codespace_Service/src/controllers/codespaceController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ export class CodespaceController {
124124
code: "INVALID_EMAIL",
125125
});
126126
}
127-
//console.log("Sharing codespace by email:", id, email, req.user.id);
128127

129128
const result = await CodespaceService.shareCodespaceByEmail(
130129
id,

Codespace_Service/src/services/codespaceService.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ export class CodespaceService {
328328
throw new Error(`Failed to insert invitation: ${insertError.message}`);
329329
}
330330

331+
console.log("Waitinggggggg tooooo Shareeeee Maiiiiill");
332+
331333
// Configure SMTP transport
332334
const transporter = nodemailer.createTransport({
333335
service: "Gmail",
@@ -383,9 +385,16 @@ export class CodespaceService {
383385
</html>
384386
385387
`,
388+
headers: {
389+
"X-Priority": "1",
390+
Importance: "high",
391+
},
392+
// Add a text alternative for better spam scores
393+
text: `You've been invited to collaborate on a codespace as a ${role}. Join at: ${shareLink}`,
386394
};
387395

388-
await transporter.sendMail(mailOptions);
396+
const info = await transporter.sendMail(mailOptions);
397+
console.log("Maillllllllllllllllll", info);
389398

390399
return { invitation };
391400
} catch (err) {

Frontend/src/App/Dashboard/AcceptInvite.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ const CollaboratePage: React.FC = () => {
121121

122122
const loginEmail = getLoginMail();
123123
const handleLoginRedirect = () => {
124+
// Remove previous auth session from local storage
125+
const storageKey = `sb-${
126+
import.meta.env.VITE_SUPABASE_PROJECT_ID
127+
}-auth-token`;
128+
localStorage.removeItem(storageKey);
129+
124130
localStorage.setItem("invitationId", invitationId || "");
125131
navigate("/login", { state: { invitationId } });
126132
};

0 commit comments

Comments
 (0)