mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 11:52:25 +00:00
Add shared hashtag normalization helper
This commit is contained in:
1 parent
cedc2a91d0
commit
0ac64867da
10 files changed
+145
-77
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user