Remove check for setting name to null or undefined

- this was making things more likely to fail from the frontend, we would
need to consider doing a db manipulation for users from the old alpha
who have user.name as null.
- it only protects against someone who bypasses our UI and sends a
message directly to the backend, but if they can do that we have bigger
problems.
This commit is contained in:
mattwr18 2019-12-13 10:17:19 +01:00
parent fd1e2c91fd
commit dfd30cbaac
7 changed files with 2 additions and 9 deletions

View File

@ -129,10 +129,9 @@ 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)
return resolve(root, params, context, info)
if (typeof name !== 'string' || name.trim().length < USERNAME_MIN_LENGTH)
if (typeof name === 'string' && name.trim().length < USERNAME_MIN_LENGTH)
throw new UserInputError(`Username must be at least ${USERNAME_MIN_LENGTH} character long!`)
return resolve(root, params, context, info)
}
export default {

View File

@ -132,7 +132,6 @@ export default {
mutation: updateUserMutation(),
variables: {
id: this.currentUser.id,
name: this.currentUser.name,
allowEmbedIframes,
},
update: (store, { data: { UpdateUser } }) => {

View File

@ -90,7 +90,6 @@ export default {
mutation: updateUserMutation(),
variables: {
id: this.currentUser.id,
name: this.currentUser.name,
locale: this.$i18n.locale(),
},
update: (store, { data: { UpdateUser } }) => {

View File

@ -66,7 +66,6 @@ export default {
variables: {
avatarUpload,
id: this.user.id,
name: this.user.name,
},
})
.then(() => {

View File

@ -72,7 +72,6 @@ export default {
mutation: updateUserMutation(),
variables: {
id: this.currentUser.id,
name: this.currentUser.name,
allowEmbedIframes: !this.disabled,
},
update: (store, { data: { UpdateUser } }) => {

View File

@ -39,7 +39,6 @@ export default {
mutation: updateUserMutation(),
variables: {
id: this.currentUser.id,
name: this.currentUser.name,
showShoutsPublicly: this.shoutsAllowed,
},
update: (_, { data: { UpdateUser } }) => {

View File

@ -70,7 +70,6 @@ export default {
mutation: updateUserMutation(),
variables: {
id: this.currentUser.id,
name: this.currentUser.name,
termsAndConditionsAgreedVersion: VERSION,
},
update: (store, { data: { UpdateUser } }) => {