Skip to content

Commit 8b3920c

Browse files
committed
hide poor and nsfw from non moderator searches
1 parent 6b39732 commit 8b3920c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

BlazorDiffusion.ServiceInterface/SearchService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ public object Any(SearchArtifacts query)
163163
PrimaryArtifact = artifact.ArtifactId == album.PrimaryArtifactId ? 1 : 0,
164164
artifact.Id,
165165
});
166+
167+
var user = Request.GetClaimsPrincipal();
168+
if (user == null || !(user.IsInRole(AppRoles.Admin) || user.IsInRole(AppRoles.Moderator)))
169+
{
170+
q.Where<Artifact>(x => x.Nsfw != true && x.Quality == 0);
171+
}
166172
}
167173
else
168174
{

0 commit comments

Comments
 (0)