fix: 🚸 don't open server info on ticker on note sub

This commit is contained in:
Kainoa Kanter 2023-09-21 15:22:26 -07:00
parent f1341204d4
commit 5b1cd11618
3 changed files with 11 additions and 11 deletions

View File

@ -4,7 +4,6 @@
v-tooltip="capitalize(instance.softwareName)"
class="hpaizdrt"
:style="bg"
@click.stop="openServerInfo"
>
<img class="icon" :src="getInstanceIcon(instance)" aria-hidden="true" />
<span class="name">{{ instance.name }}</span>
@ -17,8 +16,6 @@ import { ref } from "vue";
import { instanceName } from "@/config";
import { instance as Instance } from "@/instance";
import { getProxiedImageUrlNullable } from "@/scripts/media-proxy";
import { defaultStore } from "@/store";
import { pageWindow } from "@/os";
const props = defineProps<{
instance?: {
@ -87,13 +84,6 @@ function getInstanceIcon(instance): string {
"/client-assets/dummy.png"
);
}
function openServerInfo() {
if (!defaultStore.state.openServerInfo) return;
const instanceInfoUrl =
props.host == null ? "/about" : `/instance-info/${props.host}`;
pageWindow(instanceInfoUrl);
}
</script>
<style lang="scss" scoped>

View File

@ -97,7 +97,7 @@
<div class="main">
<div class="header-container">
<MkAvatar class="avatar" :user="appearNote.user" />
<XNoteHeader class="header" :note="appearNote" />
<XNoteHeader class="header" :note="appearNote" :can-open-server-info="true" />
</div>
<div class="body">
<MkSubNoteContent

View File

@ -41,6 +41,7 @@
class="ticker"
:instance="note.user.instance"
:host="note.user.host"
@click.stop="openServerInfo"
/>
</div>
</div>
@ -57,10 +58,12 @@ import MkInstanceTicker from "@/components/MkInstanceTicker.vue";
import { notePage } from "@/filters/note";
import { userPage } from "@/filters/user";
import { i18n } from "@/i18n";
import { pageWindow } from "@/os";
const props = defineProps<{
note: misskey.entities.Note;
pinned?: boolean;
canOpenServerInfo?: boolean;
}>();
const note = ref(props.note);
@ -69,6 +72,13 @@ const showTicker =
defaultStore.state.instanceTicker === "always" ||
(defaultStore.state.instanceTicker === "remote" &&
note.value.user.instance);
function openServerInfo() {
if (props.canOpenServerInfo && !defaultStore.state.openServerInfo || !note.value.user.instance) return;
const instanceInfoUrl =
props.host == null ? "/about" : `/instance-info/${note.value.user.instance}`;
pageWindow(instanceInfoUrl);
}
</script>
<style lang="scss" scoped>