mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
21 lines
521 B
JavaScript
21 lines
521 B
JavaScript
|
import Helper from '@ember/component/helper';
|
||
|
import md5 from 'blueimp-md5';
|
||
|
import {isEmpty} from '@ember/utils';
|
||
|
import {inject as service} from '@ember/service';
|
||
|
|
||
|
export default Helper.extend({
|
||
|
config: service(),
|
||
|
|
||
|
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}`;
|
||
|
}
|
||
|
});
|