Thread: Two small patches for the News section of the website

Two small patches for the News section of the website

From
Andreas 'ads' Scherbaum
Date:
Hello,

the attached patches propose the following changes:


account_views.patch:

This modifies the https://www.postgresql.org/account/ website, and shows 
"Items not submitted yet" and "Items waiting for moderator approval" 
only when there is actual content. Empty boxes are not shown.


objectlist.patch:

This updates https://www.postgresql.org/account/edit/news/ , fixes a 
missing </p>, and separates the "Submit for moderation" link from the 
item link to make it clear that these are two different things.
It also updates the description above the items, and adds a note that 
items must be submitted, if there are items.


Both patches are untested, as I couldn't get the pgweb working locally.


Regards,

-- 
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project


Attachment

Re: Two small patches for the News section of the website

From
Andreas 'ads' Scherbaum
Date:
On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
>
> Hello,
>
> the attached patches propose the following changes:
>
>
> account_views.patch:
>
> This modifies the https://www.postgresql.org/account/ website, and 
> shows "Items not submitted yet" and "Items waiting for moderator 
> approval" only when there is actual content. Empty boxes are not shown.
>
>
> objectlist.patch:
>
> This updates https://www.postgresql.org/account/edit/news/ , fixes a 
> missing </p>, and separates the "Submit for moderation" link from the 
> item link to make it clear that these are two different things.
> It also updates the description above the items, and adds a note that 
> items must be submitted, if there are items.
>
>
> Both patches are untested, as I couldn't get the pgweb working locally.

Magnus pointed out that there is a syntax problem with one of the patches.
New version attached.


Regards,

-- 
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project


Attachment

Re: Two small patches for the News section of the website

From
"Jonathan S. Katz"
Date:
Hi ads,

On 12/30/20 3:59 PM, Andreas 'ads' Scherbaum wrote:
> On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:

>> objectlist.patch:
>>
>> This updates https://www.postgresql.org/account/edit/news/ , fixes a
>> missing </p>, and separates the "Submit for moderation" link from the
>> item link to make it clear that these are two different things.
>> It also updates the description above the items, and adds a note that
>> items must be submitted, if there are items.

Thanks for making these patches.

I did go ahead and tested objectlist. I had to both modify some of the
HTML as the <p> block was not correct, and went ahead and wordsmithed it
a bit. Please see the attached.

I will go ahead and push this up shortly.

Thanks for the contribution,

Jonathan

Attachment

Re: Two small patches for the News section of the website

From
Magnus Hagander
Date:
On Wed, Dec 30, 2020 at 9:59 PM Andreas 'ads' Scherbaum <ads@pgug.de> wrote:
>
> On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
> >
> > Hello,
> >
> > the attached patches propose the following changes:
> >
> >
> > account_views.patch:
> >
> > This modifies the https://www.postgresql.org/account/ website, and
> > shows "Items not submitted yet" and "Items waiting for moderator
> > approval" only when there is actual content. Empty boxes are not shown.
> >
> >
> > objectlist.patch:
> >
> > This updates https://www.postgresql.org/account/edit/news/ , fixes a
> > missing </p>, and separates the "Submit for moderation" link from the
> > item link to make it clear that these are two different things.
> > It also updates the description above the items, and adds a note that
> > items must be submitted, if there are items.
> >
> >
> > Both patches are untested, as I couldn't get the pgweb working locally.
>
> Magnus pointed out that there is a syntax problem with one of the patches.
> New version attached.

I've applied an adapted version of the first one of these:
* Fixed indentation. Please run the "pep8" command on the python code
as part of your tests-before-submission. We need to document this
somewhere, or direct people towards maknig PRs (currently turned off)
which will validate it for them :)
* Fixed incorrect removal of the dict passed to render -- you can't
pass an array there, it still has to be the dict with a key.
* The canonical way to check if an array is empty is not "if
len(array)>0" in python, it's just "if array:". No need to compute the
whole length just to know if it's empty.
* I renamed the arrays to have plural names. It's really confusing to
have singular names for something that contains multiple objects.

And after second found:
* The whole code becomes easier if we just leave the list of waiting
and created in arrays, rather than break them out into separate
variables and later put them back  into another array

Ḯ've attached a v3 of the patch with "-w" just to show how little
change was actually needed after doing that :) (it could be done fully
inline as well, but keeping it as a separate variable is probably a
bit more future proof)

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/



Re: Two small patches for the News section of the website

From
Magnus Hagander
Date:
On Mon, Jan 4, 2021 at 2:46 PM Magnus Hagander <magnus@hagander.net> wrote:
>
> On Wed, Dec 30, 2020 at 9:59 PM Andreas 'ads' Scherbaum <ads@pgug.de> wrote:
> >
> > On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
> > >
> > > Hello,
> > >
> > > the attached patches propose the following changes:
> > >
> > >
> > > account_views.patch:
> > >
> > > This modifies the https://www.postgresql.org/account/ website, and
> > > shows "Items not submitted yet" and "Items waiting for moderator
> > > approval" only when there is actual content. Empty boxes are not shown.
> > >
> > >
> > > objectlist.patch:
> > >
> > > This updates https://www.postgresql.org/account/edit/news/ , fixes a
> > > missing </p>, and separates the "Submit for moderation" link from the
> > > item link to make it clear that these are two different things.
> > > It also updates the description above the items, and adds a note that
> > > items must be submitted, if there are items.
> > >
> > >
> > > Both patches are untested, as I couldn't get the pgweb working locally.
> >
> > Magnus pointed out that there is a syntax problem with one of the patches.
> > New version attached.
>
> I've applied an adapted version of the first one of these:
> * Fixed indentation. Please run the "pep8" command on the python code
> as part of your tests-before-submission. We need to document this
> somewhere, or direct people towards maknig PRs (currently turned off)
> which will validate it for them :)
> * Fixed incorrect removal of the dict passed to render -- you can't
> pass an array there, it still has to be the dict with a key.
> * The canonical way to check if an array is empty is not "if
> len(array)>0" in python, it's just "if array:". No need to compute the
> whole length just to know if it's empty.
> * I renamed the arrays to have plural names. It's really confusing to
> have singular names for something that contains multiple objects.
>
> And after second found:
> * The whole code becomes easier if we just leave the list of waiting
> and created in arrays, rather than break them out into separate
> variables and later put them back  into another array
>
> Ḯ've attached a v3 of the patch with "-w" just to show how little
> change was actually needed after doing that :) (it could be done fully
> inline as well, but keeping it as a separate variable is probably a
> bit more future proof)

And again, with actual attachment.

Thanks!

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/

Attachment

Re: Two small patches for the News section of the website

From
Andreas 'ads' Scherbaum
Date:
On 04/01/2021 14:46, Magnus Hagander wrote:
> On Wed, Dec 30, 2020 at 9:59 PM Andreas 'ads' Scherbaum <ads@pgug.de> wrote:
>> On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
>>> Hello,
>>>
>>> the attached patches propose the following changes:
>>>
>>>
>>> account_views.patch:
>>>
>>> This modifies the https://www.postgresql.org/account/ website, and
>>> shows "Items not submitted yet" and "Items waiting for moderator
>>> approval" only when there is actual content. Empty boxes are not shown.
>>>
>>>
>>> objectlist.patch:
>>>
>>> This updates https://www.postgresql.org/account/edit/news/ , fixes a
>>> missing </p>, and separates the "Submit for moderation" link from the
>>> item link to make it clear that these are two different things.
>>> It also updates the description above the items, and adds a note that
>>> items must be submitted, if there are items.
>>>
>>>
>>> Both patches are untested, as I couldn't get the pgweb working locally.
>> Magnus pointed out that there is a syntax problem with one of the patches.
>> New version attached.
> I've applied an adapted version of the first one of these:
> * Fixed indentation. Please run the "pep8" command on the python code
> as part of your tests-before-submission. We need to document this
> somewhere, or direct people towards maknig PRs (currently turned off)
> which will validate it for them :)
> * Fixed incorrect removal of the dict passed to render -- you can't
> pass an array there, it still has to be the dict with a key.
> * The canonical way to check if an array is empty is not "if
> len(array)>0" in python, it's just "if array:". No need to compute the
> whole length just to know if it's empty.
> * I renamed the arrays to have plural names. It's really confusing to
> have singular names for something that contains multiple objects.
>
> And after second found:
> * The whole code becomes easier if we just leave the list of waiting
> and created in arrays, rather than break them out into separate
> variables and later put them back  into another array
>
> Ḯ've attached a v3 of the patch with "-w" just to show how little
> change was actually needed after doing that :) (it could be done fully
> inline as well, but keeping it as a separate variable is probably a
> bit more future proof)

Nice, didn't thought about a Lambda there!
Thanks for updating it!

--
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project





Re: Two small patches for the News section of the website

From
Andreas 'ads' Scherbaum
Date:
On 03/01/2021 15:56, Jonathan S. Katz wrote:
> Hi ads,
>
> On 12/30/20 3:59 PM, Andreas 'ads' Scherbaum wrote:
>> On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
>>> objectlist.patch:
>>>
>>> This updates https://www.postgresql.org/account/edit/news/ , fixes a
>>> missing </p>, and separates the "Submit for moderation" link from the
>>> item link to make it clear that these are two different things.
>>> It also updates the description above the items, and adds a note that
>>> items must be submitted, if there are items.
> Thanks for making these patches.
>
> I did go ahead and tested objectlist. I had to both modify some of the
> HTML as the <p> block was not correct, and went ahead and wordsmithed it
> a bit. Please see the attached.
>
> I will go ahead and push this up shortly.

Looks good, thanks for updating it!
I think the <p> was broken somewhere before, I couldn't find a closing one.


Regards,

-- 
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project