(search) Fix acknowledgement page for domain complaints rendering as plain text

This was caused by incorrect usage of the renderInto() function, which was always buggy and should never be used.  This method is removed with this change.
This commit is contained in:
Viktor Lofgren 2024-01-10 09:26:34 +01:00
parent bd7970fb1f
commit f592c9f04d
2 changed files with 2 additions and 17 deletions

View File

@ -49,14 +49,6 @@ public class MustacheRenderer<T> {
return template.apply(model);
}
@SneakyThrows
public Object renderInto(Response response, T model) {
response.raw().getOutputStream().write(template.apply(model).getBytes(StandardCharsets.UTF_8));
return "";
}
@SneakyThrows
public <T2> String render(T model, String name, List<T2> children) {
Context ctx = Context.newBuilder(model).combine(name, children).build();
@ -70,9 +62,4 @@ public class MustacheRenderer<T> {
return template.apply(ctx);
}
@SneakyThrows
public void renderInto(Response response, T model, Map<String, ?> children) {
Context ctx = Context.newBuilder(model).combine(children).build();
response.raw().getOutputStream().write(template.apply(ctx).getBytes(StandardCharsets.UTF_8));
}
}

View File

@ -60,8 +60,6 @@ public class SearchSiteInfoService {
String domainName = request.params("site");
String view = request.queryParamOrDefault("view", "info");
response.type("text/html");
if (null == domainName || domainName.isBlank()) {
return null;
}
@ -76,7 +74,7 @@ public class SearchSiteInfoService {
default -> listInfo(ctx, domainName);
};
return renderer.renderInto(response, model);
return renderer.render(model);
}
public Object handlePost(Request request, Response response) throws SQLException {
@ -104,7 +102,7 @@ public class SearchSiteInfoService {
var model = new ReportDomain(domainName, domainId, complaints, List.of(), true);
return renderer.renderInto(response, model);
return renderer.render(model);
}
private Object reportSite(Context ctx, String domainName) throws SQLException {