-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(other): copy all constants in backend when branding #6853
base: master
Are you sure you want to change the base?
Conversation
…cial into copy-all-constants
…cial into copy-all-constants # Conflicts: # backend/src/constants/groups.ts # webapp/constants/groups.js # Adapt new value of 'DESCRIPTION_WITHOUT_HTML_LENGTH_MIN = 3' from master in our new files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why I was asked to review this even tho its clearly not finished.
There is folders brading-backend
and branding-webapp
referenced - i could not find them. I guess those are in the branding repositories.
@@ -0,0 +1,5 @@ | |||
// this file is duplicated in backend/src/branding/groupsBranding' and 'webapp/branding/groupsBranding' | |||
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | |||
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
export const { DESCRIPTION_WITHOUT_HTML_LENGTH_MIN, DESCRIPTION_EXCERPT_HTML_LENGTH } = { | ||
...groupsDefault, | ||
...groupsBranding, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why export specific variables? Is there a typescript advantage doing this?
export const { DESCRIPTION_WITHOUT_HTML_LENGTH_MIN, DESCRIPTION_EXCERPT_HTML_LENGTH } = { | |
...groupsDefault, | |
...groupsBranding, | |
} | |
export default { | |
...groupsDefault, | |
...groupsBranding, | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it this way because this export is imported as:
import { DESCRIPTION_WITHOUT_HTML_LENGTH_MIN } from '../../constants/groups'
So your suggestion creates an error on this import:
src/middleware/excerptMiddleware.ts:2:10 - error TS2614: Module '"../constants/groups"' has no exported member 'DESCRIPTION_EXCERPT_HTML_LENGTH'. Did you mean to use 'import DESCRIPTION_EXCERPT_HTML_LENGTH from "../constants/groups"' instead?
It's not imported as whole object where a property is selected.
The way I do it has the following good sides:
- if I go on refactoring I have not to rewrite all the imports
- it's clear which configs can be passed through and all others are filtered out
That's why I tend to leave my code as it is. Is that all right? @ulfgebhardt
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | ||
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | |
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | ||
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | |
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
// Wolle console.log('DESCRIPTION_WITHOUT_HTML_LENGTH_MIN: ', DESCRIPTION_WITHOUT_HTML_LENGTH_MIN) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Wolle console.log('DESCRIPTION_WITHOUT_HTML_LENGTH_MIN: ', DESCRIPTION_WITHOUT_HTML_LENGTH_MIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I's a work in progress comment. I'll remove it later.
@@ -0,0 +1,5 @@ | |||
// this file is duplicated in backend/src/branding/groupsBranding' and 'webapp/branding/groupsBranding' | |||
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
// Wolle console.log('NAME_LENGTH_MIN: ', NAME_LENGTH_MIN) | ||
// console.log('NAME_LENGTH_MAX: ', NAME_LENGTH_MAX) | ||
// console.log('DESCRIPTION_WITHOUT_HTML_LENGTH_MIN: ', DESCRIPTION_WITHOUT_HTML_LENGTH_MIN) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Wolle console.log('NAME_LENGTH_MIN: ', NAME_LENGTH_MIN) | |
// console.log('NAME_LENGTH_MAX: ', NAME_LENGTH_MAX) | |
// console.log('DESCRIPTION_WITHOUT_HTML_LENGTH_MIN: ', DESCRIPTION_WITHOUT_HTML_LENGTH_MIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I's a work in progress comment. I'll remove it later.
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | ||
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | |
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
export const { | ||
NAME_LENGTH_MIN, | ||
NAME_LENGTH_MAX, | ||
DESCRIPTION_WITHOUT_HTML_LENGTH_MIN, | ||
SHOW_GROUP_BUTTON_IN_HEADER, | ||
} = { ...groupsDefault, ...groupsBranding } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const { | |
NAME_LENGTH_MIN, | |
NAME_LENGTH_MAX, | |
DESCRIPTION_WITHOUT_HTML_LENGTH_MIN, | |
SHOW_GROUP_BUTTON_IN_HEADER, | |
} = { ...groupsDefault, ...groupsBranding } | |
export default { ...groupsDefault, ...groupsBranding } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -0,0 +1,8 @@ | |||
// this file is duplicated in 'backend/src/constants/groupsDefault' and 'webapp/constants/groupsDefault' | |||
// configurable values see: 'backend/src/constants/groupsDefault', 'webapp/constants/groupsDefault' | |||
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// configurable values see: 'backend/src/constants/groups', 'webapp/constants/groups' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this comments. 👍🏼
…cial into copy-all-constants
Thanks for your code suggestions! @ulfgebhardt
As I explained in our personal conversation I like to know if the concept and the exact code suites you before I refactor everything. Yes. The folders |
🍰 Pullrequest
copy all constants in backend when branding, but remove
links.ts
since not working in backend context.Issues
deployment\constants\.
are not used in Backend by Dockerfile. #6851DESCRIPTION_WITHOUT_HTML_LENGTH_MIN
to have Value3
in General #6923Todo
DESCRIPTION_WITHOUT_HTML_LENGTH_MIN = 50
→DESCRIPTION_WITHOUT_HTML_LENGTH_MIN = 3
DESCRIPTION_WITHOUT_HTML_LENGTH_MIN
to have Value3
in General #6923Wolle