Skip to content
Merged
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
2 changes: 2 additions & 0 deletions packages/web-app-mail/src/components/MailComposeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import MailAttachmentList from './MailAttachmentList.vue'
type FromOption = {
value: string
label: string
name: string
email: string
accountId: string
identityId: string
Expand Down Expand Up @@ -122,6 +123,7 @@ const fromOptions = computed<FromOption[]>(() => {
account.identities?.map((identity) => ({
label: identity.name ? `${identity.name} <${identity.email}>` : identity.email,
value: identity.id,
name: identity.name || identity.email,
email: identity.email,
accountId: account.accountId,
identityId: identity.id
Expand Down
24 changes: 13 additions & 11 deletions packages/web-app-mail/src/components/MailList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="md:hidden"
mode="action"
:aria-label="$gettext('Write new Email')"
@click="showCompose = true"
@click="openCompose"
/>
<no-content-message v-if="!currentMailbox" icon="folder" icon-fill-type="line">
<template #message>
Expand Down Expand Up @@ -58,15 +58,13 @@
</oc-button>
</li>
</oc-list>
<MailWidget v-model="showCompose" />
</template>
</template>
</template>

<script setup lang="ts">
import { AppLoadingSpinner, NoContentMessage } from '@opencloud-eu/web-pkg'
import MailListItem from './MailListItem.vue'
import MailWidget from './MailWidget.vue'
import type { Mail } from '../types'
import { useLoadMails } from '../composables/useLoadMails'
import { useMailsStore } from '../composables/piniaStores/mails'
Expand All @@ -76,22 +74,26 @@ import { useLoadMail } from '../composables/useLoadMail'
import { ref, unref } from 'vue'
import { useAccountsStore } from '../composables/piniaStores/accounts'

const accountsStore = useAccountsStore()
const { currentAccount } = storeToRefs(accountsStore)

const mailsStore = useMailsStore()
const mailboxesStore = useMailboxesStore()
const accountsStore = useAccountsStore()
const { loadMail } = useLoadMail()
const { isLoading } = useLoadMails()

const { currentAccount } = storeToRefs(accountsStore)
const { currentMail, mails } = storeToRefs(mailsStore)
const { updateMailField, setCurrentMail } = mailsStore
const { currentMailbox } = storeToRefs(mailboxesStore)
const { setCurrentMailbox } = mailboxesStore
const { loadMail } = useLoadMail()
const { isLoading } = useLoadMails()

const showCompose = ref(false)

const emit = defineEmits<{
(e: 'compose-mail'): void
}>()

const openCompose = () => {
showCompose.value = true
emit('compose-mail')
}

defineExpose({
Expand All @@ -107,9 +109,9 @@ const onSelectMail = async (mail: Mail) => {
await loadMail(unref(currentAccount).accountId, mail.id)

updateMailField({
id: unref(currentMail).id,
id: mail.id,
field: 'keywords',
value: { ...unref(currentMail).keywords, ...{ $seen: true } }
value: { ...mail.keywords, ...{ $seen: true } }
})
}
</script>
17 changes: 12 additions & 5 deletions packages/web-app-mail/src/components/MailListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<mail-indicators :mail="mail" />
</div>
<div class="mail-list-item-preview text-role-on-surface-variant mt-1">
<span class="line-clamp-2" v-text="mail.preview"></span>
<span class="line-clamp-2" v-text="previewText"></span>
</div>
</div>
</div>
Expand All @@ -37,11 +37,9 @@ import { computed } from 'vue'
import { formatRelativeDateFromISO } from '@opencloud-eu/web-pkg'
import { useGettext } from 'vue3-gettext'
import MailIndicators from './MailIndicators.vue'
import DOMPurify from 'dompurify'

const { mail } = defineProps<{
mail: Mail
}>()

const { mail } = defineProps<{ mail: Mail }>()
const { current: currentLanguage } = useGettext()

const fromText = computed(() => {
Expand All @@ -51,4 +49,13 @@ const fromText = computed(() => {
const receivedAtRelativeDate = computed(() => {
return formatRelativeDateFromISO(mail.receivedAt, currentLanguage)
})

const previewText = computed(() => {
if (!mail.preview) {
return ''
}

const stripped = DOMPurify.sanitize(mail.preview, { ALLOWED_TAGS: [], ALLOWED_ATTR: [] })
return stripped.replace(/\s+/g, ' ').trim()
})
</script>
12 changes: 12 additions & 0 deletions packages/web-app-mail/src/components/MailSavedHint.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="flex items-center gap-1 text-role-on-surface-variant">
<oc-icon name="check" fill-type="line" />
<span class="text-sm" v-text="$gettext('Saved')" />
</div>
</template>

<script setup lang="ts">
import { useGettext } from 'vue3-gettext'

const { $gettext } = useGettext()
</script>
Loading
Loading