Unable to obtain gravatar on profile edition screen

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)
3 Likes

Can we repro this @techapj?

2 Likes

I can reproduce this. Fixed in

https://github.com/discourse/discourse/commit/5a2794a0c78d3fbea1e04482eaaa1097c0259953

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

7 Likes