a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[parsing] Add support for has:media search query

+8 -6
+2 -2
Iceshrimp.Backend/Core/Extensions/QueryableFtsExtensions.cs
··· 182 182 183 183 private static IQueryable<Note> ApplyRegularAttachmentFilter(this IQueryable<Note> query, AttachmentFilter filter) 184 184 { 185 - if (filter.Value.IsAny) 185 + if (filter.Value.IsMedia) 186 186 return query.Where(p => p.AttachedFileTypes.Count != 0); 187 187 if (filter.Value.IsPoll) 188 188 return query.Where(p => p.HasPoll); ··· 209 209 210 210 private static IQueryable<Note> ApplyNegatedAttachmentFilter(this IQueryable<Note> query, AttachmentFilter filter) 211 211 { 212 - if (filter.Value.IsAny) 212 + if (filter.Value.IsMedia) 213 213 return query.Where(p => p.AttachedFileTypes.Count == 0); 214 214 if (filter.Value.IsPoll) 215 215 return query.Where(p => !p.HasPoll);
+4 -3
Iceshrimp.Parsing/SearchQuery.fs
··· 84 84 85 85 86 86 type AttachmentFilterType = 87 - | Any 87 + | Media 88 88 | Image 89 89 | Video 90 90 | Audio ··· 97 97 98 98 member val Value = 99 99 match value with 100 - | "any" -> Any 100 + | "any" -> Media 101 + | "media" -> Media 101 102 | "image" -> Image 102 103 | "video" -> Video 103 104 | "audio" -> Audio ··· 215 216 <| fun n v -> InFilter(n.IsSome, v) :> Filter 216 217 217 218 let attachmentFilter = 218 - negKeyFilter [ "has"; "attachment"; "attached" ] [ "any"; "image"; "video"; "audio"; "file"; "poll" ] 219 + negKeyFilter [ "has"; "attachment"; "attached" ] [ "any"; "media"; "image"; "video"; "audio"; "file"; "poll" ] 219 220 <| fun n v -> AttachmentFilter(n.IsSome, v) :> Filter 220 221 221 222 let afterFilter =
+2 -1
Iceshrimp.Tests/Parsing/SearchQueryTests.cs
··· 98 98 { 99 99 List<string> keyCandidates = ["has", "attachment", "attached"]; 100 100 if (negated) keyCandidates = keyCandidates.Select(p => "-" + p).ToList(); 101 - List<string> candidates = ["any", "image", "video", "audio", "file", "poll"]; 101 + List<string> candidates = ["any", "media", "image", "video", "audio", "file", "poll"]; 102 102 var results = 103 103 keyCandidates.Select(k => candidates.Select(v => $"{k}:{v}").SelectMany(SearchQuery.parse).ToList()); 104 104 List<Filter> expectedResults = 105 105 [ 106 106 new AttachmentFilter(negated, "any"), 107 + new AttachmentFilter(negated, "media"), 107 108 new AttachmentFilter(negated, "image"), 108 109 new AttachmentFilter(negated, "video"), 109 110 new AttachmentFilter(negated, "audio"),