Skip to content

Commit

Permalink
Fix pronouns and support link inputs not filling in from author data
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiriVulpes committed Dec 29, 2024
1 parent 06e7812 commit ad6069e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ui/utility/StringApplicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function StringApplicator<HOST> (host: HOST, defaultValueOrApply: string | undef
}
}

function setInternal (value?: string | Weave) {
if (typeof value === "object")
function setInternal (value?: string | Weave | null) {
if (typeof value === "object" && value !== null)
value = value.toString()

if (result.state.value !== value) {
Expand All @@ -144,9 +144,9 @@ function StringApplicator<HOST> (host: HOST, defaultValueOrApply: string | undef
namespace StringApplicator {

export interface Optional<HOST> extends Omit<StringApplicator<HOST>, "state" | "set" | "bind" | "rehost"> {
state: State<string | undefined>
set (value?: string): HOST
bind (state?: State<string | Weave | undefined>): HOST
state: State<string | undefined | null>
set (value?: string | null): HOST
bind (state?: State<string | Weave | undefined | null>): HOST
rehost<NEW_HOST> (newHost: NEW_HOST): StringApplicator.Optional<NEW_HOST>
}

Expand Down
3 changes: 3 additions & 0 deletions src/ui/view/account/AccountViewForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default Component.Builder((component, type: AccountViewFormType) => {
.content((content, label) => content.append(vanityInput.setLabel(label)))

const pronounsInput = TextInput()
.default.bind(Session.Auth.author.map(component, author => author?.pronouns))
.hint.use("view/account/pronouns/hint")
.setMaxLength(FormInputLengths.manifest?.author.pronouns)
table.label(label => label.text.use("view/account/pronouns/label"))
Expand All @@ -67,10 +68,12 @@ export default Component.Builder((component, type: AccountViewFormType) => {
.ariaLabel.use("view/account/support-link/label")
.label(label => label.text.use("view/account/support-link/label"))
.input(input => supportLinkInput = input
.default.bind(Session.Auth.author.map(component, author => author?.support_link))
.hint.use("view/account/support-link/hint")
.setMaxLength(FormInputLengths.manifest?.author.support_link))
.label(label => label.text.use("view/account/support-message/label"))
.input(input => supportMessageInput = input
.default.bind(Session.Auth.author.map(component, author => author?.support_message))
.hint.use("view/account/support-message/hint")
.setMaxLength(FormInputLengths.manifest?.author.support_message))
.appendTo(table)
Expand Down

0 comments on commit ad6069e

Please sign in to comment.