Merge branch 'master' into unit-tests-community-page

This commit is contained in:
Moriz Wahl 2023-01-20 10:41:29 +01:00
commit a1b1142128
13 changed files with 283 additions and 262 deletions

View File

@ -35,7 +35,6 @@ jobs:
build_test_admin:
name: Docker Build Test - Admin Interface
runs-on: ubuntu-latest
#needs: [nothing]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################

View File

@ -4,8 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [1.17.1](https://github.com/gradido/gradido/compare/1.17.0...1.17.1)
- refactor(frontend): change contribution memo add word-break [`#2583`](https://github.com/gradido/gradido/pull/2583)
- refactor(admin): add text-break on all table memo fields [`#2584`](https://github.com/gradido/gradido/pull/2584)
- fix(frontend): throw proper frontend warning errors [`#2586`](https://github.com/gradido/gradido/pull/2586)
- refactor(frontend): equalize en with fr languages. [`#2585`](https://github.com/gradido/gradido/pull/2585)
- refactor(frontend): forgot password unit tests [`#2582`](https://github.com/gradido/gradido/pull/2582)
- fix(frontend): fix min value for hours input [`#2581`](https://github.com/gradido/gradido/pull/2581)
- fix(frontend): change dropdown placement calender no-flip true [`#2580`](https://github.com/gradido/gradido/pull/2580)
- refactor(frontend): link send result style [`#2577`](https://github.com/gradido/gradido/pull/2577)
- refactor(frontend): remove vertical scrolling & small fixes [`#2578`](https://github.com/gradido/gradido/pull/2578)
- refactor(frontend): tyle mobile device auth template [`#2576`](https://github.com/gradido/gradido/pull/2576)
#### [1.17.0](https://github.com/gradido/gradido/compare/1.16.0...1.17.0)
> 18 January 2023
- chore(release): v1.17.0 [`#2575`](https://github.com/gradido/gradido/pull/2575)
- fix(frontend): submit contribution text [`#2573`](https://github.com/gradido/gradido/pull/2573)
- fix(backend): admin cannot delete confirmed contribution [`#2571`](https://github.com/gradido/gradido/pull/2571)
- fix(frontend): english locales - horas -> hours [`#2572`](https://github.com/gradido/gradido/pull/2572)

View File

@ -3,7 +3,7 @@
"description": "Administraion Interface for Gradido",
"main": "index.js",
"author": "Moriz Wahl",
"version": "1.17.0",
"version": "1.17.1",
"license": "Apache-2.0",
"private": false,
"scripts": {

View File

@ -1,6 +1,6 @@
{
"name": "gradido-backend",
"version": "1.17.0",
"version": "1.17.1",
"description": "Gradido unified backend providing an API-Service for Gradido Transactions",
"main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/backend",

View File

@ -1,6 +1,6 @@
{
"name": "gradido-database",
"version": "1.17.0",
"version": "1.17.1",
"description": "Gradido Database Tool to execute database migrations",
"main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/database",

View File

@ -1,6 +1,6 @@
{
"name": "bootstrap-vue-gradido-wallet",
"version": "1.17.0",
"version": "1.17.1",
"private": true,
"scripts": {
"start": "node run/server.js",

View File

@ -16,12 +16,15 @@
<b-avatar v-else :icon="icon" :variant="variant" size="3em"></b-avatar>
</b-col>
<b-col>
<div v-if="firstName" class="mr-3 font-weight-bold">{{ firstName }} {{ lastName }}</div>
<div v-if="firstName" class="mr-3 font-weight-bold">
{{ firstName }} {{ lastName }}
<b-icon :icon="icon" :variant="variant"></b-icon>
</div>
<div class="small">
{{ $d(new Date(contributionDate), 'monthAndYear') }}
</div>
<div class="mt-3 font-weight-bold">{{ $t('contributionText') }}</div>
<div class="mb-3">{{ memo }}</div>
<div class="mb-3 text-break word-break">{{ memo }}</div>
<div v-if="state === 'IN_PROGRESS'" class="text-205">
{{ $t('contribution.alert.answerQuestion') }}
</div>

View File

@ -18,6 +18,7 @@
rows="4"
max-rows="4"
:disabled="disabled"
no-resize
></b-form-textarea>
<b-form-invalid-feedback v-bind="ariaMsg">
{{ errors[0] }}

View File

@ -37,7 +37,8 @@
"contribution": {
"activity": "Tätigkeit",
"alert": {
"answerQuestion": "Bitte beantworte die Rückfrage!",
"answerQuestion": "Bitte beantworte diese Rückfrage.",
"answerQuestionToast": "Du hast eine Rückfrage auf einen Beitrag. Bitte antworte auf diese.",
"communityNoteList": "Hier findest du alle eingereichten und bestätigten Beiträge von allen Mitgliedern aus dieser Gemeinschaft.",
"confirm": "bestätigt",
"deleted": "gelöscht",

View File

@ -37,7 +37,8 @@
"contribution": {
"activity": "Activity",
"alert": {
"answerQuestion": "Please answer the question",
"answerQuestion": "Please answer the question.",
"answerQuestionToast": "You have a question about a post. Please reply to it.",
"communityNoteList": "Here you will find all submitted and confirmed contributions from all members of this community.",
"confirm": "confirmed",
"deleted": "deleted",

View File

@ -250,7 +250,7 @@ describe('Community', () => {
it('toasts an info', () => {
expect(toastInfoSpy).toBeCalledWith(
'Du hast eine Rückfrage auf eine Contribution. Bitte beantworte diese!',
'contribution.alert.answerQuestionToast',
)
})
})

View File

@ -48,258 +48,258 @@
</div>
</template>
<script>
import OpenCreationsAmount from '@/components/Contributions/OpenCreationsAmount.vue'
import ContributionForm from '@/components/Contributions/ContributionForm.vue'
import ContributionList from '@/components/Contributions/ContributionList.vue'
import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations'
import { listContributions, listAllContributions, openCreations } from '@/graphql/queries'
import OpenCreationsAmount from '@/components/Contributions/OpenCreationsAmount.vue'
import ContributionForm from '@/components/Contributions/ContributionForm.vue'
import ContributionList from '@/components/Contributions/ContributionList.vue'
import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations'
import { listContributions, listAllContributions, openCreations } from '@/graphql/queries'
export default {
name: 'Community',
components: {
ContributionForm,
ContributionList,
OpenCreationsAmount,
},
data() {
return {
hashLink: '',
tabLinkHashes: ['#edit', '#my', '#all'],
tabIndex: 0,
items: [],
itemsAll: [],
currentPage: 1,
pageSize: 25,
currentPageAll: 1,
pageSizeAll: 25,
contributionCount: 0,
contributionCountAll: 0,
form: {
id: null,
date: '',
memo: '',
hours: 0,
amount: '',
},
updateAmount: '',
maximalDate: new Date(),
openCreations: [],
}
},
mounted() {
this.$nextTick(() => {
this.tabIndex = this.tabLinkHashes.findIndex((hashLink) => hashLink === this.$route.hash)
this.hashLink = this.$route.hash
})
},
apollo: {
OpenCreations: {
query() {
return openCreations
},
fetchPolicy: 'network-only',
variables() {
return {}
},
update({ openCreations }) {
this.openCreations = openCreations
},
error({ message }) {
this.toastError(message)
},
},
ListAllContributions: {
query() {
return listAllContributions
},
fetchPolicy: 'network-only',
variables() {
return {
currentPage: this.currentPageAll,
pageSize: this.pageSizeAll,
}
},
update({ listAllContributions }) {
this.contributionCountAll = listAllContributions.contributionCount
this.itemsAll = listAllContributions.contributionList
},
error({ message }) {
this.toastError(message)
},
},
ListContributions: {
query() {
return listContributions
},
fetchPolicy: 'network-only',
variables() {
return {
currentPage: this.currentPage,
pageSize: this.pageSize,
}
},
update({ listContributions }) {
this.contributionCount = listContributions.contributionCount
this.items = listContributions.contributionList
if (this.items.find((item) => item.state === 'IN_PROGRESS')) {
this.tabIndex = 1
if (this.$route.hash !== '#my') {
this.$router.push({ path: '/community#my' })
}
this.toastInfo('Du hast eine Rückfrage auf eine Contribution. Bitte beantworte diese!')
}
},
error({ message }) {
this.toastError(message)
},
},
},
watch: {
$route(to, from) {
this.tabIndex = this.tabLinkHashes.findIndex((hashLink) => hashLink === to.hash)
this.hashLink = to.hash
this.closeAllOpenCollapse()
},
tabIndex(num) {
if (num !== 0) {
this.form = {
id: null,
date: new Date(),
memo: '',
hours: 0,
amount: '',
}
}
},
},
computed: {
minimalDate() {
const date = new Date(this.maximalDate)
return new Date(date.setMonth(date.getMonth() - 1, 1))
},
isThisMonth() {
const formDate = new Date(this.form.date)
return (
formDate.getFullYear() === this.maximalDate.getFullYear() &&
formDate.getMonth() === this.maximalDate.getMonth()
)
},
amountToAdd() {
// when existing contribution is edited, the amount is added back on top of the amount
if (this.form.id) return parseInt(this.updateAmount)
return 0
},
maxForMonths() {
const formDate = new Date(this.form.date)
if (this.openCreations && this.openCreations.length)
return this.openCreations.slice(1).map((creation) => {
if (creation.year === formDate.getFullYear() && creation.month === formDate.getMonth())
return parseInt(creation.amount) + this.amountToAdd
return parseInt(creation.amount)
})
return [0, 0]
},
},
methods: {
closeAllOpenCollapse() {
this.$el.querySelectorAll('.collapse.show').forEach((value) => {
this.$root.$emit('bv::toggle::collapse', value.id)
})
},
refetchData() {
this.$apollo.queries.ListAllContributions.refetch()
this.$apollo.queries.ListContributions.refetch()
this.$apollo.queries.OpenCreations.refetch()
},
saveContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: createContribution,
variables: {
creationDate: data.date,
memo: data.memo,
amount: data.amount,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.submitted'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
updateContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: updateContribution,
variables: {
contributionId: data.id,
creationDate: data.date,
memo: data.memo,
amount: data.amount,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.updated'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
deleteContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: deleteContribution,
variables: {
id: data.id,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.deleted'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
updateListAllContributions(pagination) {
this.currentPageAll = pagination.currentPage
this.pageSizeAll = pagination.pageSize
this.$apollo.queries.ListAllContributions.refetch()
},
updateListContributions(pagination) {
this.currentPage = pagination.currentPage
this.pageSize = pagination.pageSize
this.$apollo.queries.ListContributions.refetch()
},
updateContributionForm(item) {
this.form.id = item.id
this.form.date = item.contributionDate
this.form.memo = item.memo
this.form.amount = item.amount
this.form.hours = item.amount / 20
this.updateAmount = item.amount
this.$router.push({ path: '#edit' })
this.tabIndex = 0
},
updateTransactions(pagination) {
this.$emit('update-transactions', pagination)
},
updateState(id) {
this.items.find((item) => item.id === id).state = 'PENDING'
},
},
created() {
this.updateTransactions(0)
this.tabIndex = 1
this.$router.push({ path: '/community#my' })
},
}
export default {
name: 'Community',
components: {
ContributionForm,
ContributionList,
OpenCreationsAmount,
},
data() {
return {
hashLink: '',
tabLinkHashes: ['#edit', '#my', '#all'],
tabIndex: 0,
items: [],
itemsAll: [],
currentPage: 1,
pageSize: 25,
currentPageAll: 1,
pageSizeAll: 25,
contributionCount: 0,
contributionCountAll: 0,
form: {
id: null,
date: '',
memo: '',
hours: 0,
amount: '',
},
updateAmount: '',
maximalDate: new Date(),
openCreations: [],
}
},
mounted() {
this.$nextTick(() => {
this.tabIndex = this.tabLinkHashes.findIndex((hashLink) => hashLink === this.$route.hash)
this.hashLink = this.$route.hash
})
},
apollo: {
OpenCreations: {
query() {
return openCreations
},
fetchPolicy: 'network-only',
variables() {
return {}
},
update({ openCreations }) {
this.openCreations = openCreations
},
error({ message }) {
this.toastError(message)
},
},
ListAllContributions: {
query() {
return listAllContributions
},
fetchPolicy: 'network-only',
variables() {
return {
currentPage: this.currentPageAll,
pageSize: this.pageSizeAll,
}
},
update({ listAllContributions }) {
this.contributionCountAll = listAllContributions.contributionCount
this.itemsAll = listAllContributions.contributionList
},
error({ message }) {
this.toastError(message)
},
},
ListContributions: {
query() {
return listContributions
},
fetchPolicy: 'network-only',
variables() {
return {
currentPage: this.currentPage,
pageSize: this.pageSize,
}
},
update({ listContributions }) {
this.contributionCount = listContributions.contributionCount
this.items = listContributions.contributionList
if (this.items.find((item) => item.state === 'IN_PROGRESS')) {
this.tabIndex = 1
if (this.$route.hash !== '#my') {
this.$router.push({ path: '/community#my' })
}
this.toastInfo(this.$t('contribution.alert.answerQuestionToast'))
}
},
error({ message }) {
this.toastError(message)
},
},
},
watch: {
$route(to, from) {
this.tabIndex = this.tabLinkHashes.findIndex((hashLink) => hashLink === to.hash)
this.hashLink = to.hash
this.closeAllOpenCollapse()
},
tabIndex(num) {
if (num !== 0) {
this.form = {
id: null,
date: new Date(),
memo: '',
hours: 0,
amount: '',
}
}
},
},
computed: {
minimalDate() {
const date = new Date(this.maximalDate)
return new Date(date.setMonth(date.getMonth() - 1, 1))
},
isThisMonth() {
const formDate = new Date(this.form.date)
return (
formDate.getFullYear() === this.maximalDate.getFullYear() &&
formDate.getMonth() === this.maximalDate.getMonth()
)
},
amountToAdd() {
// when existing contribution is edited, the amount is added back on top of the amount
if (this.form.id) return parseInt(this.updateAmount)
return 0
},
maxForMonths() {
const formDate = new Date(this.form.date)
if (this.openCreations && this.openCreations.length)
return this.openCreations.slice(1).map((creation) => {
if (creation.year === formDate.getFullYear() && creation.month === formDate.getMonth())
return parseInt(creation.amount) + this.amountToAdd
return parseInt(creation.amount)
})
return [0, 0]
},
},
methods: {
closeAllOpenCollapse() {
this.$el.querySelectorAll('.collapse.show').forEach((value) => {
this.$root.$emit('bv::toggle::collapse', value.id)
})
},
refetchData() {
this.$apollo.queries.ListAllContributions.refetch()
this.$apollo.queries.ListContributions.refetch()
this.$apollo.queries.OpenCreations.refetch()
},
saveContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: createContribution,
variables: {
creationDate: data.date,
memo: data.memo,
amount: data.amount,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.submitted'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
updateContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: updateContribution,
variables: {
contributionId: data.id,
creationDate: data.date,
memo: data.memo,
amount: data.amount,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.updated'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
deleteContribution(data) {
this.$apollo
.mutate({
fetchPolicy: 'no-cache',
mutation: deleteContribution,
variables: {
id: data.id,
},
})
.then((result) => {
this.toastSuccess(this.$t('contribution.deleted'))
this.refetchData()
})
.catch((err) => {
this.toastError(err.message)
})
},
updateListAllContributions(pagination) {
this.currentPageAll = pagination.currentPage
this.pageSizeAll = pagination.pageSize
this.$apollo.queries.ListAllContributions.refetch()
},
updateListContributions(pagination) {
this.currentPage = pagination.currentPage
this.pageSize = pagination.pageSize
this.$apollo.queries.ListContributions.refetch()
},
updateContributionForm(item) {
this.form.id = item.id
this.form.date = item.contributionDate
this.form.memo = item.memo
this.form.amount = item.amount
this.form.hours = item.amount / 20
this.updateAmount = item.amount
this.$router.push({ path: '#edit' })
this.tabIndex = 0
},
updateTransactions(pagination) {
this.$emit('update-transactions', pagination)
},
updateState(id) {
this.items.find((item) => item.id === id).state = 'PENDING'
},
},
created() {
this.updateTransactions(0)
this.tabIndex = 1
this.$router.push({ path: '/community#my' })
},
}
</script>
<style scoped>
.tab-content {

View File

@ -1,6 +1,6 @@
{
"name": "gradido",
"version": "1.17.0",
"version": "1.17.1",
"description": "Gradido",
"main": "index.js",
"repository": "git@github.com:gradido/gradido.git",