Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/components/RightSidebar/RightSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,6 @@ export default {
// Discard notification if the conversation changes or closed
this.notifyUnreadMessages(null)
// FIXME collapse for group conversations until we show anything useful there
this.contentModeIndex = this.isOneToOne ? 1 : 0
},
immediate: true,
Expand Down
40 changes: 34 additions & 6 deletions src/components/RightSidebar/RightSidebarContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
UserProfileData,
} from '../../types/index.ts'

import { t } from '@nextcloud/l10n'
import { n, t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import { useIsDarkTheme } from '@nextcloud/vue/composables/useIsDarkTheme'
import { computed, ref, watch } from 'vue'
Expand All @@ -23,6 +23,7 @@ import NcButton from '@nextcloud/vue/components/NcButton'
import IconAccountOutline from 'vue-material-design-icons/AccountOutline.vue'
import IconArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
import IconClockOutline from 'vue-material-design-icons/ClockOutline.vue'
import IconDeleteClockOutline from 'vue-material-design-icons/DeleteClockOutline.vue'
import IconMagnify from 'vue-material-design-icons/Magnify.vue'
import IconOfficeBuildingOutline from 'vue-material-design-icons/OfficeBuildingOutline.vue'
import CalendarEventSmall from '../UIShared/CalendarEventSmall.vue'
Expand Down Expand Up @@ -81,6 +82,25 @@ const profileActions = computed<UserProfileData['actions']>(() => {
return profileInfo.value.actions.filter((action) => action.id !== 'talk')
})

const isMessageExpirationSet = computed(() => {
return conversation.value.messageExpiration > 0
})

const defaultExpirationOptions: Record<number, string> = {
3600: n('spreed', '%n hour', '%n hours', 1),
28800: n('spreed', '%n hour', '%n hours', 8),
86400: n('spreed', '%n day', '%n days', 1),
604800: n('spreed', '%n week', '%n weeks', 1),
2419200: n('spreed', '%n week', '%n weeks', 4),
0: t('spreed', 'Off'),
}

const messageExpirationDuration = computed(() => {
const { messageExpiration } = conversation.value

return defaultExpirationOptions[messageExpiration] ?? t('spreed', 'Custom expiration time')
})

const sidebarTitle = computed(() => {
if (props.state === 'search') {
return t('spreed', 'Search in {name}', { name: conversation.value.displayName }, {
Expand Down Expand Up @@ -118,11 +138,19 @@ const avatarUrl = computed(() => {
})

const profileInformation = computed(() => {
if (!profileInfo.value) {
return []
const fields = []

if (isMessageExpirationSet.value) {
fields.push({
key: 'expiration',
icon: IconDeleteClockOutline,
label: t('spreed', 'Message expiration set: {duration}', { duration: messageExpirationDuration.value }),
})
}

const fields = []
if (!profileInfo.value) {
return fields
}

if (profileInfo.value.role || profileInfo.value.pronouns) {
fields.push({
Expand Down Expand Up @@ -255,7 +283,7 @@ function handleHeaderClick() {
:title="sidebarTitle"
@click="handleHeaderClick" />
<div
v-if="mode !== 'compact' && profileInfo"
v-if="mode !== 'compact'"
class="content__info">
<span
v-for="row in profileInformation"
Expand All @@ -265,7 +293,7 @@ function handleHeaderClick() {
{{ row.label }}
</span>
<LocalTime
v-if="profileInfo.timezone"
v-if="profileInfo?.timezone"
class="content__info-row"
:timezone="profileInfo.timezone">
<template #icon>
Expand Down