| 123456789101112131415161718 |
- export function removeUserPages(
- query: string,
- userPagesDisabled: boolean,
- ): string {
- if (!userPagesDisabled) {
- return query;
- }
- const cleanQuery = query.replace(/prefix:\/user/g, '').trim();
- if (!cleanQuery.includes('-prefix:/user')) {
- const queryWithUserPrefix = `${cleanQuery.trim()} -prefix:/user`;
- return queryWithUserPrefix;
- }
- return cleanQuery;
- }
|