Re: [pgAdmin4][RM#3037] Allow user to disable Gravatar image

From: Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
To: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][RM#3037] Allow user to disable Gravatar image
Date: 2018-03-05 15:27:28
Message-ID: CAE+jja=CRKv6vSKPie4Nzrffnzs_YOYpp=GQFmfsPi1MHtzp6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Murtuza,

Why are we doing this using templates? Can this be done with a request to
the backend to get the image and then retrieve the Gravatar if it is
defined or return a static image if not?

+
+{% if config.SERVER_MODE %}
window.onload = function(e){
setTimeout(function() {
- var gravatarImg = '<img src="{{ username | gravatar }}" width="18"
height="18" alt="Gravatar image for {{ username }}"> {{ username }} <span
class="caret"></span>';
+ var gravatarImg = {{ IMG.PREPARE_HTML()|safe }}
//$('#navbar-menu .navbar-right > li > a').html(gravatarImg);
var navbarRight =
document.getElementById("navbar-menu").getElementsByClassName("navbar-right")[0];
if (navbarRight) {

what if we have

var gravatarImg = '<img src="/user/{{username}}/gravatar" width="18"
height="18" alt="Gravatar image for {{ username }}"> {{ username }} <span
class="caret"></span>';

And then the endpoint
/user/{{username}}/gravatar
would be responsible for returning a Gravatar or not depending on the
configuration?

Thanks
Joao

On Mon, Mar 5, 2018 at 3:13 AM Murtuza Zabuawala <
murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:

> Hi,
>
> PFA patch to disable Gravatar image in Server mode.
>
> Requirments & Issues:
> - For security reasons.
> - For systems which do not have internet access.
> - Hangs pgAdmin4 while loading the page if connection has no internet
> access (as described in the ticket)
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Joao De Almeida Pereira 2018-03-05 15:28:43 Re: [pgAdmin4][RM#3175] Fix PEP-8 issues
Previous Message Joao De Almeida Pereira 2018-03-05 15:12:01 Re: pgAdmin 4 commit: Ensure we pick up the messages from the current query