Add shared hashtag normalization helper

This commit is contained in:
thePR0M3TH3AN committed 2026-01-18 13:35:34 -05:00
1 parent cedc2a91d0
commit 0ac64867da
10 files changed
+145 -77

No files matched your search

+6 -15
View File
@@ -16,6 +16,10 @@ import {
import { getBreakpointLg } from "../designSystem/metrics.js";
import { getProviderMetadata } from "../services/authProviders/index.js";
import { devLogger, userLogger } from "../utils/logger.js";
import {
normalizeHashtag,
formatHashtag,
} from "../utils/hashtagNormalization.js";
import { getActiveSigner } from "../nostr/client.js";
const noop = () => {};
@@ -4465,24 +4469,11 @@ export class ProfileModalController {
}
normalizeHashtagTag(value) {
if (typeof value !== "string") {
return "";
}
const trimmed = value.trim();
if (!trimmed) {
return "";
}
return trimmed.replace(/^#+/, "").toLowerCase();
return normalizeHashtag(value);
}
formatHashtagTag(value) {
const normalized = this.normalizeHashtagTag(value);
if (!normalized) {
return "";
}
return `#${normalized}`;
return formatHashtag(value);
}
sanitizeHashtagList(list) {