feat(frontend): public channels, self-excluded member picker, editable display name
- create-channel modal: Public checkbox (default off), self excluded from member list (creator auto-added), shows member display names - Settings modal to edit your own display name - members panel shows names and marks (you) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import { clearAuthSession, getAuthSession, isAccessTokenStale, setAuthSession } from '../lib/auth-storage'
|
||||
import type { AuthSession } from '../lib/auth-storage'
|
||||
import { loginCenter, logoutCenter, meGuildsCenter, refreshCenter } from '../lib/center-auth-client'
|
||||
import { loginCenter, logoutCenter, meGuildsCenter, refreshCenter, updateMeNameCenter } from '../lib/center-auth-client'
|
||||
import { AuthContext } from './auth-context'
|
||||
import type { AuthContextValue } from './auth-context'
|
||||
|
||||
@@ -72,6 +72,22 @@ export function AuthProvider({ children }: PropsWithChildren) {
|
||||
setAuthSession(next)
|
||||
setSession(next)
|
||||
},
|
||||
updateName: async (name: string) => {
|
||||
if (!session) return
|
||||
const accessToken = (await (async () => {
|
||||
if (!isAccessTokenStale(session.accessToken)) return session.accessToken
|
||||
const refreshed = await refreshCenter(session.centerApiBase, session.refreshToken)
|
||||
return refreshed.accessToken
|
||||
})())
|
||||
const updated = await updateMeNameCenter(session.centerApiBase, accessToken, name)
|
||||
const next: AuthSession = {
|
||||
...session,
|
||||
accessToken,
|
||||
user: { ...session.user, name: updated.name },
|
||||
}
|
||||
setAuthSession(next)
|
||||
setSession(next)
|
||||
},
|
||||
}),
|
||||
[session],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user