mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
1df0e2b917
no issue - When an email has a valid gravatar handle it displays an image instead of initials for the member - Introduces new {{gravatar}} helper which accepts an email as parameter and size/d as named parameters. The output is a URL to gravatar image - Refactored usage of "splattribute" to explicit property. There was a need to duplicate class property usage in the component and doing that through splatttibute feature is unsafe as pointed ou here - https://github.com/TryGhost/Ghost-Admin/pull/1417#discussion_r351837584
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}`;
|
|
}
|
|
});
|