Commit Graph

1797 Commits

Author SHA1 Message Date
e4453cdda9 Add support for sending out news as HTML email
When a news article is approved, it gets delivered as an email to the
pgsql-announce mailinglist. It will render the markdown of the news
article into a HTML part of the email, and include the markdown raw as
the text part (for those unable or unwilling to read html mail).

For each organisation, a mail template can be specified. Initially only
two templates are supported, one "default" and one "pgproject" which is
for official project news. The intention is *not* to provide generic
templates, but we may want to extend this to certain related projects in
the future *maybe* (such as regional NPOs).

These templates are stored in templates/news/mail/*.html, and for each
template *all* images found in templates/news/mail/img.<template>/ will
be attached to the email. "Conditional image inclusion" currently not
supported.

To do CSS inlining on top of the markdown output, module pynliner is now
required (available in the python3-pynliner package on Debian).

A testing script is added as news_send_email.py in order to easier test
out templates. This is *not* intended for production sending, so it will
for example send unmoderated news. By sending, it adds it to the
outgoing mailqueue in the system, so unless the cronjob is set up to
send, nothing will happen until that is run manually.

Support is included for tagged delivery using pglister, by directly
mapping NewsTags to pglister tags.

While at it, update the moderation preview forms to preview news items
using the HTML template for the email (while leaving other types of
items previewing without a particular stylesheet).
2020-09-10 14:52:41 +02:00
f2fc72f93a Teach send_simple_mail about sending HTML email
If a HTML body is specified, the plaintext and html bodies will be sent
as a multipart/alternative MIME object.

Also teach it to add attachments with Content-ID and overriding the
Content-Disposition, to make it possible to reference images attached
using cid: type URLs.
2020-09-10 14:52:41 +02:00
90eec2b3af Store project root directory in settings
This makes it possible to reference for example templates in relation to
the root directory.
2020-09-10 14:52:41 +02:00
e1b397ac4b Add templatefilter joinandor
This filter takes a list of a,b,c,d and turns it into "a, b, c and d"
or "a, b, c or d" depending on parameter given.
2020-09-10 14:52:41 +02:00
f885aa205d Simplify admin preview of emails
Use the python3 function to get the plaintext body of the email, instead
of our own very limited one we had before.
2020-09-10 14:52:41 +02:00
9462c79318 Remove references to website migration
This migration happened 10 years ago, so if someone hasn't updated their
records by now, they're not going to.

We still allow and special-case the migrated data in the database in
order not to delete history, but this removes the direct texts about it
which take up unnecessary space and confuse some people.
2020-09-10 14:52:41 +02:00
5ffe6c389c Re-work moderation of submitted items
This includes a number of new features:

* Move some moderation functionality into shared places, so we don't
  keep re-inventing the wheel.
* Implement three-state moderation, where the submitter can edit their
  item and then explicitly say "i'm done, please moderate this now".
  This is currently only implemented for News, but done in a reusable
  way.
* Move moderation workflow to it's own set of URLs instead of
  overloading it on the general admin interface. Admin interface remains
  for editing things, but these are now separated out into separate
  things.
* Do proper stylesheet clearing for moderation of markdown fields, using
  a dynamic sandboxed iframe, so it's not ruined by the /admin/ css.
* Move moderation email notification into dedicated moderation code,
  thereby simplifying the admin subclassing we did which was in some
  places quite fragile.
* Reset date of news postings to the date of their approval, when
  approved. This avoids some annoying ordering issues.
2020-09-10 14:52:41 +02:00
b3e9a962e4 Ensure markdown fields cannot contain HTML or images
Since images can be used to drop things like tracking pixels, simply
disallow them in all submissions.
2020-09-10 14:52:41 +02:00
07ae4d3e51 Prefetch managers when viewing the organistion list
This removes a few thousand SQL queries and speeds up the page "a bit"
2020-09-07 17:20:56 +02:00
a0c2aa7951 Remove dead links
Two of our international community sites have failed to resolve or reply
for a while now, so remove the links. Should they reappear we can always
add them back.
2020-09-01 11:27:32 +02:00
b2ffced2b0 Update more links to be https instead of http 2020-08-31 11:56:47 +02:00
6a1550015d Update translated docs links to be https
The French docs had one link in http and one in https as noted by
Lætitia. In passing I also adjusted the japanese to link to the https
version directly as one is available. The remaining one (Chinese) does
not appear to have a responding https server, so that one is left as
http.
2020-08-31 10:40:41 +02:00
021b8d8bb6 Ensure "help_text" segments line up on feature matrix model
There was a subtle difference between the migration and the
model itself, which was leading to a migration warning, even
though nothing about the help_text is persistent in an actual
database.
2020-08-30 18:00:07 -04:00
fbad26136a Create proper URL check for feature matrix entries
40d6891c had created a false illusion of working, which can
certainly be blamed on the patch author. That said, instead
of trying to work around what the standard Django filters
provide, it is more prudent to create a "URL checking"
function for the feature matrix descriptions. This can be
used both for the "featurelink" generation, as well as the
new check we make to get the stated goal of 40d6891c, i.e.
provide a clickable URL when that is the only content of a
feature description.
2020-08-30 16:47:12 -04:00
40d6891cbd Create clickable links on feature details pages
There are many feature matrix details pages that would have
just a plain URL that was not clickable, either due to someone
accessing a feature matrix details page directly, or due to an
old details pages with a description being converted to just a
link.

This ensures that such pages can have a clickable link to attempt
to create a better user experience. Doing so from the Django
template filters is a bit roundabout, but it does get the desired
effect.
2020-08-30 16:36:52 -04:00
0a101dc3a4 Add Markdown support to feature matrix descriptions
This will make it possible to allow for links in longer
descriptions for particular features. This also adds some
help text describing how the feature matrix details field
works, as I remember I was originally caught by surprise that
one could provide a direct link to something.
2020-08-30 15:46:50 -04:00
112cd743c2 Add v13 to feature matrix
This is part of the annual tradition of updating the
feature matrix.
2020-08-30 15:14:43 -04:00
396db0ad68 Ensure news and events archive doesn't generate thousands of queries
While there is Varnish to take the edge off it, this is just too
ineffective to leave around :)
2020-08-30 17:34:20 +02:00
7b37b0dfec Strip html tags in event archive
We were already doing this for news, but for some reason neglected to do
so for events, which made for some pretty messed up formatting in the
archives now and then. We should treat news and events the same...
2020-08-30 17:29:30 +02:00
2e1321a1dc Update requirements.txt to match current production env 2020-08-25 13:23:56 +02:00
6ec5e2e09e Fix cvss links in admin interface 2020-08-25 13:23:56 +02:00
0f412029e3 Update URL for "PostgreSQL for Beginners" book
The source page for this had changed with the publication of
another book in this list.

Author: Pavel Luzanov <p.luzanov@postgrespro.ru>
2020-08-24 09:05:10 -04:00
3fedfc190a Add "PostgreSQL: The First Experience" book
Author: Pavel Luzanov <p.luzanov@postgrespro.ru>
2020-08-21 13:46:24 -04:00
d623e17b02 Add a missing dependency in migration
Required to pass installation on empty system.
2020-08-20 15:00:21 +02:00
c66b77a6fa Update the CoC policy, per CoC Committee/Core
Minor updates to the specifics regarding how the committee membership is
managed and providing for a transistion period when the membership
changes.

Per direction of the CoC Committee, with Core approval.
2020-08-18 12:09:56 -04:00
8c93bdae1a Pass the -y flag to apt in the install scripts.
Per Lætitia Avrot.
2020-08-17 09:30:06 +01:00
8bd8c0f916 Pass the -y flag to yum/dnf when generating install scripts.
Per Lætitia Avrot.
2020-08-17 09:27:12 +01:00
d5be0d66e7 2020-08-13 cumulative update and PostgreSQL 13 Beta 3 2020-08-13 08:18:36 -04:00
e83c2288d9 Reference OLD instead of NEW in trigger
The trigger is used for both UPDATE and DELETE, but in DELETE there is
no value in OLD.

Given that it only references the user_id field and this field cannot
change, we can just use OLD in both the UPDATE and DELETE case.

Back-patching in existing migration since it hasn't really been deployed
anywhere yet.
2020-08-13 14:11:52 +02:00
8e7e52101c Add explicit links to git history for policies
We don't do this for all pages, but specifically for policies that
already included the "Last update", it's friendly to have a link to the
full set of changes.

We still lave the "Last updated" field as manually updated, because we
don't want to update that one if we just fix a typo or similar, it
should be reserved for when we make acstual content updates to a policy.

This creates and uses a specific template tag to automate the creation
of the links (that can of course be used elsewhere as well if needed).
2020-08-12 17:52:52 +02:00
bb1f5a36e2 Use an include to list the yearly coc reportts
For some reason this was done with copy/paste before, but an include
seems much better.
2020-08-12 17:31:12 +02:00
0355560517 Simplify transaction handling in the changetracker daemon
Previously we used a combination of optimistic concurrency control
(by DELETEing with both the id and the date included in the WHERE
clause) and REPEATABLE READ transactions. This would create
serialization conflicts when completely unnecessary. Since in this case
it doesn't matter if we happen to push the same thing twice, switch
completely to optimistic concurrency control. That gets rid of having to
deal with serialization issues.
2020-08-12 17:17:32 +02:00
1ffc1f3d6d Update nagios monitor to check for duplicated email addresses
This should not be possible if things are done through the appropriate
interfaces, and those interfaces are bug-free (right..). But really bad
things can probably happen if they don't, so put a monitor in place to
check for it.

This also adds a view in the db that shows all registered email
addresses and their accounts, regardless of if it's primary or secondary
address. This is used by the nagios check but can of course be useful to
manual checks as well.
2020-08-12 17:14:19 +02:00
76de9ca108 Tweak mediawiki to handle NULL in email fields
It really shouldn't exist, but we clearly have cases where the community
auth plugin sets the email to NULL, so we need to handle that case when
looking for what to update.
2020-08-12 12:45:33 +02:00
47e87e31b9 Use unbuffered output by default in changetracker 2020-08-11 12:00:48 +02:00
f92dbfaea6 Remove symlink to selectable
We already removed the dependency in
5d7cf9833f, but forgot this symlink.
2020-08-11 11:46:32 +02:00
accbd2bab6 Add cauth push receiver plugins for mediawiki and redmine 2020-08-11 11:33:46 +02:00
c1fb5de080 Implement synchronization for community authentication
This adds the concept of an apiurl to each site that uses community
authentication, that the main website server can make calls to and send
updates. This URL will receive POSTs from the main website when a user
account that has been used on this site gets updated, and can then
optionally update it's local entries with it (the django plugin sample
is updated to handle this fully).

Updates are only sent for users that have a history of having logged
into the specific site -- this way we avoid braodcasting user
information to sites requiring specific constent that the user hasn't
given, and also decreases the amount of updates that have to be sent.

Updates are queued by the system in a table and using listen/notify a
daemon that's running picks up what needs to be updated and posts it to
the endpoints. If this daemon is not running, obviously nothing gets
sent.

Updates are tracked using triggers in the database which push
information into this queue.
2020-08-11 11:33:46 +02:00
d969bd33d8 Make django community auth plugin only save changed fields 2020-08-11 11:33:46 +02:00
fb99733afe Teach pgweb to handle secondary email addresses
This allows each account to have more than one email address, of which
one is primary. Adding more addresses will trigger an email with a
verification link (of course). The field previously known as "email" is
now changed to be "primary email".

Change the profile form to allow freely changing between the added
addresses which one is the primary. Remove the functionality to directly
change the primary email -- instead one has to add a new address first
and then change to that one, which simplifies several things in the
handling.
2020-08-11 11:33:46 +02:00
b97aa1d581 Make user_import in the django auth plugin return the new user
It's useful to be able to directly get at the user record that was
returned instead of having to re-query it from the database. Since
nothing was previously returned, this is not backwards incompatible.
2020-08-10 13:15:50 +02:00
e803deca1e Fix typo 2020-08-08 17:09:59 +02:00
f5d99ed262 Add support for easily enabling the django debug toolbar
This requires the web server to also configure a static mapping for
/media/django_toolbar/ pointing into the django toolbar directories.
2020-08-08 17:09:59 +02:00
11fdccb3bd Mark the community auth login history field as not required in admin
With this field marked required and containing only static data and
nothing to edit, it was impossible to save the user editor at all.
2020-08-08 17:09:59 +02:00
696ca83ff4 Fix broken markup
<a> tags have to have a proper closing tag. Without this, the entire
text up until the next </a> became an anchor which wasn't exactly pretty...
2020-08-07 11:33:01 +02:00
62963d71de Fix incorrect indentation 2020-08-06 19:13:36 +02:00
d10199ae96 Add "Fundamentos para el trabajo con PostgreSQL" to Books 2020-08-03 12:51:11 -04:00
4f67d9964c Purge taglist.json when tags are updated
Clearly forgotten back when tags were first added.
2020-07-16 15:29:41 +02:00
01986c82a4 Implement permissions on news tags
This makes it possible to limit which organisations can use specific
tags in news, and verify those as news is submitted. Administrators can,
as always, override.

In passing also add a sortkey field to newstags to make them, well,
sortable and include urlname in the json output.
2020-07-15 18:39:55 +02:00
4f1bf70ea0 Remove unused imports 2020-07-13 14:53:07 +02:00