Use instance check instead of authenticated check

This commit is contained in:
Lim Chee Aun 2023-02-17 17:40:39 +08:00
parent b06cd36b3f
commit 9e1f62e47b

View file

@ -59,7 +59,9 @@ function Status({
</div>
);
}
const { masto, instance, authenticated } = api({ instance: propInstance });
const { masto, instance } = api({ instance: propInstance });
const { instance: currentInstance } = api();
const sameInstance = instance === currentInstance;
const sKey = statusKey(statusID, instance);
const snapStates = useSnapshot(states);
@ -380,7 +382,7 @@ function Status({
<Poll
lang={language}
poll={poll}
readOnly={readOnly || !authenticated}
readOnly={readOnly || !sameInstance}
onUpdate={(newPoll) => {
states.statuses[sKey].poll = newPoll;
}}
@ -509,7 +511,7 @@ function Status({
icon="comment"
count={repliesCount}
onClick={() => {
if (!authenticated) {
if (!sameInstance) {
return alert(unauthInteractionErrorMessage);
}
states.showCompose = {
@ -529,7 +531,7 @@ function Status({
icon="rocket"
count={reblogsCount}
onClick={async () => {
if (!authenticated) {
if (!sameInstance) {
return alert(unauthInteractionErrorMessage);
}
try {
@ -572,7 +574,7 @@ function Status({
icon="heart"
count={favouritesCount}
onClick={async () => {
if (!authenticated) {
if (!sameInstance) {
return alert(unauthInteractionErrorMessage);
}
try {
@ -608,7 +610,7 @@ function Status({
class="bookmark-button"
icon="bookmark"
onClick={async () => {
if (!authenticated) {
if (!sameInstance) {
return alert(unauthInteractionErrorMessage);
}
try {