added timestamp in avatar filenames to support avatar timeline

This commit is contained in:
Signals from outer space 2023-03-23 10:19:44 +01:00
parent 15630356e1
commit 11a4918abe

View file

@ -74,17 +74,19 @@ public class AvatarStore {
} }
private File getGroupAvatarFile(GroupId groupId) { private File getGroupAvatarFile(GroupId groupId) {
return new File(avatarsPath, "group-" + groupId.toBase64().replace("/", "_")); final var now = System.currentTimeMillis() / 1000L;
return new File(avatarsPath, "group-" + groupId.toBase64().replace("/", "_") + "-" + now);
} }
private File getContactAvatarFile(RecipientAddress address) { private File getContactAvatarFile(RecipientAddress address) {
return new File(avatarsPath, "contact-" + address.getLegacyIdentifier()); final var now = System.currentTimeMillis() / 1000L;
return new File(avatarsPath, "contact-" + address.getLegacyIdentifier() + "-" + now);
} }
private File getProfileAvatarFile(RecipientAddress address) { private File getProfileAvatarFile(RecipientAddress address) {
return new File(avatarsPath, "profile-" + address.getLegacyIdentifier()); final var now = System.currentTimeMillis() / 1000L;
return new File(avatarsPath, "profile-" + address.getLegacyIdentifier() + "-" + now);
} }
private void createAvatarsDir() throws IOException { private void createAvatarsDir() throws IOException {
IOUtils.createPrivateDirectories(avatarsPath); IOUtils.createPrivateDirectories(avatarsPath);
} }