Skip to content

Commit

Permalink
Merge pull request #1649 from serlo/change-fallback-title-for-German-…
Browse files Browse the repository at this point in the history
…instance

change fallback title for German instance
  • Loading branch information
hugotiburtino authored Jul 3, 2024
2 parents 6aa2247 + 5745bcd commit 22e7ac9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/server/src/schema/uuid/abstract-uuid/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { createEvent } from '~/schema/events/event'
import { SubjectResolver } from '~/schema/subject/resolvers'
import { decodePath, encodePath } from '~/schema/uuid/alias/utils'
import { Resolvers, QueryUuidArgs, TaxonomyTermType } from '~/types'
import { Instance, Resolvers, QueryUuidArgs, TaxonomyTermType } from '~/types'
import { isDefined } from '~/utils'

export const UuidResolver = createCachedResolver<
Expand Down Expand Up @@ -379,7 +379,18 @@ async function resolveUuidFromDatabase(
)
: null
const subjectName = subject ? toSlug(subject.name) : 'serlo'
const slugTitle = toSlug(baseUuid.entityTitle ?? baseUuid.entityType)

const slugTitle = baseUuid.entityTitle
? toSlug(baseUuid.entityTitle)
: (() => {
if (baseUuid.entityInstance === Instance.De) {
if (baseUuid.entityType === 'text-exercise') return 'aufgabe'
if (baseUuid.entityType === 'text-exercise-group')
return 'aufgabengruppe'
}
return baseUuid.entityType
})()

const entity = {
...base,
instance: baseUuid.entityInstance,
Expand Down

0 comments on commit 22e7ac9

Please sign in to comment.