webrecorder / browsertrix

Browsertrix is the hosted, high-fidelity, browser-based crawling service from Webrecorder designed to make web archiving easier and more accessible for all!
https://browsertrix.com
GNU Affero General Public License v3.0
172 stars 32 forks source link

[Feature]: Improve validation of org name and slug #1892

Closed SuaYoo closed 2 months ago

SuaYoo commented 3 months ago

Applicable to org settings and org rename step following https://github.com/webrecorder/browsertrix/pull/1870.

Changes

Original context:

Once https://github.com/webrecorder/browsertrix/pull/1891 is merged, we can also check for an invalid slug, which will return the detail invalid_slug.

If we want to check that an org slug is not a duplicate of an existing one ahead of time, we also have the GET /orgs/slugs and GET /orgs/slug-lookup endpoints available already in the API.

_Originally posted by @tw4l in https://github.com/webrecorder/browsertrix/pull/1870#discussion_r1655185460_

tw4l commented 3 months ago

Ah, realized /orgs/slug-lookup is superuser only, so that might not actually work. Maybe better to check on submission after all.

tw4l commented 2 months ago

PR opened to return and handle duplicate_org_name and duplicate_org_slug - further improvements to be made in separate PRs.