Fix unset public name action to call unsetPublicName method

This commit is contained in:
srgooglo 2025-07-04 14:13:31 +02:00
parent e3d8d25391
commit a0c82c3cae

View File

@ -11,7 +11,7 @@ export default {
const userData = await UserModel.data() const userData = await UserModel.data()
return { return {
userData userData,
} }
}, },
settings: [ settings: [
@ -21,7 +21,8 @@ export default {
component: "Button", component: "Button",
icon: "FiAtSign", icon: "FiAtSign",
title: "Username", title: "Username",
description: "Your username is the name you use to log in to your account.", description:
"Your username is the name you use to log in to your account.",
props: { props: {
disabled: true, disabled: true,
children: "Change username", children: "Change username",
@ -45,7 +46,7 @@ export default {
}, },
onUpdate: async (value) => { onUpdate: async (value) => {
const result = await UserModel.updateData({ const result = await UserModel.updateData({
public_name: value public_name: value,
}) })
if (result) { if (result) {
@ -55,13 +56,13 @@ export default {
}, },
extraActions: [ extraActions: [
{ {
"id": "unset", id: "unset",
"icon": "Delete", icon: "Delete",
"title": "Unset", title: "Unset",
"onClick": async () => { onClick: async () => {
await UserModel.unsetFullName() await UserModel.unsetPublicName()
} },
} },
], ],
debounced: true, debounced: true,
storaged: false, storaged: false,
@ -84,7 +85,7 @@ export default {
}, },
onUpdate: async (value) => { onUpdate: async (value) => {
const result = await UserModel.updateData({ const result = await UserModel.updateData({
email: value email: value,
}) })
if (result) { if (result) {
@ -100,15 +101,13 @@ export default {
title: "Avatar", title: "Avatar",
description: "Change your avatar (Upload an image or use an URL)", description: "Change your avatar (Upload an image or use an URL)",
component: loadable(() => import("../components/urlInput")), component: loadable(() => import("../components/urlInput")),
extraActions: [ extraActions: [UploadButton],
UploadButton
],
defaultValue: (ctx) => { defaultValue: (ctx) => {
return ctx.userData.avatar return ctx.userData.avatar
}, },
onUpdate: async (value) => { onUpdate: async (value) => {
const result = await UserModel.updateData({ const result = await UserModel.updateData({
avatar: value avatar: value,
}) })
if (result) { if (result) {
@ -122,17 +121,16 @@ export default {
group: "account.profile", group: "account.profile",
icon: "FiImage", icon: "FiImage",
title: "Cover", title: "Cover",
description: "Change your profile cover (Upload an image or use an URL)", description:
"Change your profile cover (Upload an image or use an URL)",
component: loadable(() => import("../components/urlInput")), component: loadable(() => import("../components/urlInput")),
extraActions: [ extraActions: [UploadButton],
UploadButton
],
defaultValue: (ctx) => { defaultValue: (ctx) => {
return ctx.userData.cover return ctx.userData.cover
}, },
onUpdate: async (value) => { onUpdate: async (value) => {
const result = await UserModel.updateData({ const result = await UserModel.updateData({
cover: value cover: value,
}) })
if (result) { if (result) {
@ -152,14 +150,14 @@ export default {
placeholder: "Enter here a description for your profile", placeholder: "Enter here a description for your profile",
maxLength: 320, maxLength: 320,
showCount: true, showCount: true,
allowClear: true allowClear: true,
}, },
defaultValue: (ctx) => { defaultValue: (ctx) => {
return ctx.userData.description return ctx.userData.description
}, },
onUpdate: async (value) => { onUpdate: async (value) => {
const result = await UserModel.updateData({ const result = await UserModel.updateData({
description: value description: value,
}) })
if (result) { if (result) {
@ -182,7 +180,7 @@ export default {
}) })
const result = await UserModel.updateData({ const result = await UserModel.updateData({
links: value links: value,
}) })
if (result) { if (result) {
@ -193,6 +191,6 @@ export default {
return ctx.userData.links ?? [] return ctx.userData.links ?? []
}, },
debounced: true, debounced: true,
} },
] ],
} }