mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-17 15:51:51 +03:00
Fix wrong "info", when viewing remote accounts
This commit is contained in:
parent
24fdaf78d1
commit
94b96bd534
1 changed files with 22 additions and 8 deletions
|
@ -406,6 +406,8 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
endorsed,
|
endorsed,
|
||||||
} = relationship || {};
|
} = relationship || {};
|
||||||
|
|
||||||
|
const [currentInfo, setCurrentInfo] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (info) {
|
if (info) {
|
||||||
const currentAccount = store.session.get('currentAccount');
|
const currentAccount = store.session.get('currentAccount');
|
||||||
|
@ -424,7 +426,10 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
resolve: true,
|
resolve: true,
|
||||||
});
|
});
|
||||||
console.log('🥏 Fetched account from logged-in instance', results);
|
console.log('🥏 Fetched account from logged-in instance', results);
|
||||||
currentID = results.accounts[0].id;
|
if (results.accounts.length) {
|
||||||
|
currentID = results.accounts[0].id;
|
||||||
|
setCurrentInfo(results.accounts[0]);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -544,7 +549,7 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
states.showCompose = {
|
states.showCompose = {
|
||||||
draftStatus: {
|
draftStatus: {
|
||||||
status: `@${acct} `,
|
status: `@${currentInfo?.acct || acct} `,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
|
@ -606,7 +611,9 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const newRelationship =
|
const newRelationship =
|
||||||
await currentMasto.v1.accounts.unmute(id);
|
await currentMasto.v1.accounts.unmute(
|
||||||
|
currentInfo?.id || id,
|
||||||
|
);
|
||||||
console.log('unmuting', newRelationship);
|
console.log('unmuting', newRelationship);
|
||||||
setRelationship(newRelationship);
|
setRelationship(newRelationship);
|
||||||
setRelationshipUIState('default');
|
setRelationshipUIState('default');
|
||||||
|
@ -646,9 +653,12 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const newRelationship =
|
const newRelationship =
|
||||||
await currentMasto.v1.accounts.mute(id, {
|
await currentMasto.v1.accounts.mute(
|
||||||
duration,
|
currentInfo?.id || id,
|
||||||
});
|
{
|
||||||
|
duration,
|
||||||
|
},
|
||||||
|
);
|
||||||
console.log('muting', newRelationship);
|
console.log('muting', newRelationship);
|
||||||
setRelationship(newRelationship);
|
setRelationship(newRelationship);
|
||||||
setRelationshipUIState('default');
|
setRelationshipUIState('default');
|
||||||
|
@ -679,14 +689,18 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
try {
|
try {
|
||||||
if (blocking) {
|
if (blocking) {
|
||||||
const newRelationship =
|
const newRelationship =
|
||||||
await currentMasto.v1.accounts.unblock(id);
|
await currentMasto.v1.accounts.unblock(
|
||||||
|
currentInfo?.id || id,
|
||||||
|
);
|
||||||
console.log('unblocking', newRelationship);
|
console.log('unblocking', newRelationship);
|
||||||
setRelationship(newRelationship);
|
setRelationship(newRelationship);
|
||||||
setRelationshipUIState('default');
|
setRelationshipUIState('default');
|
||||||
showToast(`Unblocked @${username}`);
|
showToast(`Unblocked @${username}`);
|
||||||
} else {
|
} else {
|
||||||
const newRelationship =
|
const newRelationship =
|
||||||
await currentMasto.v1.accounts.block(id);
|
await currentMasto.v1.accounts.block(
|
||||||
|
currentInfo?.id || id,
|
||||||
|
);
|
||||||
console.log('blocking', newRelationship);
|
console.log('blocking', newRelationship);
|
||||||
setRelationship(newRelationship);
|
setRelationship(newRelationship);
|
||||||
setRelationshipUIState('default');
|
setRelationshipUIState('default');
|
||||||
|
|
Loading…
Add table
Reference in a new issue