Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
v-model:is-viewers-detail-open="isViewersDetailOpen"
:channel-id="channelId"
:viewer-ids="viewingUsers"
:inactive-viewer-ids="inactiveViewingUsers"

Check warning on line 13 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebar.vue#L13

Added line #L13 was not covered by tests
:pinned-messages-count="pinnedMessages.length"
@move-to-pinned="moveToPinnedPage"
@move-to-events="moveToEventsPage"
Expand All @@ -30,6 +31,7 @@
<template #opener>
<channel-sidebar-hidden
:viewer-ids="viewingUsers"
:inactive-viewer-ids="inactiveViewingUsers"

Check warning on line 34 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebar.vue#L34

Added line #L34 was not covered by tests
@open="openSidebar"
@open-viewers="openViewers"
/>
Expand Down Expand Up @@ -57,6 +59,7 @@
isSidebarOpenerReady: boolean
pinnedMessages: Pin[]
viewingUsers: UserId[]
inactiveViewingUsers: UserId[]
}>()

const { channelsMap } = useChannelsStore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<channel-sidebar-viewers
v-model="isViewersDetailOpen"
:viewer-ids="viewerIds"
:inactive-viewer-ids="inactiveViewerIds"

Check warning on line 6 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarContent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarContent.vue#L6

Added line #L6 was not covered by tests
:class="$style.sidebarItem"
/>
<channel-sidebar-qall
Expand Down Expand Up @@ -57,6 +58,7 @@
defineProps<{
channelId: ChannelId
viewerIds: readonly UserId[]
inactiveViewerIds: readonly UserId[]
pinnedMessagesCount?: number
isViewersDetailOpen: boolean
}>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
count-clickable
show-count
:user-ids="viewerIds"
:inactive-user-ids="inactiveViewerIds"

Check warning on line 16 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarHidden.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarHidden.vue#L16

Added line #L16 was not covered by tests
:class="$style.rest"
@count-click="emit('openViewers')"
/>
Expand All @@ -27,6 +28,7 @@
withDefaults(
defineProps<{
viewerIds?: readonly UserId[]
inactiveViewerIds?: readonly UserId[]
}>(),
{
viewerIds: () => []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
direction="row"
transition="fade-right"
:user-ids="viewerIds"
:inactive-user-ids="inactiveViewerIds"

Check warning on line 12 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewers.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewers.vue#L12

Added line #L12 was not covered by tests
@toggle="toggle"
/>
</sidebar-content-container>
<channel-sidebar-viewers-detail
v-else
:viewer-ids="viewerIds"
:inactive-viewer-ids="inactiveViewerIds"

Check warning on line 19 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewers.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewers.vue#L19

Added line #L19 was not covered by tests
@toggle="toggle"
/>
</template>
Expand All @@ -31,6 +33,7 @@
const props = withDefaults(
defineProps<{
viewerIds?: readonly UserId[]
inactiveViewerIds?: readonly UserId[]
modelValue: boolean
}>(),
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<template>
<sidebar-content-container clickable title="閲覧者" @toggle="emit('toggle')">
<div v-for="user in users" :key="user.id" :class="$style.item">
<div v-for="user in viewers" :key="user.id" :class="$style.item">
<user-icon :user-id="user.id" :size="32" />
<div :class="$style.userName">{{ user.displayName }}</div>
</div>
<div
v-for="user in inactiveUsers"
:key="user.id"
:class="[$style.item, $style.transparent]"

Check warning on line 10 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue#L3-L10

Added lines #L3 - L10 were not covered by tests
>
<user-icon :user-id="user.id" :size="32" />
<div :class="$style.userName">{{ user.displayName }}</div>
</div>
Expand All @@ -18,9 +26,11 @@
const props = withDefaults(
defineProps<{
viewerIds?: readonly UserId[]
inactiveViewerIds?: readonly UserId[]
}>(),
{
viewerIds: () => []
viewerIds: () => [],
inactiveViewerIds: () => []
}
)

Expand All @@ -29,9 +39,12 @@
}>()

const { usersMap } = useUsersStore()
const users = computed(() =>
const viewers = computed(() =>

Check warning on line 42 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue#L42

Added line #L42 was not covered by tests
props.viewerIds.map(id => usersMap.value.get(id)).filter(isDefined)
)
const inactiveUsers = computed(() =>
props.inactiveViewerIds.map(id => usersMap.value.get(id)).filter(isDefined)
)

Check warning on line 47 in src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelSidebar/ChannelSidebarViewersDetail.vue#L45-L47

Added lines #L45 - L47 were not covered by tests
</script>

<style lang="scss" module>
Expand All @@ -46,6 +59,9 @@
margin-bottom: 0;
}
}
.transparent {
opacity: 0.5;
}
.userName {
margin-left: 8px;
font-weight: bold;
Expand Down
5 changes: 4 additions & 1 deletion src/components/Main/MainView/ChannelView/ChannelView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:is-sidebar-opener-ready="isReady"
:pinned-messages="pinnedMessages"
:viewing-users="viewingUsers"
:inactive-viewing-users="inactiveViewingUsers"

Check warning on line 23 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L23

Added line #L23 was not covered by tests
/>
</template>
</primary-view-frame>
Expand All @@ -45,6 +46,8 @@

const channelId = toRef(props, 'channelId')
const pinnedMessages = usePinnedMessages(channelId)
const { viewingUsers, typingUsers } = useCurrentViewers(channelId)

const { viewingUsers, inactiveViewingUsers, typingUsers } =
useCurrentViewers(channelId)

Check warning on line 51 in src/components/Main/MainView/ChannelView/ChannelView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelView.vue#L50-L51

Added lines #L50 - L51 were not covered by tests
const { getQallingState } = useQall()
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@request-load-former="onLoadFormerMessagesRequest"
@request-load-latter="onLoadLatterMessagesRequest"
@scroll-passive="handleScroll"
@reset-is-reached-latest="resetIsReachedLatest"
@window-viewed="onWindowViewed"

Check warning on line 15 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L15

Added line #L15 was not covered by tests
>
<template #default="{ messageId, onChangeHeight, onEntryMessageLoaded }">
<messages-scroller-separator
Expand Down Expand Up @@ -46,23 +46,23 @@
</template>

<script lang="ts" setup>
import MessagesScroller from '/@/components/Main/MainView/MessagesScroller/MessagesScroller.vue'
import MessageInput from '/@/components/Main/MainView/MessageInput/MessageInput.vue'
import ScrollLoadingBar from '/@/components/Main/MainView/ScrollLoadingBar.vue'
import type { Pin } from '@traptitech/traq'
import { computed, ref, shallowRef } from 'vue'
import type { ChannelId, MessageId, UserId } from '/@/types/entity-ids'
import { useRouter } from 'vue-router'

Check warning on line 51 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L51

Added line #L51 was not covered by tests
import useChannelMessageFetcher from './composables/useChannelMessageFetcher'
import { useChannelsStore } from '/@/store/entities/channels'
import useDayDiffMessages from './composables/useDayDiffMessages'

Check warning on line 53 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L53

Added line #L53 was not covered by tests
import MessageElement from '/@/components/Main/MainView/MessageElement/MessageElement.vue'
import MessageInput from '/@/components/Main/MainView/MessageInput/MessageInput.vue'
import MessagesScroller from '/@/components/Main/MainView/MessagesScroller/MessagesScroller.vue'

Check warning on line 56 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L55-L56

Added lines #L55 - L56 were not covered by tests
import MessagesScrollerSeparator from '/@/components/Main/MainView/MessagesScroller/MessagesScrollerSeparator.vue'
import { useMessagesStore } from '/@/store/entities/messages'
import useDayDiffMessages from './composables/useDayDiffMessages'
import ScrollLoadingBar from '/@/components/Main/MainView/ScrollLoadingBar.vue'
import useChannelPath from '/@/composables/useChannelPath'

Check warning on line 59 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L58-L59

Added lines #L58 - L59 were not covered by tests
import { getFullDayString } from '/@/lib/basic/date'
import type { Pin } from '@traptitech/traq'
import { useRouter } from 'vue-router'
import { constructChannelPath } from '/@/router'
import useChannelPath from '/@/composables/useChannelPath'
import { useSubscriptionStore } from '/@/store/domain/subscription'
import { useChannelsStore } from '/@/store/entities/channels'
import { useMessagesStore } from '/@/store/entities/messages'

Check warning on line 64 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L63-L64

Added lines #L63 - L64 were not covered by tests
import type { ChannelId, MessageId, UserId } from '/@/types/entity-ids'

const props = defineProps<{
channelId: ChannelId
Expand All @@ -86,6 +86,9 @@
onLoadAroundMessagesRequest
} = useChannelMessageFetcher(scrollerEle, props)

const { unreadChannelsMap, deleteUnreadChannelWithSend } =
useSubscriptionStore()

Check warning on line 90 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L89-L90

Added lines #L89 - L90 were not covered by tests

const { messagesMap } = useMessagesStore()
const firstUnreadMessageId = computed(() => {
if (!unreadSince.value) return ''
Expand Down Expand Up @@ -114,9 +117,17 @@
() => new Map(props.pinnedMessages.map(pin => [pin.message.id, pin.userId]))
)

const { unreadChannelsMap } = useSubscriptionStore()
const resetIsReachedLatest = () => {
if (!unreadChannelsMap.value.get(props.channelId)) return
const onWindowViewed = () => {
const unread = unreadChannelsMap.value.get(props.channelId)
if (unread === undefined) return

Check warning on line 122 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L120-L122

Added lines #L120 - L122 were not covered by tests
//最後まで読み込まれている時は「ここから未読」の位置を修正し、未読を消す。
if (
unread.updatedAt ===
messagesMap.value.get(messageIds.value.at(-1) ?? '')?.createdAt
) {
unreadSince.value = unread.since
deleteUnreadChannelWithSend(props.channelId)
}

Check warning on line 130 in src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/ChannelView/ChannelViewContent/ChannelViewContentMain.vue#L124-L130

Added lines #L124 - L130 were not covered by tests
isReachedLatest.value = false
}

Expand Down
8 changes: 7 additions & 1 deletion src/components/Main/MainView/DMView/DMSidebar/DMSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<template #content>
<sidebar-content
:viewer-ids="viewingUsers"
:inactive-viewer-ids="inactiveViewingUsers"

Check warning on line 11 in src/components/Main/MainView/DMView/DMSidebar/DMSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/DMView/DMSidebar/DMSidebar.vue#L11

Added line #L11 was not covered by tests
:pinned-messages-count="pinnedMessages.length"
@move-to-pinned="moveToPinnedPage"
@move-to-events="moveToEventsPage"
Expand All @@ -26,7 +27,11 @@
/>
</template>
<template #opener>
<channel-sidebar-hidden :viewer-ids="viewingUsers" @open="openSidebar" />
<channel-sidebar-hidden
:viewer-ids="viewingUsers"
:inactive-viewer-ids="inactiveViewingUsers"
@open="openSidebar"
/>

Check warning on line 34 in src/components/Main/MainView/DMView/DMSidebar/DMSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/DMView/DMSidebar/DMSidebar.vue#L30-L34

Added lines #L30 - L34 were not covered by tests
</template>
</primary-view-sidebar>
</template>
Expand All @@ -49,6 +54,7 @@
isSidebarOpenerReady: boolean
pinnedMessages: Pin[]
viewingUsers: UserId[]
inactiveViewingUsers: UserId[]
}>()

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<channel-sidebar-viewers
v-model="isViewersDetailOpen"
:viewer-ids="viewerIds"
:inactive-viewer-ids="inactiveViewerIds"

Check warning on line 6 in src/components/Main/MainView/DMView/DMSidebar/DMSidebarContent.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/DMView/DMSidebar/DMSidebarContent.vue#L6

Added line #L6 was not covered by tests
:class="$style.item"
/>
<channel-sidebar-pinned
Expand All @@ -27,6 +28,7 @@
withDefaults(
defineProps<{
viewerIds: readonly UserId[]
inactiveViewerIds?: readonly UserId[]
pinnedMessagesCount?: number
}>(),
{
Expand Down
4 changes: 3 additions & 1 deletion src/components/Main/MainView/DMView/DMView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:is-sidebar-opener-ready="isReady"
:pinned-messages="pinnedMessages"
:viewing-users="viewingUsers"
:inactive-viewing-users="inactiveViewingUsers"

Check warning on line 21 in src/components/Main/MainView/DMView/DMView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/DMView/DMView.vue#L21

Added line #L21 was not covered by tests
/>
</template>
</primary-view-frame>
Expand All @@ -42,5 +43,6 @@

const channelId = toRef(props, 'channelId')
const pinnedMessages = usePinnedMessages(channelId)
const { viewingUsers, typingUsers } = useCurrentViewers(channelId)
const { viewingUsers, inactiveViewingUsers, typingUsers } =
useCurrentViewers(channelId)

Check warning on line 47 in src/components/Main/MainView/DMView/DMView.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Main/MainView/DMView/DMView.vue#L46-L47

Added lines #L46 - L47 were not covered by tests
</script>
Loading