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

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][RM#3037] Allow user to disable Gravatar image
Date: 2018-03-05 16:21:30
Message-ID: CAKKotZR3c-hJ=AkRQ=jA4sp3CNQoY787du1G-nrmnOA2GheK3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Joao,

We are using Flask-Gravatar <https://pythonhosted.org/Flask-Gravatar/>
module for this and it is designed to work with template only.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Mar 5, 2018 at 8:57 PM, Joao De Almeida Pereira <
jdealmeidapereira(at)pivotal(dot)io> wrote:

> 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.zabuawala@
> enterprisedb.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 Murtuza Zabuawala 2018-03-05 16:23:56 Re: [pgAdmin4][RM#3175] Fix PEP-8 issues
Previous Message Joao De Almeida Pereira 2018-03-05 15:28:43 Re: [pgAdmin4][RM#3175] Fix PEP-8 issues