mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 17:16:26 +01:00
Experimental feature to see post in currently logged-in instance
This commit is contained in:
parent
1357c1b2bd
commit
3aea09fd42
1 changed files with 29 additions and 1 deletions
|
@ -40,7 +40,7 @@ function resetScrollPosition(id) {
|
||||||
|
|
||||||
function StatusPage() {
|
function StatusPage() {
|
||||||
const { id, ...params } = useParams();
|
const { id, ...params } = useParams();
|
||||||
const { masto, instance } = api({ instance: params.instance });
|
const { masto, instance, authenticated } = api({ instance: params.instance });
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const snapStates = useSnapshot(states);
|
const snapStates = useSnapshot(states);
|
||||||
const [statuses, setStatuses] = useState([]);
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
@ -559,6 +559,34 @@ function StatusPage() {
|
||||||
>
|
>
|
||||||
<Icon icon="eye-open" /> <span>Show all sensitive content</span>
|
<Icon icon="eye-open" /> <span>Show all sensitive content</span>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
{import.meta.env.DEV && !authenticated && (
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const { masto } = api();
|
||||||
|
const results = await masto.v2.search({
|
||||||
|
q: heroStatus.url,
|
||||||
|
type: 'statuses',
|
||||||
|
resolve: true,
|
||||||
|
limit: 1,
|
||||||
|
});
|
||||||
|
if (results.statuses.length) {
|
||||||
|
const status = results.statuses[0];
|
||||||
|
navigate(`/s/${status.id}`);
|
||||||
|
} else {
|
||||||
|
throw new Error('No results');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Error: ' + e);
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
See post in currently logged-in instance
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
<Link
|
<Link
|
||||||
class="button plain deck-close"
|
class="button plain deck-close"
|
||||||
|
|
Loading…
Reference in a new issue