mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 16:12:25 -05:00
[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>
This commit is contained in:
parent
5533fbc1f8
commit
247733aef4
1 changed files with 21 additions and 8 deletions
|
|
@ -29,6 +29,8 @@ import MutationButton from "../../../components/form/mutation-button";
|
||||||
import { useAliasAccountMutation, useMoveAccountMutation } from "../../../lib/query/user";
|
import { useAliasAccountMutation, useMoveAccountMutation } from "../../../lib/query/user";
|
||||||
import { FormContext, useWithFormContext } from "../../../lib/form/context";
|
import { FormContext, useWithFormContext } from "../../../lib/form/context";
|
||||||
import { store } from "../../../redux/store";
|
import { store } from "../../../redux/store";
|
||||||
|
import { useInstanceV1Query } from "../../../lib/query/gts-api";
|
||||||
|
import Loading from "../../../components/loading";
|
||||||
|
|
||||||
export default function Migration() {
|
export default function Migration() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -142,9 +144,7 @@ function AlsoKnownAsURI({ index, data }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function MoveForm({ data: profile }) {
|
function MoveForm({ data: profile }) {
|
||||||
let urlStr = store.getState().login.instanceUrl ?? "";
|
const instanceURL = store.getState().login.instanceUrl ?? "";
|
||||||
let url = new URL(urlStr);
|
|
||||||
|
|
||||||
const form = {
|
const form = {
|
||||||
movedToURI: useTextInput("moved_to_uri", {
|
movedToURI: useTextInput("moved_to_uri", {
|
||||||
source: profile,
|
source: profile,
|
||||||
|
|
@ -153,9 +153,22 @@ function MoveForm({ data: profile }) {
|
||||||
password: useTextInput("password"),
|
password: useTextInput("password"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const [submitForm, result] = useFormSubmit(form, useMoveAccountMutation(), {
|
const [submitForm, result] = useFormSubmit(
|
||||||
changedOnly: false,
|
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 (
|
return (
|
||||||
<form className="user-migration-move" onSubmit={submitForm}>
|
<form className="user-migration-move" onSubmit={submitForm}>
|
||||||
|
|
@ -170,11 +183,11 @@ function MoveForm({ data: profile }) {
|
||||||
<dl className="migration-details">
|
<dl className="migration-details">
|
||||||
<div>
|
<div>
|
||||||
<dt>Account handle/username:</dt>
|
<dt>Account handle/username:</dt>
|
||||||
<dd>@{profile.acct}@{url.host}</dd>
|
<dd>@{profile.acct}@{instance?.account_domain}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<dt>Account URI:</dt>
|
<dt>Account URI:</dt>
|
||||||
<dd>{urlStr}/users/{profile.username}</dd>
|
<dd>{instanceURL}/users/{profile.username}</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue