revert messaging room

This commit is contained in:
ThatOneCalculator 2023-04-24 15:45:34 -07:00
parent df8294bde3
commit b2e80db219
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
2 changed files with 111 additions and 111 deletions

View File

@ -76,19 +76,22 @@ export function apiMastodonCompatible(router: Router): void {
} }
}); });
router.post<{ Params: { id: string } }>("/v1/announcements/:id/dismiss", async (ctx) => { router.post<{ Params: { id: string } }>(
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; "/v1/announcements/:id/dismiss",
const accessTokens = ctx.request.headers.authorization; async (ctx) => {
const client = getClient(BASE_URL, accessTokens); const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
try { const accessTokens = ctx.request.headers.authorization;
const data = await client.dismissInstanceAnnouncement(ctx.params.id); const client = getClient(BASE_URL, accessTokens);
ctx.body = data.data; try {
} catch (e: any) { const data = await client.dismissInstanceAnnouncement(ctx.params.id);
console.error(e); ctx.body = data.data;
ctx.status = 401; } catch (e: any) {
ctx.body = e.response.data; console.error(e);
} ctx.status = 401;
}); ctx.body = e.response.data;
}
},
);
router.get("/v1/filters", async (ctx) => { router.get("/v1/filters", async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;

View File

@ -1,93 +1,94 @@
<template> <template>
<MkStickyContainer> <div
<template #header ref="rootEl"
><MkPageHeader class="_section"
:actions="headerActions" @dragover.prevent.stop="onDragover"
:tabs="headerTabs" @drop.prevent.stop="onDrop"
:display-back-button="true" >
/></template> <div class="_content mk-messaging-room">
<MkSpacer :content-max="800" class="mk-messaging-room"> <MkSpacer :content-max="800">
<div class="body"> <div class="body">
<MkPagination <MkPagination
v-if="pagination" v-if="pagination"
ref="pagingComponent" ref="pagingComponent"
:key="userAcct || groupId" :key="userAcct || groupId"
:pagination="pagination" :pagination="pagination"
>
<template #empty>
<div class="_fullinfo">
<img
src="/static-assets/badges/info.png"
class="_ghost"
alt="Info"
/>
<div>{{ i18n.ts.noMessagesYet }}</div>
</div>
</template>
<template
#default="{ items: messages, fetching: pFetching }"
> >
<XList <template #empty>
v-if="messages.length > 0" <div class="_fullinfo">
v-slot="{ item: message }" <img
:class="{ src="/static-assets/badges/info.png"
messages: true, class="_ghost"
'deny-move-transition': pFetching, alt="Info"
}" />
:items="messages" <div>{{ i18n.ts.noMessagesYet }}</div>
direction="up" </div>
reversed
>
<XMessage
:key="message.id"
:message="message"
:is-group="group != null"
/>
</XList>
</template>
</MkPagination>
</div>
<footer>
<div v-if="typers.length > 0" class="typers">
<I18n
:src="i18n.ts.typingUsers"
text-tag="span"
class="users"
>
<template #users>
<b
v-for="typer in typers"
:key="typer.id"
class="user"
>{{ typer.username }}</b
>
</template> </template>
</I18n> <template
<MkEllipsis /> #default="{ items: messages, fetching: pFetching }"
</div>
<transition :name="animation ? 'fade' : ''">
<div v-show="showIndicator" class="new-message">
<button
class="_buttonPrimary"
@click="onIndicatorClick"
> >
<i <XList
class="fas ph-fw ph-lg ph-arrow-circle-down ph-bold ph-lg" v-if="messages.length > 0"
></i v-slot="{ item: message }"
>{{ i18n.ts.newMessageExists }} :class="{
</button> messages: true,
'deny-move-transition': pFetching,
}"
:items="messages"
direction="up"
reversed
>
<XMessage
:key="message.id"
:message="message"
:is-group="group != null"
/>
</XList>
</template>
</MkPagination>
</div>
<footer>
<div v-if="typers.length > 0" class="typers">
<I18n
:src="i18n.ts.typingUsers"
text-tag="span"
class="users"
>
<template #users>
<b
v-for="typer in typers"
:key="typer.id"
class="user"
>{{ typer.username }}</b
>
</template>
</I18n>
<MkEllipsis />
</div> </div>
</transition> <transition :name="animation ? 'fade' : ''">
<XForm <div v-show="showIndicator" class="new-message">
v-if="!fetching" <button
ref="formEl" class="_buttonPrimary"
:user="user" @click="onIndicatorClick"
:group="group" >
class="form" <i
/> class="fas ph-fw ph-lg ph-arrow-circle-down-bold ph-lg"
</footer> ></i
</MkSpacer> >{{ i18n.ts.newMessageExists }}
</MkStickyContainer> </button>
</div>
</transition>
<XForm
v-if="!fetching"
ref="formEl"
:user="user"
:group="group"
class="form"
/>
</footer>
</MkSpacer>
</div>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -327,12 +328,14 @@ function onVisibilitychange() {
} }
} }
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
onMounted(() => { onMounted(() => {
fetch(); fetch();
definePageMetadata(
computed(() => ({
title: group != null ? group.name : user?.name,
icon: "ph-chats-teardrop-bold ph-lg",
}))
);
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
@ -340,15 +343,6 @@ onBeforeUnmount(() => {
document.removeEventListener("visibilitychange", onVisibilitychange); document.removeEventListener("visibilitychange", onVisibilitychange);
if (scrollRemove) scrollRemove(); if (scrollRemove) scrollRemove();
}); });
await fetch();
definePageMetadata(
computed(() => ({
title: group != null ? group.name : user?.name,
icon: "ph-chats-teardrop ph-bold ph-lg",
avatar: group != null ? null : user,
}))
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -357,6 +351,9 @@ XMessage:last-of-type {
} }
.mk-messaging-room { .mk-messaging-room {
position: relative;
overflow: auto;
> .body { > .body {
.more { .more {
display: block; display: block;