From cae5adc6edf2fb37ed1a5d4fef40ac700a5d0cbc Mon Sep 17 00:00:00 2001 From: Matt Hanley <3798302+matthanley@users.noreply.github.com> Date: Mon, 9 May 2022 13:29:45 +0100 Subject: [PATCH] Switched Admin client to use avatars returned by the member API (#2373) - Admin used a helper to generate Gravatar URLs for members - This change switches to using the `avatar_image` returned by the Member API - The helper predates the existence of `member.avatar_image`, and is no longer required --- ghost/admin/.lint-todo | 1 + .../admin/app/components/gh-member-avatar.hbs | 4 ++-- ghost/admin/app/helpers/gravatar.js | 22 ------------------- ghost/admin/app/models/member.js | 1 + 4 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 ghost/admin/app/helpers/gravatar.js diff --git a/ghost/admin/.lint-todo b/ghost/admin/.lint-todo index 7907314295..8bf26b94c1 100644 --- a/ghost/admin/.lint-todo +++ b/ghost/admin/.lint-todo @@ -1087,3 +1087,4 @@ add|ember-template-lint|no-action|4|11|4|11|831dd12209c22868d0614c65417281fda799 add|ember-template-lint|require-valid-alt-text|3|44|3|44|a7f0566c430150bae4153e0dfb489a218bdeb8a4|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-embed/nft.hbs add|ember-template-lint|require-valid-alt-text|8|20|8|20|9d0c591086dc9139ff38a7b385c3367a83438786|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-embed/nft.hbs add|ember-template-lint|require-input-label|10|12|10|12|8c3c0ea315ff4da828363989a45fa11256a78796|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-image/selector-tenor.hbs +remove|ember-template-lint|require-valid-alt-text|5|4|5|4|527936d4c6b3d34855a99669f0b8ae690094bc8e|1652054400000|1662422400000|1665014400000|app/components/gh-member-avatar.hbs diff --git a/ghost/admin/app/components/gh-member-avatar.hbs b/ghost/admin/app/components/gh-member-avatar.hbs index d5d847c1d2..7175998760 100644 --- a/ghost/admin/app/components/gh-member-avatar.hbs +++ b/ghost/admin/app/components/gh-member-avatar.hbs @@ -2,5 +2,5 @@
{{this.initials}}
- - \ No newline at end of file + {{or @member.name @member.email}} + diff --git a/ghost/admin/app/helpers/gravatar.js b/ghost/admin/app/helpers/gravatar.js deleted file mode 100644 index 2f7e813305..0000000000 --- a/ghost/admin/app/helpers/gravatar.js +++ /dev/null @@ -1,22 +0,0 @@ -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}`; - } -} diff --git a/ghost/admin/app/models/member.js b/ghost/admin/app/models/member.js index 203c3d454c..02bb59f6c5 100644 --- a/ghost/admin/app/models/member.js +++ b/ghost/admin/app/models/member.js @@ -19,6 +19,7 @@ export default Model.extend(ValidationEngine, { emailCount: attr('number', {defaultValue: 0}), emailOpenedCount: attr('number', {defaultValue: 0}), emailOpenRate: attr('number'), + avatarImage: attr('string'), products: attr('member-product'), newsletters: hasMany('newsletter', {embedded: 'always', async: false}),