fromthepage icon indicating copy to clipboard operation
fromthepage copied to clipboard

duplicate slugs (collection/document set)

Open saracarl opened this issue 10 months ago • 0 comments

For our Virginia Untold collection/ sub-collections, we have followed the model of having one FTP collection with a public doc set and a private doc set.

On Friday, I made the Virginia Untold: Freedom Suits doc set public. The collection (Virginia Untold: Freedom Suits (FOR STAFF ONLY) is still private.

When I am logged into the LVAtest account and try to click into transcribe the Freedom Suits on fromthepage.com/lva, it tells me I do not have permission. It appears that the Staff Only collection is showing on the /lva page rather than the doc set. I have checked and re-checked that the doc set is public and the collection is private, so I don't understand why this is occurring.

I had this issue once before and was only able to resolve it by changing the title of the collection, to make it more different from the doc set. However, I don't really understand why that worked and was hoping that you can advise. Can you take a look at the settings and let me know if you are able to duplicate the issue? I'd love to know why this is happening and how we can fix/ avoid this issue.

My response:

This happens because you can have -- although we shouldn't let you -- duplicate short names ("virginia-untold-freedom-suits"). Even if you change them they don't get destroyed. There's a good technical reason for that -- old links would still work -- but we should check and only keep the newest one if there are duplicates. I'll open an issue to get that fixed.

I was able to fix this by finding the duplicate collection slug and deleting it (leaving the document set slug):

=> #<FriendlyId::Slug id: 32139193, slug: "virginia-untold-freedom-suits", sluggable_id: 32000927, sluggable_type: "Collection", scope: nil, created_at: "2024-02-28 20:30:29.000000000 +0000"> 2.7.3 :006 > pp FriendlyId::Slug.where("slug LIKE '%virginia-untold-freedom-suits%'").pluck(:slug,:sluggable_type) [["virginia-untold-freedom-suits", "Collection"], ["virginia-untold-freedom-suits", "DocumentSet"], ["virginia-untold-freedom-suits-all", "Collection"], ["virginia-untold-freedom-suits-for-staff-only", "Collection"], ["virginia-untold-freedom-suits-set", "DocumentSet"]] => [["virginia-untold-freedom-suits", "Collection"], ["virginia-untold-freedom-suits", "DocumentSet"], ["virginia-untold-freedom-suits-all", "Collection"], ["virginia-untold-freedom-suits-for-staff-only", "Collection"], ["virginia-untold-freedom-suits-set", "DocumentSet"]] 2.7.3 :007 > pp FriendlyId::Slug.where("slug LIKE '%virginia-untold-freedom-suits%'").first.destroy #<FriendlyId::Slug:0x0000563f472c4d18 id: 32139193, slug: "virginia-untold-freedom-suits", sluggable_id: 32000927, sluggable_type: "Collection", scope: nil, created_at: Wed, 28 Feb 2024 20:30:29.000000000 UTC +00:00>

We should check when the slug is changed; if it's a duplicate (for this owner) we should keep the recent one but delete the old one. Check to make sure the older one has another slug referencing it.

saracarl avatar Apr 30 '24 19:04 saracarl