-
Notifications
You must be signed in to change notification settings - Fork 257
feat(web): Ask share links #888
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2e0b5ab
wip
brendan-kellam a97cb1c
remove isReadonly from chat
brendan-kellam a7b83e8
add unauthenticated chat ownership via session token
brendan-kellam 4f930a6
add banner prompting user to sign in if they are logged out
brendan-kellam e4d8a29
login form improvements
brendan-kellam a86e959
add chat duplication
brendan-kellam 7807a4c
show share chat popover to unauthed user as well
brendan-kellam 502df01
add duplicate to chat actions dropdown
brendan-kellam ea86117
wip on opengraph image
brendan-kellam 661ece2
Add invite users menu to share panel
brendan-kellam 39db1a4
move things to ee
brendan-kellam caa2d1c
changelog
brendan-kellam 908666e
docs
brendan-kellam 9b3f88d
remove default opengraph image
brendan-kellam 1952c20
chat sharing funnel
brendan-kellam 524e1cc
sign in banner events
brendan-kellam 6dbdcde
more events
brendan-kellam f4b61d6
event nit
brendan-kellam 331e5e5
Merge branch 'main' into bkellam/ask-share-links-SOU-65
brendan-kellam 7b14954
nit
brendan-kellam 5703670
fix broken links
brendan-kellam 55b06a7
feedback
brendan-kellam ec5d1c4
feedback
brendan-kellam f1dce1d
audit logs
brendan-kellam 8eb70a7
feedback
brendan-kellam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/db/prisma/migrations/20260213025236_remove_chat_isreadonly/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| Warnings: | ||
|
|
||
| - You are about to drop the column `isReadonly` on the `Chat` table. All the data in the column will be lost. | ||
| */ | ||
| -- AlterTable | ||
| ALTER TABLE "Chat" DROP COLUMN "isReadonly"; |
2 changes: 2 additions & 0 deletions
2
packages/db/prisma/migrations/20260213030000_add_chat_anonymous_creator_id/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Chat" ADD COLUMN "anonymousCreatorId" TEXT; |
18 changes: 18 additions & 0 deletions
18
packages/db/prisma/migrations/20260214004710_add_chat_access_table/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "ChatAccess" ( | ||
| "id" TEXT NOT NULL, | ||
| "chatId" TEXT NOT NULL, | ||
| "userId" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "ChatAccess_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "ChatAccess_chatId_userId_key" ON "ChatAccess"("chatId", "userId"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "ChatAccess" ADD CONSTRAINT "ChatAccess_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "ChatAccess" ADD CONSTRAINT "ChatAccess_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { Script } from "../scriptRunner"; | ||
| import { PrismaClient } from "../../dist"; | ||
| import { confirmAction } from "../utils"; | ||
|
|
||
| const mockUsers = [ | ||
| { name: "Alice Johnson", email: "alice.johnson@example.com" }, | ||
| { name: "Bob Smith", email: "bob.smith@example.com" }, | ||
| { name: "Charlie Brown", email: "charlie.brown@example.com" }, | ||
| { name: "Diana Prince", email: "diana.prince@example.com" }, | ||
| { name: "Ethan Hunt", email: "ethan.hunt@example.com" }, | ||
| { name: "Fiona Green", email: "fiona.green@example.com" }, | ||
| { name: "George Miller", email: "george.miller@example.com" }, | ||
| { name: "Hannah Lee", email: "hannah.lee@example.com" }, | ||
| { name: "Ivan Petrov", email: "ivan.petrov@example.com" }, | ||
| { name: "Julia Chen", email: "julia.chen@example.com" }, | ||
| ]; | ||
|
|
||
| export const injectUserData: Script = { | ||
| run: async (prisma: PrismaClient) => { | ||
| const orgId = 1; | ||
|
|
||
| // Check if org exists | ||
| const org = await prisma.org.findUnique({ | ||
| where: { id: orgId } | ||
| }); | ||
|
|
||
| if (!org) { | ||
| console.error(`Organization with id ${orgId} not found. Please create it first.`); | ||
| return; | ||
| } | ||
|
|
||
| console.log(`Injecting ${mockUsers.length} mock users for organization: ${org.name} (${org.domain})`); | ||
|
|
||
| confirmAction(); | ||
|
brendan-kellam marked this conversation as resolved.
|
||
|
|
||
| const createdUsers: { id: string; email: string | null; name: string | null }[] = []; | ||
|
|
||
| for (const mockUser of mockUsers) { | ||
| // Check if user already exists | ||
| const existingUser = await prisma.user.findUnique({ | ||
| where: { email: mockUser.email } | ||
| }); | ||
|
|
||
| if (existingUser) { | ||
| console.log(`User ${mockUser.email} already exists, skipping...`); | ||
| createdUsers.push(existingUser); | ||
| continue; | ||
| } | ||
|
|
||
| // Create the user | ||
| const user = await prisma.user.create({ | ||
| data: { | ||
| name: mockUser.name, | ||
| email: mockUser.email, | ||
| } | ||
| }); | ||
|
|
||
| console.log(`Created user: ${user.name} (${user.email})`); | ||
| createdUsers.push(user); | ||
| } | ||
|
|
||
| // Add users to the organization | ||
| for (const user of createdUsers) { | ||
| // Check if already a member | ||
| const existingMembership = await prisma.userToOrg.findUnique({ | ||
| where: { | ||
| orgId_userId: { | ||
| orgId, | ||
| userId: user.id, | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| if (existingMembership) { | ||
| console.log(`User ${user.email} is already a member of the org, skipping...`); | ||
| continue; | ||
| } | ||
|
|
||
| await prisma.userToOrg.create({ | ||
| data: { | ||
| orgId, | ||
| userId: user.id, | ||
| role: "MEMBER", | ||
| } | ||
| }); | ||
|
|
||
| console.log(`Added ${user.email} to organization`); | ||
| } | ||
|
|
||
| console.log(`\nUser data injection complete!`); | ||
| console.log(`Total users created/found: ${createdUsers.length}`); | ||
|
|
||
| // Show org membership count | ||
| const memberCount = await prisma.userToOrg.count({ | ||
| where: { orgId } | ||
| }); | ||
| console.log(`Total org members: ${memberCount}`); | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.