Subject: [PATCH links] api: getDomains return system domains if no org slug is specifically specified.

From: Peter Sanchez <[email-masked]>
Date: Sun, 1 Mar 2026 11:29:44 -0600

Also fix issue when referencing a short link short code before
verification that it was sent to the backend.

Changelog-updated: getDomains to return system domains when no
 organization slug is passed.
Changelog-updated: API version bumped to 0.10.3
Changelog-fixed: bug when shortCode is referenced before verification
 that it was passed
---
 api/graph/schema.resolvers.go | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index 120051b..aab1ba5 100644
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -33,6 +33,7 @@ import (
 	"time"
 
 	sq "github.com/Masterminds/squirrel"
+	"github.com/microcosm-cc/bluemonday"
 	"github.com/segmentio/ksuid"
 	qrcode "github.com/yeqown/go-qrcode/v2"
 	"github.com/yeqown/go-qrcode/writer/standard"
@@ -42,7 +43,6 @@ import (
 	auditlog "netlandish.com/x/gobwebs-auditlog"
 	oauth2 "netlandish.com/x/gobwebs-oauth2"
 	gaccounts "netlandish.com/x/gobwebs/accounts"
-	"github.com/microcosm-cc/bluemonday"
 	"netlandish.com/x/gobwebs/crypto"
 	"netlandish.com/x/gobwebs/database"
 	"netlandish.com/x/gobwebs/email"
@@ -2299,13 +2299,14 @@ func (r *mutationResolver) AddLinkShort(ctx context.Context, input *model.LinkSh
 			"%s", lt.Translate("Short Code may not exceed 20 characters")).
 			WithField("shortCode").
 			WithCode(valid.ErrValidationCode)
-	}
-	b := &gaccounts.BlacklistValidator{}
-	if !b.UsernameSafePlus(links.InvalidSlugs, *input.ShortCode) {
-		validator.Error("%s", lt.Translate("This shortCode can not be used. Please chose another one")).
-			WithField("shortCode").
-			WithCode(valid.ErrValidationCode)
-		return nil, nil
+
+		b := &gaccounts.BlacklistValidator{}
+		if !b.UsernameSafePlus(links.InvalidSlugs, *input.ShortCode) {
+			validator.Error("%s", lt.Translate("This shortCode can not be used. Please chose another one")).
+				WithField("shortCode").
+				WithCode(valid.ErrValidationCode)
+			return nil, nil
+		}
 	}
 
 	tags := make([]string, 0)
@@ -5126,7 +5127,7 @@ func (r *queryResolver) Version(ctx context.Context) (*model.Version, error) {
 	return &model.Version{
 		Major:           0,
 		Minor:           10,
-		Patch:           2,
+		Patch:           3,
 		DeprecationDate: nil,
 	}, nil
 }
@@ -5906,7 +5907,10 @@ func (r *queryResolver) GetDomains(ctx context.Context, orgSlug *string, service
 
 	ctx = timezone.Context(ctx, links.GetUserTZ(user))
 
-	var org *models.Organization
+	var (
+		org     *models.Organization
+		orgSent bool
+	)
 	orgs, err := user.GetOrgs(ctx, models.OrgUserPermissionRead)
 	if err != nil {
 		return nil, err
@@ -5920,6 +5924,7 @@ func (r *queryResolver) GetDomains(ctx context.Context, orgSlug *string, service
 			}
 		}
 	} else {
+		orgSent = true
 		for _, o := range orgs {
 			if o.Slug == *orgSlug {
 				org = o
@@ -5939,6 +5944,16 @@ func (r *queryResolver) GetDomains(ctx context.Context, orgSlug *string, service
 	opts := &database.FilterOptions{
 		Filter: sq.Eq{"d.org_id": org.ID},
 	}
+	if !orgSent {
+		// If no organization is specified then include system level domains as well
+		opts.Filter = sq.Or{
+			opts.Filter,
+			sq.And{
+				sq.Eq{"d.org_id": nil},
+				sq.Eq{"d.level": models.DomainLevelSystem},
+			},
+		}
+	}
 	if service != nil {
 		opts.Filter = sq.And{
 			opts.Filter,
-- 
2.52.0