X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FProfileAccessor.java;h=9b0a7fc66f15371e481401d84e97bbea0c11272c;hb=11a7eb67daf4f2ca120c476123bb676b9b304e73;hp=f0720412d708f3633b48948d2027f27c38e60b7c;hpb=58497297d2b9a18cd2877a226870acfe9e8837af;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java index f072041..9b0a7fc 100644 --- a/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/ProfileAccessor.java @@ -49,9 +49,6 @@ public class ProfileAccessor extends ReflectionAccessor { this.core = core; } - /** - * {@inheritDoc} - */ @Override public Object get(TemplateContext templateContext, Object object, String member) { Profile profile = (Profile) object; @@ -69,6 +66,9 @@ public class ProfileAccessor extends ReflectionAccessor { /* avatar ID but no matching image? show nothing. */ return null; } + if (!avatarImageBelongsToTheSameSoneAsTheProfile(profile, avatarId)) { + return null; + } Sone remoteSone = profile.getSone(); if (remoteSone.isLocal()) { /* always show your own avatars. */ @@ -99,4 +99,8 @@ public class ProfileAccessor extends ReflectionAccessor { return super.get(templateContext, object, member); } + private boolean avatarImageBelongsToTheSameSoneAsTheProfile(Profile profile, String avatarId) { + return core.getImage(avatarId).get().getSone().equals(profile.getSone()); + } + }