Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
caipira113 committed Sep 23, 2023
2 parents 5bdd69e + 7bdab6a commit c1af219
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 20 deletions.
1 change: 1 addition & 0 deletions packages/backend/src/core/MessagingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export class MessagingService {
userId: message.userId,
visibility: 'specified',
emojis: [{}],
tags: [{}],
mentions: [recipientUser].map(u => u.id),
mentionedRemoteUsers: JSON.stringify([recipientUser].map(u => ({
uri: u.uri,
Expand Down
9 changes: 3 additions & 6 deletions packages/frontend/src/components/MkChatPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
v-anim="i"
class="_panel"
:class="[$style.message, { [$style.isRead]: (isMe(message) || (message.groupId ? message.reads.includes($i.id) : message.isRead)) }]"
:to="message.groupId ? `/my/messaging/group/${message.groupId}` : `/my/messaging/${getAcct(isMe(message) ? message.recipient : message.user)}`"
:to="message.groupId ? `/my/messaging/group/${ message.groupId }` : `/my/messaging/@${Misskey.acct.toString(isMe(message) ? message.recipient : message.user)}`"
:data-index="i"
>
<div>
Expand All @@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</header>
<header v-else>
<span :class="$style.name"><MkUserName :user="isMe(message) ? message.recipient : message.user"/></span>
<span :class="$style.username">@{{ acct(isMe(message) ? message.recipient : message.user) }}</span>
<span :class="$style.username">@{{ Misskey.acct.toString(isMe(message) ? message.recipient : message.user) }}</span>
<MkTime :time="message.createdAt" :class="$style.time"/>
</header>
<div>
Expand All @@ -31,13 +31,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import * as Acct from 'cherrypick-js/built/acct';
import { acct } from '@/filters/user.js';
import * as Misskey from 'cherrypick-js';
import { $i } from '@/account.js';
import { i18n } from '@/i18n.js';

const getAcct = Acct.toString;

const props = defineProps<{
message: Record<string, any>;
}>();
Expand Down
18 changes: 12 additions & 6 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,14 @@ function blur() {
el.value.blur();
}

os.api('notes/children', {
noteId: appearNote.id,
limit: 4,
}).then(res => {
replies.value = res;
});
function loadRepliesSimple() {
os.api('notes/children', {
noteId: appearNote.id,
limit: 4,
}).then(res => {
replies.value = res;
});
}

const repliesLoaded = ref(false);
function loadReplies() {
Expand All @@ -686,6 +688,10 @@ function loadConversation() {
conversation.value = res.reverse();
});
}

onMounted(() => {
loadRepliesSimple();
});
</script>

<style lang="scss" module>
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/src/pages/messaging/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import { markRaw, onMounted, onUnmounted } from 'vue';
import * as Acct from 'cherrypick-js/built/acct';
import * as Misskey from 'cherrypick-js';
import * as os from '@/os.js';
import { useStream } from '@/stream.js';
import { useRouter } from '@/router.js';
Expand All @@ -46,8 +46,8 @@ const router = useRouter();
let tab = $ref('direct');

let fetching = $ref(true);
let messages = $ref([]);
let connection = $ref(null);
let messages;
let connection;

const directPagination = {
endpoint: 'messaging/history' as const,
Expand Down Expand Up @@ -104,7 +104,7 @@ function start(ev) {

async function startUser() {
os.selectUser().then(user => {
router.push(`/my/messaging/${Acct.toString(user)}`);
router.push(`/my/messaging/@${Misskey.acct.toString(user)}`);
});
}

Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/pages/messaging/messaging-room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, onMounted, nextTick, onBeforeUnmount, watch, shallowRef } from 'vue';
import * as Misskey from 'cherrypick-js';
import * as Acct from 'cherrypick-js/built/acct';
import XMessage from './messaging-room.message.vue';
import XForm from './messaging-room.form.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
Expand Down Expand Up @@ -109,7 +108,7 @@ async function fetch() {
fetching = true;

if (props.userAcct) {
const acct = Acct.parse(props.userAcct);
const acct = Misskey.acct.parse(props.userAcct);
user = await os.api('users/show', { username: acct.username, host: acct.host || undefined });
group = null;

Expand Down Expand Up @@ -310,6 +309,8 @@ onBeforeUnmount(() => {
});

definePageMetadata(computed(() => !fetching ? user ? {
title: '',
icon: null,
userName: user,
avatar: user,
} : {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export const routes = [{
loginRequired: true,
}, {
name: 'messaging-room',
path: '/my/messaging/:userAcct',
path: '/my/messaging/@:userAcct',
component: page(() => import('./pages/messaging/messaging-room.vue')),
loginRequired: true,
}, {
Expand Down
2 changes: 1 addition & 1 deletion packages/sw/src/scripts/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function openAntenna(antennaId: string, loginId: string): ReturnType<type

export async function openChat(body: any, loginId: string) {
if (body.groupId === null) {
return openClient('push', `/my/messaging/${getAcct(body.user)}`, loginId, { body });
return openClient('push', `/my/messaging/@${Misskey.acct.toString(body.user)}`, loginId, { body });
} else {
return openClient('push', `/my/messaging/group/${body.groupId}`, loginId, { body });
}
Expand Down

0 comments on commit c1af219

Please sign in to comment.