mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 01:46:07 +00:00
fix tests
This commit is contained in:
parent
e9879caecc
commit
99a84cbb92
@ -222,6 +222,10 @@ const onSubmit = () => {
|
||||
}
|
||||
}
|
||||
toastSuccess(t('message.request'))
|
||||
form.value = {
|
||||
text: '',
|
||||
memo: props.contributionMemo,
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@ -93,10 +93,12 @@ describe('ContributionMessagesList', () => {
|
||||
|
||||
wrapper = mount(ContributionMessagesList, {
|
||||
props: {
|
||||
contributionId: 42,
|
||||
contributionMemo: 'test memo',
|
||||
contributionUserId: 108,
|
||||
contributionStatus: 'PENDING',
|
||||
contribution: {
|
||||
id: 42,
|
||||
memo: 'test memo',
|
||||
userId: 108,
|
||||
status: 'PENDING',
|
||||
},
|
||||
hideResubmission: true,
|
||||
},
|
||||
global: {
|
||||
@ -137,7 +139,7 @@ describe('ContributionMessagesList', () => {
|
||||
})
|
||||
|
||||
it('does not render the ContributionMessagesFormular when status is not PENDING or IN_PROGRESS', async () => {
|
||||
await wrapper.setProps({ contributionStatus: 'COMPLETED' })
|
||||
await wrapper.setProps({ contribution: { status: 'COMPLETED' } })
|
||||
expect(wrapper.find('contribution-messages-formular-stub').exists()).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
@ -2,9 +2,12 @@
|
||||
<div class="contribution-messages-list">
|
||||
<BListGroup>
|
||||
<BListGroupItem>
|
||||
<a :href="mailtoLink">
|
||||
{{ contribution.firstName }} {{ contribution.lastName }} <{{ contribution.email }}>
|
||||
</a>
|
||||
|
||||
{{
|
||||
$t('contributionMessagesForm.userDetailsRegisteredAt', {
|
||||
...contribution,
|
||||
$t('contributionMessagesForm.hasRegisteredAt', {
|
||||
createdAt: new Date(contribution.createdAt).toLocaleString(),
|
||||
})
|
||||
}}
|
||||
@ -34,7 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { useQuery } from '@vue/apollo-composable'
|
||||
|
||||
import { adminListContributionMessages } from '../../graphql/adminListContributionMessages.js'
|
||||
@ -57,6 +60,9 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['update-status', 'reload-contribution', 'update-contributions'])
|
||||
const { toastError } = useAppToast()
|
||||
const mailtoLink = computed(() => {
|
||||
return `mailto:${props.contribution.email}`
|
||||
})
|
||||
|
||||
const messages = ref([])
|
||||
|
||||
|
||||
@ -181,6 +181,12 @@ export default {
|
||||
creationUserData: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.addClipboardListener()
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.removeClipboardListener()
|
||||
},
|
||||
methods: {
|
||||
myself(item) {
|
||||
return item.userId === this.$store.state.moderator.id
|
||||
@ -222,6 +228,23 @@ export default {
|
||||
this.creationUserData = row.item
|
||||
}
|
||||
},
|
||||
addClipboardListener() {
|
||||
document.addEventListener('copy', this.handleCopy)
|
||||
},
|
||||
removeClipboardListener() {
|
||||
document.removeEventListener('copy', this.handleCopy)
|
||||
},
|
||||
handleCopy(event) {
|
||||
// get from user selected text
|
||||
const selectedText = window.getSelection().toString()
|
||||
|
||||
if (selectedText) {
|
||||
// remove hashtags
|
||||
const cleanedText = selectedText.replace(/#[a-zA-Z0-9_-]*/g, '')
|
||||
event.clipboardData.setData('text/plain', cleanedText)
|
||||
event.preventDefault()
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -26,6 +26,7 @@ export const adminListContributions = gql`
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
email
|
||||
amount
|
||||
memo
|
||||
createdAt
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
},
|
||||
"contributionMessagesForm": {
|
||||
"resubmissionDateInPast": "Wiedervorlage Datum befindet sich in der Vergangenheit!",
|
||||
"userDetailsRegisteredAt": "{firstName} {lastName} <{email}> hat sich am {createdAt} registriert."
|
||||
"hasRegisteredAt": "hat sich am {createdAt} registriert."
|
||||
},
|
||||
"contributions": {
|
||||
"all": "Alle",
|
||||
@ -143,7 +143,7 @@
|
||||
"plus": "+"
|
||||
},
|
||||
"message": {
|
||||
"request": "Die Anfrage wurde gesendet."
|
||||
"request": "Die Eingabe wurde gespeichert."
|
||||
},
|
||||
"moderator": {
|
||||
"history": "Die Daten wurden geändert. Dies sind die alten Daten.",
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
},
|
||||
"contributionMessagesForm": {
|
||||
"resubmissionDateInPast": "Resubmission date is in the past!",
|
||||
"userDetailsRegisteredAt": "{firstName} {lastName} <{email}> registered on {createdAt}."
|
||||
"hasRegisteredAt": "registered on {createdAt}."
|
||||
},
|
||||
"contributions": {
|
||||
"all": "All",
|
||||
@ -74,8 +74,8 @@
|
||||
"deleted_user": "All deleted user",
|
||||
"deny": "Reject",
|
||||
"description": "Description",
|
||||
"e_mail": "E-mail",
|
||||
"details": "Details",
|
||||
"e_mail": "E-mail",
|
||||
"edit": "edit",
|
||||
"enabled": "enabled",
|
||||
"error": "Error",
|
||||
@ -143,7 +143,7 @@
|
||||
"plus": "+"
|
||||
},
|
||||
"message": {
|
||||
"request": "Request has been sent."
|
||||
"request": "The entry has been saved."
|
||||
},
|
||||
"moderator": {
|
||||
"history": "The data has been changed. This is the old data.",
|
||||
|
||||
@ -7,8 +7,9 @@ import { ObjectType, Field, Int } from 'type-graphql'
|
||||
export class Contribution {
|
||||
constructor(contribution: dbContribution, user?: User | null) {
|
||||
this.id = contribution.id
|
||||
this.firstName = user ? user.firstName : null
|
||||
this.lastName = user ? user.lastName : null
|
||||
this.firstName = user?.firstName ?? null
|
||||
this.lastName = user?.lastName ?? null
|
||||
this.email = user?.emailContact?.email ?? null
|
||||
this.amount = contribution.amount
|
||||
this.memo = contribution.memo
|
||||
this.createdAt = contribution.createdAt
|
||||
@ -37,6 +38,9 @@ export class Contribution {
|
||||
@Field(() => String, { nullable: true })
|
||||
lastName: string | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
email: string | null
|
||||
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
|
||||
@ -51,8 +51,8 @@
|
||||
"contribution": {
|
||||
"activity": "Tätigkeit",
|
||||
"alert": {
|
||||
"answerQuestion": "Bitte beantworte diese Rückfrage.",
|
||||
"answerQuestionToast": "Du hast eine Rückfrage auf einen Beitrag. Bitte antworte auf diese.",
|
||||
"answerQuestion": "Zu diesem Beitrag liegt eine neue Nachricht vor.",
|
||||
"answerQuestionToast": "Du hast neue Nachrichten.",
|
||||
"communityNoteList": "Hier findest du alle eingereichten und bestätigten Beiträge von allen Mitgliedern aus dieser Gemeinschaft.",
|
||||
"confirm": "bestätigt",
|
||||
"deleted": "gelöscht",
|
||||
|
||||
@ -51,8 +51,8 @@
|
||||
"contribution": {
|
||||
"activity": "Activity",
|
||||
"alert": {
|
||||
"answerQuestion": "Please answer the question.",
|
||||
"answerQuestionToast": "You have a question about a post. Please reply to it.",
|
||||
"answerQuestion": "There is a new message for this article.",
|
||||
"answerQuestionToast": "You have new messages.",
|
||||
"communityNoteList": "Here you will find all submitted and confirmed contributions from all members of this community.",
|
||||
"confirm": "confirmed",
|
||||
"deleted": "deleted",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user