fix: member status visibility, team creation improvements, join approval flow
- Fix other members' status not visible due to users collection viewRule restriction - Fix empty status treated as 'away' instead of 'idle' in membersByStatus - Auto-set creator to 'in_team' status when creating team session - Filter current user from idle members invite list - Fix group store isGroupOwner using pb.authStore instead of localStorage - Add nginx no-cache headers for index.html - Add join_requests collection migration and join approval flow - Update groups collection rules and add requireApproval field - Add Memory types for Phase 2 planning Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useGroupStore } from '@/stores/group'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import type { UserStatus } from '@/types'
|
||||
import { sendInvitation } from '@/api/invitations'
|
||||
import { ElMessage } from 'element-plus'
|
||||
@@ -15,9 +16,10 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
})
|
||||
|
||||
const groupStore = useGroupStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const idleMembers = computed(() =>
|
||||
groupStore.currentMembers.filter(m => m.status === props.status)
|
||||
groupStore.currentMembers.filter(m => m.status === props.status && m.id !== userStore.userId)
|
||||
)
|
||||
|
||||
async function inviteMember(userId: string, username: string) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { Group, User } from '@/types'
|
||||
import { pb } from '@/api/pocketbase'
|
||||
import { getUserGroups, getGroup, getGroupMembers } from '@/api/groups'
|
||||
|
||||
export const useGroupStore = defineStore('group', () => {
|
||||
@@ -14,8 +15,7 @@ export const useGroupStore = defineStore('group', () => {
|
||||
// 计算属性
|
||||
const currentGroupId = computed(() => currentGroup.value?.id || '')
|
||||
const isGroupOwner = computed(() => {
|
||||
const userId = localStorage.getItem('userId')
|
||||
return currentGroup.value?.owner === userId
|
||||
return currentGroup.value?.owner === pb.authStore.model?.id
|
||||
})
|
||||
|
||||
// 加载用户的群组列表
|
||||
|
||||
@@ -44,8 +44,15 @@ export const useTeamStore = defineStore('team', () => {
|
||||
const session = await createTeamSession(data)
|
||||
currentSession.value = session
|
||||
|
||||
// 发送邀请(排除创建者自己)
|
||||
// 设置创建者状态为组队中
|
||||
const currentUserId = pb.authStore.model?.id
|
||||
if (currentUserId) {
|
||||
try {
|
||||
await pb.collection('users').update(currentUserId, { status: 'in_team' })
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
// 发送邀请(排除创建者自己)
|
||||
const others = data.members.filter(id => id !== currentUserId)
|
||||
if (others.length > 0) {
|
||||
await sendBulkInvitations(others, session.id)
|
||||
|
||||
@@ -170,3 +170,24 @@ export interface JoinRequest {
|
||||
user?: User
|
||||
}
|
||||
}
|
||||
|
||||
// 多媒体记忆类型 (二期规划)
|
||||
export type MemoryFileType = 'image' | 'video' | 'audio' | 'other'
|
||||
|
||||
// 多媒体记忆 (二期规划)
|
||||
export interface Memory {
|
||||
id: string
|
||||
groupId: string
|
||||
uploader: string
|
||||
title: string
|
||||
description?: string
|
||||
file: string
|
||||
fileType: MemoryFileType
|
||||
size: number
|
||||
created: string
|
||||
updated: string
|
||||
expand?: {
|
||||
uploader?: User
|
||||
group?: Group
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,9 @@ const membersByStatus = computed(() => {
|
||||
away: []
|
||||
}
|
||||
for (const m of members.value) {
|
||||
if (groups[m.status]) {
|
||||
groups[m.status].push(m)
|
||||
const s = m.status || 'idle'
|
||||
if (groups[s]) {
|
||||
groups[s].push(m)
|
||||
} else {
|
||||
groups.away.push(m)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user