diff --git a/admin/src/components/NavBar.spec.js b/admin/src/components/NavBar.spec.js index c6a63db84..8f4b0a171 100644 --- a/admin/src/components/NavBar.spec.js +++ b/admin/src/components/NavBar.spec.js @@ -101,12 +101,13 @@ describe('NavBar', () => { describe('Navbar Menu', () => { it('has correct menu items', () => { const navItems = wrapper.findAll('.nav-item a') - expect(navItems).toHaveLength(7) + expect(navItems).toHaveLength(8) expect(navItems[0].attributes('href')).toBe('/user') expect(navItems[1].attributes('href')).toBe('/creation-confirm') expect(navItems[2].attributes('href')).toBe('/contribution-links') expect(navItems[3].attributes('href')).toBe('/federation') - expect(navItems[4].attributes('href')).toBe('/statistic') + expect(navItems[4].attributes('href')).toBe('/projectBranding') + expect(navItems[5].attributes('href')).toBe('/statistic') }) }) diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index fa715da88..55150a485 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -32,7 +32,11 @@ {{ $t('navbar.instances') }} - + {{ $t('navbar.projectBranding') }} diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 5118d2acb..025d06adc 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -56,6 +56,7 @@ "enter_text": "Text eintragen", "form": "Schöpfungsformular", "min_characters": "Mindestens 10 Zeichen eingeben", + "reset": "Zurücksetzen", "select_month": "Monat auswählen", "select_value": "Betrag auswählen", "submit_creation": "Schöpfung einreichen", diff --git a/admin/src/validationSchemas.js b/admin/src/validationSchemas.js deleted file mode 100644 index b31e3043c..000000000 --- a/admin/src/validationSchemas.js +++ /dev/null @@ -1,14 +0,0 @@ -// TODO: only needed for grace period, before all inputs updated for using veeValidate + yup -export const isLanguageKey = (str) => - str.match(/^(?!\.)[a-z][a-zA-Z0-9-]*([.][a-z][a-zA-Z0-9-]*)*(? { - const type = typeof error - if (type === 'object') { - return t(error.key, error.values) - } else if (type === 'string' && error.length > 0 && isLanguageKey(error)) { - return t(error) - } else { - return error - } -} diff --git a/backend/src/apis/humhub/HumHubClient.ts b/backend/src/apis/humhub/HumHubClient.ts index 1b369b16e..27567e770 100644 --- a/backend/src/apis/humhub/HumHubClient.ts +++ b/backend/src/apis/humhub/HumHubClient.ts @@ -1,3 +1,4 @@ +import { ProjectBranding } from '@entity/ProjectBranding' import { SignJWT } from 'jose' import { IRequestOptions, IRestResponse, RestClient } from 'typed-rest-client' @@ -8,10 +9,9 @@ import { backendLogger as logger } from '@/server/logger' import { PostUserLoggingView } from './logging/PostUserLogging.view' import { GetUser } from './model/GetUser' import { PostUser } from './model/PostUser' +import { Space } from './model/Space' import { SpacesResponse } from './model/SpacesResponse' import { UsersResponse } from './model/UsersResponse' -import { Space } from './model/Space' -import { ProjectBranding } from '@entity/ProjectBranding' /** * HumHubClient as singleton class diff --git a/backend/src/graphql/model/ProjectBranding.ts b/backend/src/graphql/model/ProjectBranding.ts index 4bbddbcf4..c76289405 100644 --- a/backend/src/graphql/model/ProjectBranding.ts +++ b/backend/src/graphql/model/ProjectBranding.ts @@ -1,8 +1,6 @@ import { ProjectBranding as dbProjectBranding } from '@entity/ProjectBranding' import { ObjectType, Field, Int } from 'type-graphql' -import { Space } from './Space' - @ObjectType() export class ProjectBranding { constructor(projectBranding: dbProjectBranding) { diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index a82f623cc..09f05c852 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -153,9 +153,9 @@ describe('ContributionMessageResolver', () => { message: 'Test', }, }) - expect(logger.debug).toBeCalledTimes(4) + expect(logger.debug).toBeCalledTimes(9) expect(logger.debug).toHaveBeenNthCalledWith( - 4, + 8, 'use UnconfirmedContributionUserAddMessageRole', ) expect(mutationResult).toEqual( @@ -351,9 +351,9 @@ describe('ContributionMessageResolver', () => { }, }) - expect(logger.debug).toBeCalledTimes(4) + expect(logger.debug).toBeCalledTimes(8) expect(logger.debug).toHaveBeenNthCalledWith( - 4, + 8, 'use UnconfirmedContributionAdminAddMessageRole', ) @@ -386,9 +386,9 @@ describe('ContributionMessageResolver', () => { }, }) - expect(logger.debug).toBeCalledTimes(4) + expect(logger.debug).toBeCalledTimes(8) expect(logger.debug).toHaveBeenNthCalledWith( - 4, + 8, 'use UnconfirmedContributionAdminAddMessageRole', ) @@ -404,7 +404,7 @@ describe('ContributionMessageResolver', () => { }) it('logs the error "ContributionMessage was not sent successfully: Error: missing right ADMIN_CREATE_CONTRIBUTION_MESSAGE for user"', () => { - expect(logger.debug).toBeCalledTimes(4) + expect(logger.debug).toBeCalledTimes(8) expect(logger.error).toHaveBeenNthCalledWith( 1, 'missing right ADMIN_CREATE_CONTRIBUTION_MESSAGE for user', diff --git a/backend/src/graphql/resolver/util/creations.test.ts b/backend/src/graphql/resolver/util/creations.test.ts index 8b59d0b14..154520b85 100644 --- a/backend/src/graphql/resolver/util/creations.test.ts +++ b/backend/src/graphql/resolver/util/creations.test.ts @@ -5,6 +5,7 @@ import { ApolloServerTestClient } from 'apollo-server-testing' import { testEnvironment, cleanDB, contributionDateFormatter } from '@test/helpers' +import { CONFIG } from '@/config' import { userFactory } from '@/seeds/factory/user' import { login, createContribution, adminCreateContribution } from '@/seeds/graphql/mutations' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' @@ -14,6 +15,8 @@ import { getOpenCreations, getUserCreation } from './creations' jest.mock('@/password/EncryptorUtils') +CONFIG.HUMHUB_ACTIVE = false + let mutate: ApolloServerTestClient['mutate'], con: Connection let testEnv: { mutate: ApolloServerTestClient['mutate'] @@ -272,6 +275,7 @@ describe('util/creation', () => { }) }) }) + describe('getOpenCreations', () => { beforeAll(() => { // enable Fake timers diff --git a/frontend/src/components/Contributions/ContributionListItem.spec.js b/frontend/src/components/Contributions/ContributionListItem.spec.js index 6140a9147..eb5fb1247 100644 --- a/frontend/src/components/Contributions/ContributionListItem.spec.js +++ b/frontend/src/components/Contributions/ContributionListItem.spec.js @@ -22,6 +22,12 @@ vi.mock('@vue/apollo-composable', () => ({ })), })) +vi.mock('@/composables/useToast', () => ({ + useAppToast: vi.fn(() => ({ + addToast: vi.fn(), + })), +})) + describe('ContributionListItem', () => { let wrapper @@ -99,12 +105,6 @@ describe('ContributionListItem', () => { }) }) - describe('date', () => { - it('is equal to createdAt', () => { - expect(wrapper.vm.date).toBe(wrapper.vm.createdAt) - }) - }) - describe('delete contribution', () => { describe('edit contribution', () => { beforeEach(() => { diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 87dffa6b3..d3b0299b7 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -125,7 +125,7 @@ import ContributionMessagesList from '@/components/ContributionMessages/Contribu import { listContributionMessages } from '@/graphql/queries' import { useAppToast } from '@/composables/useToast' import { useI18n } from 'vue-i18n' -import { useLazyQuery, useQuery } from '@vue/apollo-composable' +import { useLazyQuery } from '@vue/apollo-composable' import AppAvatar from '@/components/AppAvatar.vue' const props = defineProps({ @@ -201,10 +201,9 @@ const props = defineProps({ }, }) -const { toastError, toastSuccess } = useAppToast() +const { toastError } = useAppToast() const { t } = useI18n() -const inProcess = ref(true) const messagesGet = ref([]) const visible = ref(false) @@ -224,8 +223,6 @@ const icon = computed(() => { return 'bell-fill' }) -const date = computed(() => props.createdAt) - const collapseId = computed(() => 'collapse' + String(props.id)) const username = computed(() => ({ diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js index 0a225b5e0..be619002b 100644 --- a/frontend/src/pages/Login.spec.js +++ b/frontend/src/pages/Login.spec.js @@ -34,6 +34,9 @@ vi.mock('@vue/apollo-composable', () => ({ useMutation: () => ({ mutate: mockMutate, }), + useLazyQuery: () => ({ + load: vi.fn(), + }), })) describe('Login', () => { diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index de16f8a5c..7c1644047 100644 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -74,7 +74,7 @@ const form = ref({ password: '', }) -const { handleSubmit, meta, values } = useForm({ +const { handleSubmit, meta } = useForm({ initialValues: form.value, }) diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 3e41442ad..019f1fbe6 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -161,9 +161,9 @@ describe('Vuex store', () => { const commit = vi.fn() const state = {} - it('calls nineteen commits', () => { + it('calls twente commits', () => { logout({ commit, state }) - expect(commit).toHaveBeenCalledTimes(19) + expect(commit).toHaveBeenCalledTimes(20) }) // ... (other logout action tests remain largely the same)