Changeset 7fbb91c for chapterx-frontend/src/components
- Timestamp:
- 03/24/26 23:03:39 (3 months ago)
- Branches:
- main
- Children:
- a7550ca
- Parents:
- 73b69b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapterx-frontend/src/components/writer/CollaboratorManager.tsx
r73b69b2 r7fbb91c 32 32 }) => { 33 33 const { collaborations, addCollaboration, removeCollaboration, updateCollaborationPermission } = useStoryStore() 34 const { allUsers } = useAuthStore()34 const { allUsers, fetchAllUsers } = useAuthStore() 35 35 const { addNotification } = useNotificationStore() 36 36 const { addToast } = useUIStore() … … 43 43 const storyCollabs = collaborations.filter(c => c.story_id === storyId) 44 44 const collabUserIds = new Set(storyCollabs.map(c => c.user_id)) 45 const availableUsers = allUsers.filter(u => u.user_id !== ownerId && !collabUserIds.has(u.user_id) )45 const availableUsers = allUsers.filter(u => u.user_id !== ownerId && !collabUserIds.has(u.user_id) && (u.role === 'writer' || u.role === 'admin')) 46 46 47 47 const handleInvite = () => { … … 62 62 addCollaboration(newCollab) 63 63 addNotification({ 64 user_id: user.user_id,64 recipientUserId: user.user_id, 65 65 type: 'collaboration', 66 title: 'Collaboration Invite', 67 message: `You've been invited to collaborate on "${storyTitle}" as ${selectedRole}.`, 66 content: `You've been invited to collaborate on "${storyTitle}" as ${selectedRole}.`, 68 67 link: `/story/${storyId}`, 69 68 }) … … 86 85 <span className="text-xs text-slate-500">({storyCollabs.length})</span> 87 86 </div> 88 <Button size="sm" onClick={() => setInviteOpen(true)}>87 <Button size="sm" onClick={() => { fetchAllUsers(); setInviteOpen(true) }}> 89 88 <UserPlus size={14} /> 90 89 Invite … … 149 148 {availableUsers.map(u => ( 150 149 <option key={u.user_id} value={u.username}> 151 @{u.username} ({u.role})150 @{u.username} 152 151 </option> 153 152 ))}
Note:
See TracChangeset
for help on using the changeset viewer.
