mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
c44766e8d3
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
23 lines
589 B
JavaScript
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}`;
|
|
}
|
|
}
|