fix EditGroup (#225)

This commit is contained in:
Bullish Bear 2023-10-09 21:55:44 +08:00 committed by GitHub
parent ea4199d05b
commit 65186eee5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -365,7 +365,7 @@ export async function* UI_Interaction_Update(args: {
<EditGroup
emit={eventBus.emit}
publicKey={event.publicKey}
conversationLists={app.conversationLists}
profileGetter={app.database}
/>
),
});

View File

@ -8,8 +8,8 @@ import { ButtonClass, InputClass, LinearGradientsClass } from "./components/tw.t
import { Avatar } from "./components/avatar.tsx";
import { ProfileData } from "../features/profile.ts";
import { emitFunc } from "../event-bus.ts";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts";
import { ConversationLists } from "./conversation-list.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts";
import { ProfileGetter } from "./search.tsx";
export type StartEditGroupChatProfile = {
type: "StartEditGroupChatProfile";
@ -25,7 +25,7 @@ export type EditGroupChatProfile = {
type Props = {
emit: emitFunc<EditGroupChatProfile>;
publicKey: PublicKey;
conversationLists: ConversationLists;
profileGetter: ProfileGetter;
};
type State = {
@ -54,6 +54,15 @@ export class EditGroup extends Component<Props, State> {
tw`w-full mt-4 ${ButtonClass} ${LinearGradientsClass} hover:bg-gradient-to-l disabled:opacity-50`,
};
componentDidMount() {
const profile = this.props.profileGetter.getProfilesByPublicKey(this.props.publicKey);
this.setState({
name: profile?.profile.name || "",
picture: profile?.profile.picture || "",
});
}
onNameInput = (name: string) => {
this.setState({
name: name,

@ -1 +1 @@
Subproject commit a8a21694c7f0052af9549485033a8e07d60a786f
Subproject commit 23c6b0b2a6480cf2234041e48d2b4f882cb67903