diff options
| author | 2025-09-17 13:37:28 +0200 | |
|---|---|---|
| committer | 2025-09-17 13:37:28 +0200 | |
| commit | 247733aef46c46a128216f02832305a6df3e96c5 (patch) | |
| tree | 53465ab00c6a0074d33b1c31eabac148b58b32e5 /web | |
| parent | [bugfix/frontend] Fix overzealous padding removal on caption (#4439) (diff) | |
| download | gotosocial-247733aef46c46a128216f02832305a6df3e96c5.tar.xz | |
[bugfix/frontend] Use correct account domain in move account helper (#4440)
# Description
> If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.
>
> If this is a documentation change, please briefly describe what you've changed and why.
Just a quick fix to the frontend to use the account domain in the move helper namestring thingy, instead of the host.
closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4197
## Checklist
Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [x] I/we have performed a self-review of added code.
- [x] I/we have written code that is legible and maintainable by others.
- [x] I/we have commented the added code, particularly in hard-to-understand areas.
- [ ] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [x] I/we have run tests and they pass locally with the changes.
- [x] I/we have run `go fmt ./...` and `golangci-lint run`.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4440
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'web')
| -rw-r--r-- | web/source/settings/views/user/migration/index.tsx | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/web/source/settings/views/user/migration/index.tsx b/web/source/settings/views/user/migration/index.tsx index d2bbbdf12..90abd31b7 100644 --- a/web/source/settings/views/user/migration/index.tsx +++ b/web/source/settings/views/user/migration/index.tsx @@ -29,6 +29,8 @@ import MutationButton from "../../../components/form/mutation-button"; import { useAliasAccountMutation, useMoveAccountMutation } from "../../../lib/query/user"; import { FormContext, useWithFormContext } from "../../../lib/form/context"; import { store } from "../../../redux/store"; +import { useInstanceV1Query } from "../../../lib/query/gts-api"; +import Loading from "../../../components/loading"; export default function Migration() { return ( @@ -142,9 +144,7 @@ function AlsoKnownAsURI({ index, data }) { } function MoveForm({ data: profile }) { - let urlStr = store.getState().login.instanceUrl ?? ""; - let url = new URL(urlStr); - + const instanceURL = store.getState().login.instanceUrl ?? ""; const form = { movedToURI: useTextInput("moved_to_uri", { source: profile, @@ -153,9 +153,22 @@ function MoveForm({ data: profile }) { password: useTextInput("password"), }; - const [submitForm, result] = useFormSubmit(form, useMoveAccountMutation(), { - changedOnly: false, - }); + const [submitForm, result] = useFormSubmit( + form, + useMoveAccountMutation(), + { changedOnly: false }, + ); + + // Load instance data to know the correct + // account domain to provide in form below. + const { + data: instance, + isFetching: isFetchingInstance, + isLoading: isLoadingInstance + } = useInstanceV1Query(); + if (isFetchingInstance || isLoadingInstance) { + return <Loading />; + } return ( <form className="user-migration-move" onSubmit={submitForm}> @@ -170,11 +183,11 @@ function MoveForm({ data: profile }) { <dl className="migration-details"> <div> <dt>Account handle/username:</dt> - <dd>@{profile.acct}@{url.host}</dd> + <dd>@{profile.acct}@{instance?.account_domain}</dd> </div> <div> <dt>Account URI:</dt> - <dd>{urlStr}/users/{profile.username}</dd> + <dd>{instanceURL}/users/{profile.username}</dd> </div> </dl> <br/> |
