{
e.preventDefault();
- states.showAccount = follower;
+ states.showAccount = {
+ account: follower,
+ instance,
+ };
}}
>
{
+ return masto.v2.search(params);
+ }}
/>
{mediaAttachments.length > 0 && (
@@ -1031,7 +1036,7 @@ function Compose({
const Textarea = forwardRef((props, ref) => {
const [text, setText] = useState(ref.current?.value || '');
- const { maxCharacters, ...textareaProps } = props;
+ const { maxCharacters, performSearch = () => {}, ...textareaProps } = props;
const snapStates = useSnapshot(states);
const charCount = snapStates.composerCharacterCount;
@@ -1087,7 +1092,7 @@ const Textarea = forwardRef((props, ref) => {
}[key];
provide(
new Promise((resolve) => {
- const searchResults = masto.v2.search({
+ const searchResults = performSearch({
type,
q: text,
limit: 5,
diff --git a/src/components/drafts.jsx b/src/components/drafts.jsx
index 96aca1ed..49f8a64b 100644
--- a/src/components/drafts.jsx
+++ b/src/components/drafts.jsx
@@ -2,6 +2,7 @@ import './drafts.css';
import { useEffect, useMemo, useReducer, useState } from 'react';
+import { api } from '../utils/api';
import db from '../utils/db';
import states from '../utils/states';
import { getCurrentAccountNS } from '../utils/store-utils';
@@ -10,6 +11,7 @@ import Icon from './icon';
import Loader from './loader';
function Drafts() {
+ const { masto } = api();
const [uiState, setUIState] = useState('default');
const [drafts, setDrafts] = useState([]);
const [reloadCount, reload] = useReducer((c) => c + 1, 0);
diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx
index f9b5ef63..47d3b8eb 100644
--- a/src/components/media-modal.jsx
+++ b/src/components/media-modal.jsx
@@ -11,11 +11,12 @@ import Modal from './modal';
function MediaModal({
mediaAttachments,
statusID,
+ instance,
index = 0,
onClose = () => {},
}) {
const carouselRef = useRef(null);
- const isStatusLocation = useMatch('/s/:id');
+ const isStatusLocation = useMatch('/s/:instance?/:id');
const [currentIndex, setCurrentIndex] = useState(index);
const carouselFocusItem = useRef(null);
@@ -167,7 +168,7 @@ function MediaModal({
{!isStatusLocation && (
{
// if small screen (not media query min-width 40em + 350px), run onClose
diff --git a/src/components/name-text.jsx b/src/components/name-text.jsx
index 3a9b9aea..f6b93ca9 100644
--- a/src/components/name-text.jsx
+++ b/src/components/name-text.jsx
@@ -5,7 +5,15 @@ import states from '../utils/states';
import Avatar from './avatar';
-function NameText({ account, showAvatar, showAcct, short, external, onClick }) {
+function NameText({
+ account,
+ instance,
+ showAvatar,
+ showAcct,
+ short,
+ external,
+ onClick,
+}) {
const { acct, avatar, avatarStatic, id, url, displayName, emojis } = account;
let { username } = account;
@@ -34,7 +42,10 @@ function NameText({ account, showAvatar, showAcct, short, external, onClick }) {
if (external) return;
e.preventDefault();
if (onClick) return onClick(e);
- states.showAccount = account;
+ states.showAccount = {
+ account,
+ instance,
+ };
}}
>
{showAvatar && (
diff --git a/src/components/status.jsx b/src/components/status.jsx
index 08cf2b1a..a704f33a 100644
--- a/src/components/status.jsx
+++ b/src/components/status.jsx
@@ -1,17 +1,9 @@
import './status.css';
import { Menu, MenuItem } from '@szhsin/react-menu';
-import { getBlurHashAverageColor } from 'fast-blurhash';
import mem from 'mem';
import { memo } from 'preact/compat';
-import {
- useEffect,
- useLayoutEffect,
- useMemo,
- useRef,
- useState,
-} from 'preact/hooks';
-import { useHotkeys } from 'react-hotkeys-hook';
+import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
import 'swiped-events';
import useResizeObserver from 'use-resize-observer';
import { useSnapshot } from 'valtio';
@@ -19,6 +11,7 @@ import { useSnapshot } from 'valtio';
import Loader from '../components/loader';
import Modal from '../components/modal';
import NameText from '../components/name-text';
+import { api } from '../utils/api';
import enhanceContent from '../utils/enhance-content';
import handleContentLinks from '../utils/handle-content-links';
import htmlContentLength from '../utils/html-content-length';
@@ -33,7 +26,7 @@ import Link from './link';
import Media from './media';
import RelativeTime from './relative-time';
-function fetchAccount(id) {
+function fetchAccount(id, masto) {
try {
return masto.v1.accounts.fetch(id);
} catch (e) {
@@ -45,6 +38,7 @@ const memFetchAccount = mem(fetchAccount);
function Status({
statusID,
status,
+ instance,
withinContext,
size = 'm',
skeleton,
@@ -65,6 +59,7 @@ function Status({
);
}
+ const { masto, authenticated } = api({ instance });
const snapStates = useSnapshot(states);
if (!status) {
@@ -135,7 +130,7 @@ function Status({
if (account) {
setInReplyToAccount(account);
} else {
- memFetchAccount(inReplyToAccountId)
+ memFetchAccount(inReplyToAccountId, masto)
.then((account) => {
setInReplyToAccount(account);
states.accounts[account.id] = account;
@@ -157,9 +152,10 @@ function Status({
{' '}
- boosted
+ {' '}
+ boosted
-
+
);
}
@@ -198,6 +194,8 @@ function Status({
const statusRef = useRef(null);
+ const unauthInteractionErrorMessage = `Sorry, your current logged-in instance can't interact with this status from another instance.`;
+
return (
{
e.preventDefault();
e.stopPropagation();
- states.showAccount = status.account;
+ states.showAccount = {
+ account: status.account,
+ instance,
+ };
}}
>
@@ -240,6 +241,7 @@ function Status({
{/* */}
@@ -248,14 +250,23 @@ function Status({
{' '}
{' '}
-
+
>
)} */}
{/* */}{' '}
{size !== 'l' &&
(uri ? (
-
+
{' '}
-
+