discourse-animated-avatars/assets/javascripts/app/helpers/animated-bound-avatar.js
2026-03-26 13:25:04 +00:00

13 lines
397 B
JavaScript

import { trustHTML } from "@ember/template";
import boundAvatar from "discourse/helpers/bound-avatar";
import { prefersReducedMotion } from "discourse/lib/utilities";
export default function (user, size) {
const avatar = boundAvatar(user, size);
if (!user.animated_avatar || prefersReducedMotion()) {
return avatar;
}
return trustHTML(avatar.toString().replace(/\.png/, ".gif"));
}