Ghost/ghost/admin/app/helpers/gravatar.js
Kevin Ansfield c44766e8d3 Collapsed @service injection definitions to single-line style
no issue

- find+replace to make service injection style consistent and take up much less space at the top of files that used multi-line syntax
2022-02-03 19:04:43 +00:00

23 lines
589 B
JavaScript

import Helper from '@ember/component/helper';
import classic from 'ember-classic-decorator';
import md5 from 'blueimp-md5';
import {isEmpty} from '@ember/utils';
import {inject as service} from '@ember/service';
@classic
export default class Gravatar extends Helper {
@service config;
compute([email], {size = 180, d = 'blank'}/*, hash*/) {
if (!this.get('config.useGravatar')) {
return;
}
if (!email || isEmpty(email)) {
return;
}
return `https://www.gravatar.com/avatar/${md5(email)}?s=${size}&d=${d}`;
}
}