#Random Field Getting added to users

19 messages · Page 1 of 1 (latest)

obtuse yoke
#

Notice the sub field? Idk where thats coming from. Its not declared anywhere in my users collection. I have tried the following

  1. Deleting my entire postgresql db
  2. Altering the users table to remove the sub field
  3. Deleting the users stuff, and recreating it

Users/index.ts

import type { CollectionConfig } from 'payload'

import { adminField } from '@/access/admin'
import { GravatarField } from '@/fields/gravatar'
import { authenticated } from '../../access/authenticated'

export const Users: CollectionConfig = {
  slug: 'users',
  access: {
    admin: authenticated,
    create: authenticated,
    delete: authenticated,
    read: authenticated,
    update: authenticated,
  },
  admin: {
    defaultColumns: ['name', 'email'],
    useAsTitle: 'name',
  },
  auth: true,
  fields: [
    {
      name: 'name',
      type: 'text',
      required: true,
    },
    {
      name: 'role',
      type: 'select',
      required: true,
      access: {
        create: adminField,
        update: adminField,
      },
      options: [
        { label: 'Admin', value: 'admin' },
        { label: 'Editor', value: 'editor' },
        { label: 'Website', value: 'website' },
      ],
      defaultValue: 'editor',
    },
    {
      name: 'allowPasswordLogin',
      type: 'checkbox',
      required: true,
      defaultValue: false,
      access: {
        create: adminField,
        update: adminField,
      },
    },
    GravatarField,
  ],
  timestamps: true,
}

GravatarField.tsx

import { Field } from 'payload'

export const GravatarField: Field = {
  name: 'gravatarEmail',
  type: 'text',

  admin: {
    position: 'sidebar',
    components: {
      Field: '../components/ui/gravatar.tsx#Select',
    },
  },
  required: false,
  localized: false,
}

I am really confused why its broken xD
Also im using the oauth2 plugin

violet crescentBOT
manic latch
#

Hey @obtuse yoke

That is super weird - is this the website template?

#

If you remove the GravatarField does it still show that field?

#

Also can you link me to the plugin you use?

obtuse yoke
#

Actually no, for the first time chatgpt actually worked lmao, it mentioned the plugin uses the sub field to save the id

#

god this is a bummer xD

manic latch
#

Ah... well I guess it's not a hge deal since this is for the first creted user

#

But in any case, you may want to make an issue on that repo

#

I think that field should be hidden

manic latch
#

Yeah, that view you have there is exclusively for the first create user flow

#

It might still show up when you go to create other users, but idk if that's a deal breaker for you

#

Either way, if it's not a field being used actively by the user, I think opening an issue on that repo would be nice so the author can amend

obtuse yoke
#

i mean imma have to live with it xD, atleast it sets perms correctly.. but yea imma open an issue

manic latch
#

Awesome, glad you got it figured out at least!

obtuse yoke
#

yups, thanks :D

manic latch
#

My pleasure