Rename group properties 'description' to 'groupDescription', 'descriptionExcerpt' to 'groupDescriptionExcerpt'

This commit is contained in:
Wolfgang Huß 2022-11-09 19:39:36 +01:00
parent c960abf372
commit 3ba4467fe4
22 changed files with 191 additions and 133 deletions

View File

@ -9,7 +9,7 @@ export const createGroupMutation = () => {
$name: String!
$slug: String
$about: String
$description: String!
$groupDescription: String!
$groupType: GroupType!
$actionRadius: GroupActionRadius!
$categoryIds: [ID]
@ -20,7 +20,7 @@ export const createGroupMutation = () => {
name: $name
slug: $slug
about: $about
description: $description
groupDescription: $groupDescription
groupType: $groupType
actionRadius: $actionRadius
categoryIds: $categoryIds
@ -34,8 +34,8 @@ export const createGroupMutation = () => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {
@ -63,7 +63,7 @@ export const updateGroupMutation = () => {
$name: String
$slug: String
$about: String
$description: String
$groupDescription: String
$actionRadius: GroupActionRadius
$categoryIds: [ID]
$avatar: ImageInput
@ -74,7 +74,7 @@ export const updateGroupMutation = () => {
name: $name
slug: $slug
about: $about
description: $description
groupDescription: $groupDescription
actionRadius: $actionRadius
categoryIds: $categoryIds
avatar: $avatar
@ -88,8 +88,8 @@ export const updateGroupMutation = () => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {
@ -164,8 +164,8 @@ export const groupQuery = () => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {

View File

@ -310,7 +310,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
id: 'g0',
name: 'Investigative Journalism',
about: 'Investigative journalists share ideas and insights and can collaborate.',
description: `<p class=""><em>English:</em></p><p class="">This group is hidden.</p><h3>What is our group for?</h3><p>This group was created to allow investigative journalists to share and collaborate.</p><h3>How does it work?</h3><p>Here you can internally share posts and comments about them.</p><p><br></p><p><em>Deutsch:</em></p><p class="">Diese Gruppe ist verborgen.</p><h3>Wofür ist unsere Gruppe?</h3><p class="">Diese Gruppe wurde geschaffen, um investigativen Journalisten den Austausch und die Zusammenarbeit zu ermöglichen.</p><h3>Wie funktioniert das?</h3><p class="">Hier könnt ihr euch intern über Beiträge und Kommentare zu ihnen austauschen.</p>`,
groupDescription: `<p class=""><em>English:</em></p><p class="">This group is hidden.</p><h3>What is our group for?</h3><p>This group was created to allow investigative journalists to share and collaborate.</p><h3>How does it work?</h3><p>Here you can internally share posts and comments about them.</p><p><br></p><p><em>Deutsch:</em></p><p class="">Diese Gruppe ist verborgen.</p><h3>Wofür ist unsere Gruppe?</h3><p class="">Diese Gruppe wurde geschaffen, um investigativen Journalisten den Austausch und die Zusammenarbeit zu ermöglichen.</p><h3>Wie funktioniert das?</h3><p class="">Hier könnt ihr euch intern über Beiträge und Kommentare zu ihnen austauschen.</p>`,
groupType: 'hidden',
actionRadius: 'global',
categoryIds: ['cat6', 'cat12', 'cat16'],
@ -395,7 +395,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
id: 'g1',
name: 'School For Citizens',
about: 'Our children shall receive education for life.',
description: `<p class=""><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, the people, and satisfies it through a lot of experience.</p><p><br></p><p><em>Deutsch</em></p><h3>Unser Ziel</h3><p class="">Nur wer Spaß am Lernen hat und seine Neugier nicht verliert, kann gute Bildung für's Leben erlangen und sein ganzes Leben mit Freude weiter lernen.</p><h3>Neugier</h3><p class="">Dazu benötigen wir eine Schule, die die Neugier der Kinder, der Menschen, aufnimmt und durch viel Erfahrung befriedigt.</p>`,
groupDescription: `<p class=""><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, the people, and satisfies it through a lot of experience.</p><p><br></p><p><em>Deutsch</em></p><h3>Unser Ziel</h3><p class="">Nur wer Spaß am Lernen hat und seine Neugier nicht verliert, kann gute Bildung für's Leben erlangen und sein ganzes Leben mit Freude weiter lernen.</p><h3>Neugier</h3><p class="">Dazu benötigen wir eine Schule, die die Neugier der Kinder, der Menschen, aufnimmt und durch viel Erfahrung befriedigt.</p>`,
groupType: 'closed',
actionRadius: 'national',
categoryIds: ['cat8', 'cat14'],
@ -501,7 +501,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
id: 'g2',
name: 'Yoga Practice',
about: 'We do yoga around the clock.',
description: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
groupDescription: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
groupType: 'public',
actionRadius: 'interplanetary',
categoryIds: ['cat4', 'cat5', 'cat17'],

View File

@ -4,12 +4,18 @@ import { GROUPDESCRIPTION_EXCERPT_HTML_LENGTH } from '../constants/groups'
export default {
Mutation: {
CreateGroup: async (resolve, root, args, context, info) => {
args.descriptionExcerpt = trunc(args.description, GROUPDESCRIPTION_EXCERPT_HTML_LENGTH).html
args.groupDescriptionExcerpt = trunc(
args.groupDescription,
GROUPDESCRIPTION_EXCERPT_HTML_LENGTH,
).html
return resolve(root, args, context, info)
},
UpdateGroup: async (resolve, root, args, context, info) => {
if (args.description)
args.descriptionExcerpt = trunc(args.description, GROUPDESCRIPTION_EXCERPT_HTML_LENGTH).html
if (args.groupDescription)
args.groupDescriptionExcerpt = trunc(
args.groupDescription,
GROUPDESCRIPTION_EXCERPT_HTML_LENGTH,
).html
return resolve(root, args, context, info)
},
CreatePost: async (resolve, root, args, context, info) => {

View File

@ -12,7 +12,7 @@ const categoryIds = ['cat9']
const driver = getDriver()
const neode = getNeode()
const descriptionAdditional100 =
const groupDescriptionAdditional100 =
' 123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789'
const { server } = createServer({
@ -69,7 +69,7 @@ describe('slugifyMiddleware', () => {
...variables,
name: 'The Best Group',
about: 'Some about',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,
@ -89,7 +89,7 @@ describe('slugifyMiddleware', () => {
name: 'The Best Group',
slug: 'the-best-group',
about: 'Some about',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
},
@ -203,7 +203,7 @@ describe('slugifyMiddleware', () => {
name: 'The Best Group',
slug: 'the-best-group',
about: 'Some about',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,
@ -229,7 +229,7 @@ describe('slugifyMiddleware', () => {
name: 'The Best Group',
slug: 'my-best-group',
about: 'Some about',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
myRole: 'owner',
@ -249,7 +249,7 @@ describe('slugifyMiddleware', () => {
name: 'Pre-Existing Group',
slug: 'pre-existing-group',
about: 'Some about',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,

View File

@ -1,14 +1,18 @@
import { UserInputError } from 'apollo-server'
import { GROUPNAME_MIN_LENGTH, GROUPNAME_MAX_LENGTH } from '../../constants/groups'
// TODO: put this in a constants file
const COMMENT_MIN_LENGTH = 1
const NO_POST_ERR_MESSAGE = 'Comment cannot be created without a post!'
// TODO: put this in a constants file
// TODO: should there be a max length? I guess yes
const USERNAME_MIN_LENGTH = 3
const validateCreateComment = async (resolve, root, args, context, info) => {
const content = args.content.replace(/<(?:.|\n)*?>/gm, '').trim()
const { postId } = args
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
throw new UserInputError(`Comment must be at least ${COMMENT_MIN_LENGTH} character long!`)
throw new UserInputError(`Comment must be at least ${COMMENT_MIN_LENGTH} characters long!`)
}
const session = context.driver.session()
try {
@ -26,7 +30,7 @@ const validateCreateComment = async (resolve, root, args, context, info) => {
})
if (!post) {
throw new UserInputError(NO_POST_ERR_MESSAGE)
throw new UserInputError('Comment cannot be created without a post!')
} else {
return resolve(root, args, context, info)
}
@ -35,10 +39,25 @@ const validateCreateComment = async (resolve, root, args, context, info) => {
}
}
const validateGroup = async (resolve, root, params, context, info) => {
const { name } = params
// Wolle: TODO: write tests for it in 'backend/src/schema/resolvers/groups.spec.js'
if (typeof name === 'string' && name.trim().length < GROUPNAME_MIN_LENGTH) {
throw new UserInputError(`Group name must be at least ${GROUPNAME_MIN_LENGTH} characters long!`)
}
// Wolle: TODO: write tests for it in 'backend/src/schema/resolvers/groups.spec.js'
if (typeof name === 'string' && name.trim().length > GROUPNAME_MAX_LENGTH) {
throw new UserInputError(
`Group name must be not longer then ${GROUPNAME_MAX_LENGTH} characters!`,
)
}
return resolve(root, params, context, info)
}
const validateUpdateComment = async (resolve, root, args, context, info) => {
const content = args.content.replace(/<(?:.|\n)*?>/gm, '').trim()
if (!args.content || content.length < COMMENT_MIN_LENGTH) {
throw new UserInputError(`Comment must be at least ${COMMENT_MIN_LENGTH} character long!`)
throw new UserInputError(`Comment must be at least ${COMMENT_MIN_LENGTH} characters long!`)
}
return resolve(root, args, context, info)
@ -114,15 +133,17 @@ export const validateNotifyUsers = async (label, reason) => {
const validateUpdateUser = async (resolve, root, params, context, info) => {
const { name } = params
if (typeof name === 'string' && name.trim().length < USERNAME_MIN_LENGTH)
throw new UserInputError(`Username must be at least ${USERNAME_MIN_LENGTH} character long!`)
throw new UserInputError(`Username must be at least ${USERNAME_MIN_LENGTH} characters long!`)
return resolve(root, params, context, info)
}
export default {
Mutation: {
UpdateUser: validateUpdateUser,
CreateGroup: validateGroup,
UpdateGroup: validateGroup,
CreateComment: validateCreateComment,
UpdateComment: validateUpdateComment,
UpdateUser: validateUpdateUser,
fileReport: validateReport,
review: validateReview,
},

View File

@ -147,7 +147,7 @@ describe('validateCreateComment', () => {
mutate({ mutation: createCommentMutation, variables: createCommentVariables }),
).resolves.toMatchObject({
data: { CreateComment: null },
errors: [{ message: 'Comment must be at least 1 character long!' }],
errors: [{ message: 'Comment must be at least 1 characters long!' }],
})
})
@ -157,7 +157,7 @@ describe('validateCreateComment', () => {
mutate({ mutation: createCommentMutation, variables: createCommentVariables }),
).resolves.toMatchObject({
data: { CreateComment: null },
errors: [{ message: 'Comment must be at least 1 character long!' }],
errors: [{ message: 'Comment must be at least 1 characters long!' }],
})
})
@ -200,7 +200,7 @@ describe('validateCreateComment', () => {
mutate({ mutation: updateCommentMutation, variables: updateCommentVariables }),
).resolves.toMatchObject({
data: { UpdateComment: null },
errors: [{ message: 'Comment must be at least 1 character long!' }],
errors: [{ message: 'Comment must be at least 1 characters long!' }],
})
})
@ -210,7 +210,7 @@ describe('validateCreateComment', () => {
mutate({ mutation: updateCommentMutation, variables: updateCommentVariables }),
).resolves.toMatchObject({
data: { UpdateComment: null },
errors: [{ message: 'Comment must be at least 1 character long!' }],
errors: [{ message: 'Comment must be at least 1 characters long!' }],
})
})
})
@ -333,7 +333,7 @@ describe('validateReview', () => {
}
await expect(mutate({ mutation: updateUserMutation, variables })).resolves.toMatchObject({
data: { UpdateUser: null },
errors: [{ message: 'Username must be at least 3 character long!' }],
errors: [{ message: 'Username must be at least 3 characters long!' }],
})
})
})

View File

@ -1,7 +1,13 @@
import walkRecursive from '../helpers/walkRecursive'
import { cleanHtml } from '../middleware/helpers/cleanHtml.js'
const fields = ['content', 'contentExcerpt', 'reasonDescription']
const fields = [
'content',
'contentExcerpt',
'groupDescription', // Wolle: TODO: test this
'groupDescriptionExcerpt', // Wolle: TODO: test this
'reasonDescription',
]
export default {
Mutation: async (resolve, root, args, context, info) => {

View File

@ -28,8 +28,8 @@ export default {
},
about: { type: 'string', allow: [null, ''] },
description: { type: 'string', disallow: [null], min: 100 },
descriptionExcerpt: { type: 'string', allow: [null] },
groupDescription: { type: 'string', disallow: [null], min: 100 },
groupDescriptionExcerpt: { type: 'string', allow: [null] },
groupType: { type: 'string', default: 'public' },
actionRadius: { type: 'string', default: 'regional' },

View File

@ -125,16 +125,19 @@ export default {
const { categoryIds } = params
delete params.categoryIds
params.locationName = params.locationName === '' ? null : params.locationName
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (CONFIG.CATEGORIES_ACTIVE && (!categoryIds || categoryIds.length < CATEGORIES_MIN)) {
throw new UserInputError('Too view categories!')
}
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (CONFIG.CATEGORIES_ACTIVE && categoryIds && categoryIds.length > CATEGORIES_MAX) {
throw new UserInputError('Too many categories!')
}
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (
params.description === undefined ||
params.description === null ||
removeHtmlTags(params.description).length < GROUPDESCRIPTION_WITHOUT_HTML_LENGTH_MIN
params.groupDescription === undefined ||
params.groupDescription === null ||
removeHtmlTags(params.groupDescription).length < GROUPDESCRIPTION_WITHOUT_HTML_LENGTH_MIN
) {
throw new UserInputError('Description too short!')
}
@ -194,6 +197,7 @@ export default {
delete params.avatar
params.locationName = params.locationName === '' ? null : params.locationName
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (CONFIG.CATEGORIES_ACTIVE && categoryIds) {
if (categoryIds.length < CATEGORIES_MIN) {
throw new UserInputError('Too view categories!')
@ -202,13 +206,15 @@ export default {
throw new UserInputError('Too many categories!')
}
}
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (
params.description &&
removeHtmlTags(params.description).length < GROUPDESCRIPTION_WITHOUT_HTML_LENGTH_MIN
params.groupDescription &&
removeHtmlTags(params.groupDescription).length < GROUPDESCRIPTION_WITHOUT_HTML_LENGTH_MIN
) {
throw new UserInputError('Description too short!')
}
const session = context.driver.session()
// TODO: move to 'backend/src/middleware/validation/validationMiddleware.js'
if (CONFIG.CATEGORIES_ACTIVE && categoryIds && categoryIds.length) {
const cypherDeletePreviousRelations = `
MATCH (group:Group {id: $groupId})-[previousRelations:CATEGORIZED]->(category:Category)

View File

@ -26,7 +26,7 @@ let ownerMemberUser
let secondOwnerMemberUser
const categoryIds = ['cat9', 'cat4', 'cat15']
const descriptionAdditional100 =
const groupDescriptionAdditional100 =
' 123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789'
let variables = {}
@ -161,7 +161,7 @@ const seedComplexScenarioAndClearAuthentication = async () => {
id: 'public-group',
name: 'The Best Group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -189,7 +189,7 @@ const seedComplexScenarioAndClearAuthentication = async () => {
id: 'closed-group',
name: 'Uninteresting Group',
about: 'We will change nothing!',
description: 'We love it like it is!?' + descriptionAdditional100,
groupDescription: 'We love it like it is!?' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,
@ -203,7 +203,7 @@ const seedComplexScenarioAndClearAuthentication = async () => {
id: 'hidden-group',
name: 'Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -273,7 +273,7 @@ describe('in mode', () => {
name: 'The Best Group',
slug: 'the-group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -302,8 +302,8 @@ describe('in mode', () => {
name: 'The Best Group',
slug: 'the-group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
descriptionExcerpt: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupDescriptionExcerpt: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
locationName: 'Hamburg, Germany',
@ -348,7 +348,7 @@ describe('in mode', () => {
mutation: createGroupMutation(),
variables: {
...variables,
description:
groupDescription:
'0123456789' +
'<a href="https://domain.org/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">0123456789</a>',
},
@ -476,7 +476,7 @@ describe('in mode', () => {
id: 'others-group',
name: 'Uninteresting Group',
about: 'We will change nothing!',
description: 'We love it like it is!?' + descriptionAdditional100,
groupDescription: 'We love it like it is!?' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'global',
categoryIds,
@ -489,7 +489,7 @@ describe('in mode', () => {
id: 'hidden-group',
name: 'Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -501,7 +501,7 @@ describe('in mode', () => {
id: 'second-hidden-group',
name: 'Second Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -521,7 +521,7 @@ describe('in mode', () => {
id: 'third-hidden-group',
name: 'Third Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -542,7 +542,7 @@ describe('in mode', () => {
id: 'my-group',
name: 'The Best Group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -562,7 +562,7 @@ describe('in mode', () => {
expect.objectContaining({
id: 'my-group',
slug: 'the-best-group',
descriptionExcerpt: 'Some description' + descriptionAdditional100,
groupDescriptionExcerpt: 'Some description' + groupDescriptionAdditional100,
locationName: 'Hamburg, Germany',
location: expect.objectContaining({
name: 'Hamburg',
@ -574,7 +574,8 @@ describe('in mode', () => {
expect.objectContaining({
id: 'others-group',
slug: 'uninteresting-group',
descriptionExcerpt: 'We love it like it is!?' + descriptionAdditional100,
groupDescriptionExcerpt:
'We love it like it is!?' + groupDescriptionAdditional100,
locationName: null,
location: null,
myRole: null,
@ -582,7 +583,7 @@ describe('in mode', () => {
expect.objectContaining({
id: 'third-hidden-group',
slug: 'third-investigative-journalism-group',
descriptionExcerpt: 'We research …' + descriptionAdditional100,
groupDescriptionExcerpt: 'We research …' + groupDescriptionAdditional100,
myRole: 'usual',
locationName: null,
location: null,
@ -868,7 +869,7 @@ describe('in mode', () => {
id: 'closed-group',
name: 'Uninteresting Group',
about: 'We will change nothing!',
description: 'We love it like it is!?' + descriptionAdditional100,
groupDescription: 'We love it like it is!?' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,
@ -881,7 +882,7 @@ describe('in mode', () => {
id: 'hidden-group',
name: 'Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -894,7 +895,7 @@ describe('in mode', () => {
id: 'public-group',
name: 'The Best Group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -1119,7 +1120,7 @@ describe('in mode', () => {
id: 'public-group',
name: 'The Best Group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -1147,7 +1148,7 @@ describe('in mode', () => {
id: 'closed-group',
name: 'Uninteresting Group',
about: 'We will change nothing!',
description: 'We love it like it is!?' + descriptionAdditional100,
groupDescription: 'We love it like it is!?' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'national',
categoryIds,
@ -1176,7 +1177,7 @@ describe('in mode', () => {
id: 'hidden-group',
name: 'Investigative Journalism Group',
about: 'We will change all.',
description: 'We research …' + descriptionAdditional100,
groupDescription: 'We research …' + groupDescriptionAdditional100,
groupType: 'hidden',
actionRadius: 'global',
categoryIds,
@ -2659,7 +2660,7 @@ describe('in mode', () => {
id: 'others-group',
name: 'Uninteresting Group',
about: 'We will change nothing!',
description: 'We love it like it is!?' + descriptionAdditional100,
groupDescription: 'We love it like it is!?' + groupDescriptionAdditional100,
groupType: 'closed',
actionRadius: 'global',
categoryIds,
@ -2672,7 +2673,7 @@ describe('in mode', () => {
id: 'my-group',
name: 'The Best Group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupDescription: 'Some description' + groupDescriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
categoryIds,
@ -2704,7 +2705,8 @@ describe('in mode', () => {
id: 'my-group',
name: 'The New Group For Our Country',
about: 'We will change the land!',
description: 'Some country relevant description' + descriptionAdditional100,
groupDescription:
'Some country relevant description' + groupDescriptionAdditional100,
actionRadius: 'national',
// avatar, // test this as result
},
@ -2716,9 +2718,10 @@ describe('in mode', () => {
name: 'The New Group For Our Country',
slug: 'the-best-group', // changing the slug is tested in the slugifyMiddleware
about: 'We will change the land!',
description: 'Some country relevant description' + descriptionAdditional100,
descriptionExcerpt:
'Some country relevant description' + descriptionAdditional100,
groupDescription:
'Some country relevant description' + groupDescriptionAdditional100,
groupDescriptionExcerpt:
'Some country relevant description' + groupDescriptionAdditional100,
actionRadius: 'national',
// avatar, // test this as result
myRole: 'owner',
@ -2870,7 +2873,7 @@ describe('in mode', () => {
mutation: updateGroupMutation(),
variables: {
id: 'my-group',
description:
groupDescription:
'0123456789' +
'<a href="https://domain.org/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">0123456789</a>',
},
@ -2951,7 +2954,8 @@ describe('in mode', () => {
id: 'my-group',
name: 'The New Group For Our Country',
about: 'We will change the land!',
description: 'Some country relevant description' + descriptionAdditional100,
groupDescription:
'Some country relevant description' + groupDescriptionAdditional100,
actionRadius: 'national',
categoryIds: ['cat4', 'cat27'],
},
@ -2969,7 +2973,8 @@ describe('in mode', () => {
id: 'my-group',
name: 'The New Group For Our Country',
about: 'We will change the land!',
description: 'Some country relevant description' + descriptionAdditional100,
groupDescription:
'Some country relevant description' + groupDescriptionAdditional100,
actionRadius: 'national',
categoryIds: ['cat4', 'cat27'],
},

View File

@ -106,7 +106,7 @@ describe('Posts in Groups', () => {
id: 'public-group',
name: 'The Public Group',
about: 'The public group!',
description: 'Anyone can see the posts of this group.',
groupDescription: 'Anyone can see the posts of this group.',
groupType: 'public',
actionRadius: 'regional',
},
@ -134,7 +134,7 @@ describe('Posts in Groups', () => {
id: 'closed-group',
name: 'The Closed Group',
about: 'The closed group!',
description: 'Only members of this group can see the posts of this group.',
groupDescription: 'Only members of this group can see the posts of this group.',
groupType: 'closed',
actionRadius: 'regional',
},
@ -162,7 +162,7 @@ describe('Posts in Groups', () => {
id: 'hidden-group',
name: 'The Hidden Group',
about: 'The hidden group!',
description: 'Only members of this group can see the posts of this group.',
groupDescription: 'Only members of this group can see the posts of this group.',
groupType: 'hidden',
actionRadius: 'regional',
},

View File

@ -28,8 +28,8 @@ type Group {
avatar: Image @relation(name: "AVATAR_IMAGE", direction: "OUT")
about: String # goal
description: String!
descriptionExcerpt: String!
groupDescription: String!
groupDescriptionExcerpt: String!
groupType: GroupType!
actionRadius: GroupActionRadius!
@ -50,7 +50,7 @@ input _GroupFilter {
name_contains: String
slug_contains: String
about_contains: String
description_contains: String
groupDescription_contains: String
groupType_in: [GroupType!]
actionRadius_in: [GroupActionRadius!]
myRole_in: [GroupMemberRole!]
@ -94,7 +94,7 @@ type Mutation {
name: String!
slug: String
about: String
description: String!
groupDescription: String!
groupType: GroupType!
actionRadius: GroupActionRadius!
categoryIds: [ID]
@ -107,7 +107,7 @@ type Mutation {
name: String
slug: String
about: String
description: String
groupDescription: String
# groupType: GroupType # is not possible at the moment and has to be discussed. may be in the stronger direction: public → closed → hidden
actionRadius: GroupActionRadius
categoryIds: [ID]

View File

@ -73,21 +73,21 @@
<ds-space margin-top="small" />
<!-- description -->
<!-- groupDescription -->
<ds-text class="select-label">
{{ $t('group.description') }}
{{ $t('group.groupDescription') }}
</ds-text>
<editor
name="description"
model="description"
name="groupDescription"
model="groupDescription"
:users="null"
:value="formData.description"
:value="formData.groupDescription"
:hashtags="null"
@input="updateEditorDescription"
/>
<ds-chip size="base" :color="errors && errors.description ? 'danger' : 'medium'">
{{ `${descriptionLength} / ${formSchema.description.min}` }}
<base-icon v-if="errors && errors.description" name="warning" />
<ds-chip size="base" :color="errors && errors.groupDescription ? 'danger' : 'medium'">
{{ `${groupDescriptionLength} / ${formSchema.groupDescription.min}` }}
<base-icon v-if="errors && errors.groupDescription" name="warning" />
</ds-chip>
<!-- actionRadius -->
@ -207,8 +207,16 @@ export default {
},
},
data() {
const { name, slug, groupType, about, description, actionRadius, locationName, categories } =
this.group
const {
name,
slug,
groupType,
about,
groupDescription,
actionRadius,
locationName,
categories,
} = this.group
return {
categoriesActive: this.$env.CATEGORIES_ACTIVE,
disabled: false,
@ -221,7 +229,7 @@ export default {
slug: slug || '',
groupType: groupType || '',
about: about || '',
description: description || '',
groupDescription: groupDescription || '',
// from database 'locationName' comes as "string | null"
// 'formData.locationName':
// see 'created': tries to set it to a "requestGeoData" object and fills the menu if possible
@ -237,12 +245,12 @@ export default {
slug: { required: false, min: GROUPNAME_LENGTH_MIN },
groupType: { required: true, min: 1 },
about: { required: false },
description: {
groupDescription: {
type: 'string',
required: true,
min: GROUPDESCRIPTION_WITHOUT_HTML_LENGTH_MIN,
validator: (_, value = '') => {
if (this.$filters.removeHtml(value).length < this.formSchema.description.min) {
if (this.$filters.removeHtml(value).length < this.formSchema.groupDescription.min) {
return [new Error()]
}
return []
@ -286,8 +294,8 @@ export default {
locationNameLabelAddOnOldName() {
return this.formLocationName !== '' ? ' — ' + this.formLocationName : ''
},
descriptionLength() {
return this.$filters.removeHtml(this.formData.description).length
groupDescriptionLength() {
return this.$filters.removeHtml(this.formData.groupDescription).length
},
sameLocation() {
const dbLocationName = this.group.locationName || ''
@ -310,7 +318,7 @@ export default {
this.group.name === this.formData.name &&
this.group.slug === this.formData.slug &&
this.group.about === this.formData.about &&
this.group.description === this.formData.description &&
this.group.groupDescription === this.formData.groupDescription &&
this.group.actionRadius === this.formData.actionRadius &&
this.sameLocation &&
this.sameCategories
@ -330,15 +338,16 @@ export default {
this.formData.actionRadius = event.target.value
},
updateEditorDescription(value) {
this.$refs.groupForm.update('description', value)
this.$refs.groupForm.update('groupDescription', value)
},
submit() {
const { name, slug, about, description, groupType, actionRadius, categoryIds } = this.formData
const { name, slug, about, groupDescription, groupType, actionRadius, categoryIds } =
this.formData
const variables = {
name,
slug,
about,
description,
groupDescription,
groupType,
actionRadius,
locationName: this.formLocationName,

View File

@ -27,7 +27,7 @@
</div>
<!-- TODO: replace editor content with tiptap render view -->
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="content hyphenate-text" v-html="descriptionExcerpt" />
<div class="content hyphenate-text" v-html="groupDescriptionExcerpt" />
<footer class="footer">
<div>
<!-- group my role in group -->
@ -102,8 +102,8 @@ export default {
}
},
computed: {
descriptionExcerpt() {
return this.$filters.removeLinks(this.group.descriptionExcerpt)
groupDescriptionExcerpt() {
return this.$filters.removeLinks(this.group.groupDescriptionExcerpt)
},
},
}

View File

@ -61,8 +61,8 @@ export const group = {
name: 'Yoga Practice',
slug: 'yoga-practice',
about: null,
description: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
descriptionExcerpt: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p>And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p>The important thing is:</p><ul><li><p>Use the exercises …</p></li></ul>`,
groupDescription: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
groupDescriptionExcerpt: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p>And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p>The important thing is:</p><ul><li><p>Use the exercises …</p></li></ul>`,
groupType: 'public',
actionRadius: 'interplanetary',
categories: [

View File

@ -70,8 +70,8 @@ export const groupFragment = gql`
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {

View File

@ -77,8 +77,8 @@ export const searchGroups = (i18n) => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {

View File

@ -9,7 +9,7 @@ export const createGroupMutation = () => {
$name: String!
$slug: String
$about: String
$description: String!
$groupDescription: String!
$groupType: GroupType!
$actionRadius: GroupActionRadius!
$categoryIds: [ID]
@ -20,7 +20,7 @@ export const createGroupMutation = () => {
name: $name
slug: $slug
about: $about
description: $description
groupDescription: $groupDescription
groupType: $groupType
actionRadius: $actionRadius
categoryIds: $categoryIds
@ -34,8 +34,8 @@ export const createGroupMutation = () => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {
@ -58,7 +58,7 @@ export const updateGroupMutation = () => {
$name: String
$slug: String
$about: String
$description: String
$groupDescription: String
$actionRadius: GroupActionRadius
$categoryIds: [ID]
$avatar: ImageInput
@ -69,7 +69,7 @@ export const updateGroupMutation = () => {
name: $name
slug: $slug
about: $about
description: $description
groupDescription: $groupDescription
actionRadius: $actionRadius
categoryIds: $categoryIds
avatar: $avatar
@ -83,8 +83,8 @@ export const updateGroupMutation = () => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {
@ -157,8 +157,8 @@ export const groupQuery = (i18n) => {
disabled
deleted
about
description
descriptionExcerpt
groupDescription
groupDescriptionExcerpt
groupType
actionRadius
categories {

View File

@ -63,8 +63,8 @@ describe('GroupProfileSlug', () => {
name: 'Yoga Practice',
slug: 'yoga-practice',
about: null,
description: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
descriptionExcerpt: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p>And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p>The important thing is:</p><ul><li><p>Use the exercises …</p></li></ul>`,
groupDescription: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
groupDescriptionExcerpt: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p>And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p>The important thing is:</p><ul><li><p>Use the exercises …</p></li></ul>`,
groupType: 'public',
actionRadius: 'interplanetary',
categories: [
@ -99,8 +99,8 @@ describe('GroupProfileSlug', () => {
name: 'School For Citizens',
slug: 'school-for-citizens',
about: 'Our children shall receive education for life.',
description: `<p class=""><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, the people, and satisfies it through a lot of experience.</p><p><br></p><p><em>Deutsch</em></p><h3>Unser Ziel</h3><p class="">Nur wer Spaß am Lernen hat und seine Neugier nicht verliert, kann gute Bildung für's Leben erlangen und sein ganzes Leben mit Freude weiter lernen.</p><h3>Neugier</h3><p class="">Dazu benötigen wir eine Schule, die die Neugier der Kinder, der Menschen, aufnimmt und durch viel Erfahrung befriedigt.</p>`,
descriptionExcerpt: `<p><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, …</p>`,
groupDescription: `<p class=""><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, the people, and satisfies it through a lot of experience.</p><p><br></p><p><em>Deutsch</em></p><h3>Unser Ziel</h3><p class="">Nur wer Spaß am Lernen hat und seine Neugier nicht verliert, kann gute Bildung für's Leben erlangen und sein ganzes Leben mit Freude weiter lernen.</p><h3>Neugier</h3><p class="">Dazu benötigen wir eine Schule, die die Neugier der Kinder, der Menschen, aufnimmt und durch viel Erfahrung befriedigt.</p>`,
groupDescriptionExcerpt: `<p><em>English</em></p><h3>Our goal</h3><p>Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives.</p><h3>Curiosity</h3><p>For this we need a school that takes up the curiosity of the children, …</p>`,
groupType: 'closed',
actionRadius: 'national',
categories: [
@ -132,8 +132,8 @@ describe('GroupProfileSlug', () => {
name: 'Investigative Journalism',
slug: 'investigative-journalism',
about: 'Investigative journalists share ideas and insights and can collaborate.',
description: `<p class=""><em>English:</em></p><p class="">This group is hidden.</p><h3>What is our group for?</h3><p>This group was created to allow investigative journalists to share and collaborate.</p><h3>How does it work?</h3><p>Here you can internally share posts and comments about them.</p><p><br></p><p><em>Deutsch:</em></p><p class="">Diese Gruppe ist verborgen.</p><h3>Wofür ist unsere Gruppe?</h3><p class="">Diese Gruppe wurde geschaffen, um investigativen Journalisten den Austausch und die Zusammenarbeit zu ermöglichen.</p><h3>Wie funktioniert das?</h3><p class="">Hier könnt ihr euch intern über Beiträge und Kommentare zu ihnen austauschen.</p>`,
descriptionExcerpt:
groupDescription: `<p class=""><em>English:</em></p><p class="">This group is hidden.</p><h3>What is our group for?</h3><p>This group was created to allow investigative journalists to share and collaborate.</p><h3>How does it work?</h3><p>Here you can internally share posts and comments about them.</p><p><br></p><p><em>Deutsch:</em></p><p class="">Diese Gruppe ist verborgen.</p><h3>Wofür ist unsere Gruppe?</h3><p class="">Diese Gruppe wurde geschaffen, um investigativen Journalisten den Austausch und die Zusammenarbeit zu ermöglichen.</p><h3>Wie funktioniert das?</h3><p class="">Hier könnt ihr euch intern über Beiträge und Kommentare zu ihnen austauschen.</p>`,
groupDescriptionExcerpt:
'<p><em>English:</em></p><p>This group is hidden.</p><h3>What is our group for?</h3><p>This group was created to allow investigative journalists to share and collaborate.</p><h3>How does it work?</h3><p>Here you can internally share posts and comments about them.</p><p><br/></p><p><em>Deutsch:</em></p><p>Diese Gruppe ist verborgen.</p><h3>…</h3>',
groupType: 'hidden',
actionRadius: 'global',
@ -204,7 +204,7 @@ describe('GroupProfileSlug', () => {
})
}
describe('given a puplic group "yoga-practice"', () => {
describe('given a public group "yoga-practice"', () => {
describe('given a current user', () => {
describe('as group owner "peter-lustig"', () => {
beforeEach(() => {
@ -317,8 +317,8 @@ describe('GroupProfileSlug', () => {
expect(groupDescriptionBaseCard.exists()).toBe(true)
})
describe('displays descriptionExcerpt first', () => {
it('has descriptionExcerpt', () => {
describe('displays groupDescriptionExcerpt first', () => {
it('has groupDescriptionExcerpt', () => {
expect(groupDescriptionBaseCard.text()).toContain(
`What Is yoga?Yoga is not just about practicing asanas. It's about how we do it.And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.What makes practicing asanas yogic?The important thing is:Use the exercises …`,
)

View File

@ -238,7 +238,11 @@
class="content hyphenate-text"
v-html="groupDescriptionExcerpt"
/>
<content-viewer v-else class="content hyphenate-text" :content="group.description" />
<content-viewer
v-else
class="content hyphenate-text"
:content="group.groupDescription"
/>
<base-button
class="collaps-button"
size="small"
@ -403,7 +407,7 @@ export default {
return slug
},
groupDescriptionExcerpt() {
return this.group ? this.$filters.removeLinks(this.group.descriptionExcerpt) : ''
return this.group ? this.$filters.removeLinks(this.group.groupDescriptionExcerpt) : ''
},
isGroupOwner() {
return this.group ? this.group.myRole === 'owner' : false

View File

@ -36,11 +36,12 @@ export default {
},
methods: {
async createGroup(value) {
const { name, about, description, groupType, actionRadius, locationName, categoryIds } = value
const { name, about, groupDescription, groupType, actionRadius, locationName, categoryIds } =
value
const variables = {
name,
about,
description,
groupDescription,
groupType,
actionRadius,
locationName,

View File

@ -30,7 +30,7 @@ export default {
slug,
name,
about,
description,
groupDescription,
groupType,
actionRadius,
locationName,
@ -41,7 +41,7 @@ export default {
name,
slug,
about,
description,
groupDescription,
groupType,
actionRadius,
locationName,