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

View file

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

View file

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