# Unable to obtain gravatar on profile edition screen

**URL:** https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162
**Category:** Bug
**Created:** [13 בדצמבר,‏ 2016,‏ 7:48am UTC](https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162 "2016-12-13T07:48:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![samyrabih](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/samyrabih/32/121356_2.png) [@samyrabih](https://meta.discourse.org/u/samyrabih)
#### Post date: [13 בדצמבר,‏ 2016,‏ 7:48am UTC](https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162/1 "2016-12-13T07:48:44Z")

</div>

Hi  
I encountered the following problem : on a fresh Discourse installation, in /users/MYUSERNAME/preferences screen, if you want to change your personal avatar, the Gravatar retrieval is broken.

What it happens:

```
"Discourse.ajax is not defined" error, here:
    return Discourse.ajax("/user_avatar/" + this.get("username") + "/refresh_gravatar.json", { method: "POST" }).then(function (result) {
              return _this.setProperties({
                gravatar_avatar_template: result.gravatar_avatar_template,
                gravatar_avatar_upload_id: result.gravatar_upload_id
              });
            }).finally(function () {
              return _this.set("gravatarRefreshDisabled", false);
            }); 

```

To reproduce it:

- use as your profile email a Gravatar-enabled email
- click on the pen just right your default avatar (“S” in my case)
- choose the second option, “Gravatar”
- click on the “double arrow button” (to refresh the gravatar)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [13 בדצמבר,‏ 2016,‏ 7:50am UTC](https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162/2 "2016-12-13T07:50:05Z")

</div>

Can we repro this @techapj?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [13 בדצמבר,‏ 2016,‏ 7:54am UTC](https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162/3 "2016-12-13T07:54:47Z")

</div>

I can reproduce this. Fixed in

[https://github.com/discourse/discourse/commit/5a2794a0c78d3fbea1e04482eaaa1097c0259953](https://github.com/discourse/discourse/commit/5a2794a0c78d3fbea1e04482eaaa1097c0259953)

We probably didn’t catch this because of the way the code was indented.

![](https://global.discourse-cdn.com/meta/original/3X/0/8/084af5dae7d82165d58d4e71042bbf64ad308069.png)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [13 בדצמבר,‏ 2016,‏ 7:54am UTC](https://meta.discourse.org/t/unable-to-obtain-gravatar-on-profile-edition-screen/54162/4 "2016-12-13T07:54:52Z")

</div>


