twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Normalize companies URL before saving it

Open FelixMalfait opened this issue 1 year ago • 12 comments

Current behavior

Screenshot 2023-11-16 at 16 52 08

Expected behavior

Screenshot 2023-11-16 at 16 52 41

FelixMalfait avatar Nov 16 '23 15:11 FelixMalfait

Hey @FelixMalfait , I would like to work on this issue

ShantanuSutar avatar Nov 16 '23 18:11 ShantanuSutar

@ShantanuSutar thanks a lot!

FelixMalfait avatar Nov 17 '23 10:11 FelixMalfait

@FelixMalfait I feel this should be part of the DomainName fieldType. Generally when we leave a cell we should try:

  • validate (get back to the previous value if invalid / proceed to cast if valid)
  • cast if possible (for an integer, we should round the number / for an url we should remove trailing slash / for domainName we should remove non domain information...)

For each type we should implement validate and cast function to generalise this. @ShantanuSutar do you still plan to work on it? I can guide you if needed :)

charlesBochet avatar Dec 01 '23 18:12 charlesBochet

@charlesBochet Sorry for the late reply. I've tried setting up the project locally on WSL, but I ran into errors with GraphQL. Despite exploring solutions on Discord, Stack Overflow, and other platforms, I couldn't find a resolution. I will retry setting up the project again this weekend and start contributing until then you may carry on with solving the issue. I request @FelixMalfait to unassign me. Thank you for understanding :)

ShantanuSutar avatar Dec 04 '23 14:12 ShantanuSutar

No problem! Feel free to open a thread in #help on discord, we can help you from there if you want :)

charlesBochet avatar Dec 04 '23 15:12 charlesBochet

Hey I would like to work on this, can you assign for me ?

@charlesBochet could you guide me?

MatheusSanchez avatar Dec 07 '23 13:12 MatheusSanchez

Sure!

Vision: I have discussed with @Bonapara and he things that Domain name should be a field of type Link with a specific option. However, we are planning to migrate the URL field type which is a compositeField to a compositeArrayField (enabling to put multiples urls, domains...). As this is not ready on the backend side, we want to hold on this change

Plan: Currently, the domain is a field of type TEXT. We should stick with it but display a Link field ype.

  • in FieldInput and FieldDisplay, add a case on top: if objectName === 'company' and fieldName = 'domainName' (this is a hack for now, we are doing it for other fields)
  • In useLinkField, LinkDisplay and LinkInput, also add a custom logic to detect if objectName === 'company' && fieldName = 'domainName' (you'll need to load value and not value.url and value.label as the data is of type text and not link:{ url, label }
  • You can apply the normalization scoped in this ticket by adding the logic to trim the domain in persistLinkField

Let me know if you need more instructions! It should work! Once we implement the new field type, we will replace these hacky conditions by proper Link with proper isDomainName option

charlesBochet avatar Dec 07 '23 16:12 charlesBochet

Is this issue still being unfixed? I would like to work on

SujithThirumalaisamy avatar Dec 30 '23 16:12 SujithThirumalaisamy

@SujithThirumalaisamy assigning you since it's been a long time for Mattheus. Thanks a lot!

FelixMalfait avatar Jan 01 '24 21:01 FelixMalfait

Hey @SujithThirumalaisamy any news on this? Thanks 🙏

FelixMalfait avatar Jan 17 '24 11:01 FelixMalfait

I was using WSL. I faced some difficulties. Just got my linux machine a week ago. Was out of track. Got back. Will revert you about this in a day or two. Sorry for the late reply. Thankyou!

SujithThirumalaisamy avatar Jan 17 '24 14:01 SujithThirumalaisamy

No problem! Thanks @SujithThirumalaisamy

FelixMalfait avatar Jan 17 '24 15:01 FelixMalfait