Fix query string parsing
This commit is contained in:
parent
d8b382912e
commit
cc0e0d32ea
|
@ -17,7 +17,7 @@
|
||||||
<span class="text-muted">{{ videoAbuse.reporterAccount.nameWithHost }}</span>
|
<span class="text-muted">{{ videoAbuse.reporterAccount.nameWithHost }}</span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reportee:"' + videoAbuse.reporterAccount.displayName + '"' }" class="ml-auto text-muted video-details-links" i18n>
|
<a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'reporter:"' + videoAbuse.reporterAccount.displayName + '"' }" class="ml-auto text-muted video-details-links" i18n>
|
||||||
{videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
{videoAbuse.countReportsForReporter, plural, =1 {1 report} other {{{ videoAbuse.countReportsForReporter }} reports}}<span class="ml-1 glyphicon glyphicon-flag"></span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -90,4 +90,4 @@
|
||||||
<div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div>
|
<div *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" [innerHTML]="videoAbuse.embedHtml"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -68,8 +68,9 @@ export class RestService {
|
||||||
parseQueryStringFilter (q: string, prefixes: QueryStringFilterPrefixes): ParseQueryStringFilterResult {
|
parseQueryStringFilter (q: string, prefixes: QueryStringFilterPrefixes): ParseQueryStringFilterResult {
|
||||||
if (!q) return {}
|
if (!q) return {}
|
||||||
|
|
||||||
// Tokenize the strings using spaces
|
// Tokenize the strings using spaces that are not in quotes
|
||||||
const tokens = q.split(' ').filter(token => !!token)
|
const tokens = q.match(/(?:[^\s"]+|"[^"]*")+/g)
|
||||||
|
.filter(token => !!token)
|
||||||
|
|
||||||
// Build prefix array
|
// Build prefix array
|
||||||
const prefixeStrings = Object.values(prefixes)
|
const prefixeStrings = Object.values(prefixes)
|
||||||
|
@ -88,6 +89,7 @@ export class RestService {
|
||||||
|
|
||||||
const matchedTokens = tokens.filter(t => t.startsWith(prefix))
|
const matchedTokens = tokens.filter(t => t.startsWith(prefix))
|
||||||
.map(t => t.slice(prefix.length)) // Keep the value filter
|
.map(t => t.slice(prefix.length)) // Keep the value filter
|
||||||
|
.map(t => t.replace(/^"|"$/g, ''))
|
||||||
.map(t => {
|
.map(t => {
|
||||||
if (prefixObj.handler) return prefixObj.handler(t)
|
if (prefixObj.handler) return prefixObj.handler(t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue