From 01fe999cec6d5a8a40533dc1f8cf8432c81c439b Mon Sep 17 00:00:00 2001 From: christianbeeznst Date: Wed, 7 Feb 2024 23:10:04 -0500 Subject: [PATCH] Message: Enhance presentation when replying to a message - refs #21328 --- assets/vue/utils/dates.js | 8 +++++++- assets/vue/views/message/MessageReply.vue | 13 +++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/assets/vue/utils/dates.js b/assets/vue/utils/dates.js index 519a28c46d..1e9f20070c 100644 --- a/assets/vue/utils/dates.js +++ b/assets/vue/utils/dates.js @@ -6,4 +6,10 @@ const formatDateTime = function(date) { return DateTime(date).format('DD/MM/YYYY'); }; -export { formatDateTime }; +const formatDateTimeFromISO = function(dateStr) { + if (!dateStr) return ''; + + return DateTime.fromISO(dateStr).toFormat('dd/LL/yyyy HH:mm'); +}; + +export { formatDateTime, formatDateTimeFromISO }; diff --git a/assets/vue/views/message/MessageReply.vue b/assets/vue/views/message/MessageReply.vue index 4f660a6a15..4671c173fc 100644 --- a/assets/vue/views/message/MessageReply.vue +++ b/assets/vue/views/message/MessageReply.vue @@ -77,10 +77,11 @@ import BaseButton from "../../components/basecomponents/BaseButton.vue" import { useI18n } from "vue-i18n" import { useSecurityStore } from "../../store/securityStore" import { useNotification } from "../../composables/notification" +import { formatDateTimeFromISO } from "../../utils/dates" const item = ref({}) const store = useStore() -const securityStore = useSecurityStore(); +const securityStore = useSecurityStore() const route = useRoute() const router = useRouter() @@ -96,7 +97,11 @@ onMounted(async () => { const response = await store.dispatch("message/load", id) item.value = await response - + const originalUserInfo = await store.dispatch("user/load", '/api/users/' + item.value.sender.id) + const originalSenderName = originalUserInfo.fullName + const originalSenderEmail = originalUserInfo.email + const formattedDate = formatDateTimeFromISO(item.value.sendDate) + const translatedHeader = t('Email reply header', { date: formattedDate, senderName: originalSenderName, senderEmail: `${originalSenderEmail}` }) delete item.value["@id"] delete item.value["id"] delete item.value["firstReceiver"] @@ -151,7 +156,7 @@ onMounted(async () => { }*/ // Set reply content. - item.value.content = `
${item.value.content}
` + item.value.content = `


${translatedHeader}
${item.value.content}
` }) const isLoading = computed(() => store.state.message.isLoading) @@ -191,4 +196,4 @@ const onReplyMessageForm = async () => { notification.showErrorNotification(e) } } - \ No newline at end of file +