Skip to content

Commit

Permalink
automatically load profiles using their instance to get the full picture
Browse files Browse the repository at this point in the history
  • Loading branch information
ghobs91 committed Dec 23, 2023
1 parent 0f84b40 commit 174f82d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
33 changes: 24 additions & 9 deletions src/pages/account-statuses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ function AccountStatuses() {
console.log({ enabled });
setSearchEnabled(enabled);
})();
(async () => {
try {
const { masto } = api({
instance: accountInstance,
});
const acc = await masto.v1.accounts.lookup({
acct: account.acct,
});
const { id } = acc;
location.hash = `/${accountInstance}/a/${id}`;
} catch (e) {
console.error(e);
alert('Unable to fetch account info');
}
})();
}, [instance, sameCurrentInstance, account?.acct]);

async function fetchAccountStatuses(firstLoad) {
Expand Down Expand Up @@ -222,15 +237,15 @@ function AccountStatuses() {
} catch (e) {
console.error(e);
}
try {
const featuredTags = await masto.v1.accounts
.$select(id)
.featuredTags.list();
console.log({ featuredTags });
setFeaturedTags(featuredTags);
} catch (e) {
console.error(e);
}
// try {
// const featuredTags = await masto.v1.accounts
// .$select(id)
// .featuredTags.list();
// console.log({ featuredTags });
// setFeaturedTags(featuredTags);
// } catch (e) {
// console.error(e);
// }
})();
}, [id]);

Expand Down
6 changes: 5 additions & 1 deletion src/pages/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
}

// Automatically switch to users instance to allow interacting with a status

const canAutoLoadThisInstance = () => {
return myCurrentInstance != 'ditto.pub' && myCurrentInstance != 'skybridge.fly.dev' && heroStatus.account.acct.indexOf("mostr.pub") === -1 && heroStatus.account.acct.indexOf("threads.net") === -1;
}

if (myCurrentInstance != 'ditto.pub' && myCurrentInstance != 'skybridge.fly.dev' && heroStatus.account.acct.indexOf("mostr.pub") === -1) {
if (canAutoLoadThisInstance()) {
setUIState('loading');
(async () => {
try {
Expand Down

0 comments on commit 174f82d

Please sign in to comment.