import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.L10nFilter;
import net.pterodactylus.sone.template.CssClassNameFilter;
import net.pterodactylus.sone.template.HttpRequestAccessor;
import net.pterodactylus.sone.template.IdentityAccessor;
+import net.pterodactylus.sone.template.ImageAccessor;
import net.pterodactylus.sone.template.ImageLinkFilter;
import net.pterodactylus.sone.template.JavascriptFilter;
import net.pterodactylus.sone.template.ParserFilter;
/** The Sone text parser. */
private final SoneTextParser soneTextParser;
+ /** The parser filter. */
+ private final ParserFilter parserFilter;
+
/** The “new Sone” notification. */
private final ListNotification<Sone> newSoneNotification;
private final ListNotification<Post> newPostNotification;
/** The “new reply” notification. */
- private final ListNotification<Reply> newReplyNotification;
+ private final ListNotification<PostReply> newReplyNotification;
/** The invisible “local post” notification. */
private final ListNotification<Post> localPostNotification;
/** The invisible “local reply” notification. */
- private final ListNotification<Reply> localReplyNotification;
+ private final ListNotification<PostReply> localReplyNotification;
/** The “you have been mentioned” notification. */
private final ListNotification<Post> mentionNotification;
templateContextFactory.addAccessor(Post.class, new PostAccessor(getCore()));
templateContextFactory.addAccessor(Reply.class, new ReplyAccessor(getCore()));
templateContextFactory.addAccessor(Album.class, new AlbumAccessor());
+ templateContextFactory.addAccessor(Image.class, new ImageAccessor());
templateContextFactory.addAccessor(Identity.class, new IdentityAccessor(getCore()));
templateContextFactory.addAccessor(Trust.class, new TrustAccessor());
templateContextFactory.addAccessor(HTTPRequest.class, new HttpRequestAccessor());
templateContextFactory.addFilter("match", new MatchFilter());
templateContextFactory.addFilter("css", new CssClassNameFilter());
templateContextFactory.addFilter("js", new JavascriptFilter());
- templateContextFactory.addFilter("parse", new ParserFilter(getCore(), templateContextFactory, soneTextParser));
+ templateContextFactory.addFilter("parse", parserFilter = new ParserFilter(getCore(), templateContextFactory, soneTextParser));
templateContextFactory.addFilter("unknown", new UnknownDateFilter(getL10n(), "View.Sone.Text.UnknownDate"));
templateContextFactory.addFilter("format", new FormatFilter());
templateContextFactory.addFilter("sort", new CollectionSortFilter());
localPostNotification = new ListNotification<Post>("local-post-notification", "posts", localPostNotificationTemplate, false);
Template newReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
- newReplyNotification = new ListNotification<Reply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
+ newReplyNotification = new ListNotification<PostReply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
Template localReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
- localReplyNotification = new ListNotification<Reply>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
+ localReplyNotification = new ListNotification<PostReply>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html"));
mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
*
* @return The new replies
*/
- public Set<Reply> getNewReplies() {
- return new SetBuilder<Reply>().addAll(newReplyNotification.getElements()).addAll(localReplyNotification.getElements()).get();
+ public Set<PostReply> getNewReplies() {
+ return new SetBuilder<PostReply>().addAll(newReplyNotification.getElements()).addAll(localReplyNotification.getElements()).get();
}
/**
pageToadlets.add(pageToadletFactory.createPageToadlet(new FollowSoneAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new UnfollowSoneAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new EditAlbumAjaxPage(this)));
- pageToadlets.add(pageToadletFactory.createPageToadlet(new EditImageAjaxPage(this)));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new EditImageAjaxPage(this, parserFilter)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new TrustAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new DistrustAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new UntrustAjaxPage(this)));
* {@inheritDoc}
*/
@Override
- public void newReplyFound(Reply reply) {
+ public void newReplyFound(PostReply reply) {
boolean isLocal = getCore().isLocalSone(reply.getSone());
if (isLocal) {
localReplyNotification.add(reply);
* {@inheritDoc}
*/
@Override
- public void markReplyKnown(Reply reply) {
+ public void markReplyKnown(PostReply reply) {
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
mentionNotification.remove(reply.getPost());
* {@inheritDoc}
*/
@Override
- public void replyRemoved(Reply reply) {
+ public void replyRemoved(PostReply reply) {
newReplyNotification.remove(reply);
localReplyNotification.remove(reply);
}