tenseleyflow/shithub / fbcae7f

Browse files

L: drop dead extractMentions parallel path

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
fbcae7f5057ecdbe632d47169d3cd91d0928e33a
Parents
a68bc39
Tree
4376ed3

2 changed files

StatusFile+-
M internal/issues/references.go 0 20
M internal/issues/references_test.go 0 13
internal/issues/references.gomodified
@@ -143,23 +143,3 @@ func insertReferencesFromBody(
143
 	return nil
143
 	return nil
144
 }
144
 }
145
 
145
 
146
-// extractMentions returns deduplicated @username tokens from body.
147
-// Used by handlers / future notifications. Bounded by username regex.
148
-var reMention = regexp.MustCompile(`(?:^|[^\w])@([A-Za-z0-9][A-Za-z0-9_-]{0,38})\b`)
149
-
150
-func extractMentions(body string) []string {
151
-	if body == "" {
152
-		return nil
153
-	}
154
-	seen := map[string]struct{}{}
155
-	out := []string{}
156
-	for _, m := range reMention.FindAllStringSubmatch(body, -1) {
157
-		name := m[1]
158
-		if _, dup := seen[name]; dup {
159
-			continue
160
-		}
161
-		seen[name] = struct{}{}
162
-		out = append(out, name)
163
-	}
164
-	return out
165
-}
internal/issues/references_test.gomodified
@@ -68,16 +68,3 @@ func TestCrossRepoRefRegex(t *testing.T) {
68
 	}
68
 	}
69
 }
69
 }
70
 
70
 
71
-func TestExtractMentions(t *testing.T) {
72
-	t.Parallel()
73
-	got := extractMentions("hi @alice and @bob, also @alice again — but not foo@example.com or a@b")
74
-	// `a@b` doesn't match (single-char user is fine but there's no
75
-	// leading word-boundary punctuation that's not a `@` itself, and
76
-	// our regex requires the `@` to be preceded by a non-word char or
77
-	// the start of input — `b a@b` would match `b` itself but `b@`
78
-	// fails the regex).
79
-	want := []string{"alice", "bob"}
80
-	if !reflect.DeepEqual(got, want) {
81
-		t.Errorf("got %v, want %v", got, want)
82
-	}
83
-}