Commit Graph

115 Commits

Author SHA1 Message Date
ba9138f36b 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.
2020-07-13 14:58:08 +02:00
e4872d9aee 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-07-13 14:57:17 +02:00
4f1bf70ea0 Remove unused imports 2020-07-13 14:53:07 +02:00
b405302d97 Avoid returning HttpServerError for things not server errors
With the new django, alerts are raised for everything with status 500,
not juse exceptions. This put a light on a number of places where we
were returning 500 server error code for things that are not actually
server errors. Some should be a regular 200 ok with an error message,
and others should be a permissions error.
2020-04-04 14:43:27 +02:00
454ea7a7be Fix spacing problem pep8 complains about 2020-04-04 14:43:13 +02:00
f4e7598c87 Update dynamic CSS generation for "docs.css"
This is primarily to enable the "make STYLE=website html" build
option of the PostgreSQL docs, as the pgweb docs page uses
the "base.css" file to render the documentation. By updating the
dynamic doc.css generation file, we can allow the builders of the
documentation to better preview what their documentation will look
like when it is loaded onto the website.

Presently, the dynamic "docs.css" is unused in pgweb or the core
project, and as those are the two biggest consumers of the
documentation styles, this is an apparent safe vector to make this
change.
2020-02-12 08:10:49 -05:00
69923c7190 Stop using bare exceptions
This is frowned upon in newer versions of pep8, so fix it once and for
all.
2020-01-09 13:14:32 +01:00
2148cb084a Raise a http 404 error on paths that are too long
We never have any paths this long, and it's nicer to raise a proper 404
than a 500 internal server error.
2019-10-10 20:49:45 +02:00
80eac2568e Support xkey purge requests on the API endpoint
Simply specigfying "x<n>" instead o "p<n>" should do the trick.
2019-06-19 21:26:18 +02:00
499a40baf7 Update for new module/namespace for urllib 2019-01-26 16:19:26 +01:00
a10eb6420b More generic changes from 2to3 2019-01-26 16:19:26 +01:00
a156829375 Generic unicode updates 2019-01-26 16:19:26 +01:00
7547b6f766 Update syntax for relative imports 2019-01-26 16:19:26 +01:00
00ab822ea8 Fix deprecated comparison structs 2019-01-17 21:19:57 +01:00
0883ac6423 Fix whitespace and indentation, per pep8 2019-01-17 20:47:43 +01:00
87237f6536 Tabs, meet your new overlords: spaces
In a quest to reach pep8, use spaces to indent rather than tabs.
2019-01-17 15:35:39 +01:00
d0a0571e14 Don't try to validate organisation ownership for new orgs 2018-12-22 17:06:48 +01:00
0d1832dc0d Stopgap fix for lack fo permissions check on organistions 2018-12-22 16:07:45 +01:00
915aa6ea31 Remove training events
The way these were handled they weren't really providing any value to
users, because a lot of sessions were registered and never run etc etc,
but did cause a lot of work for our moderators.

The general feature may return later in the form of "training providers"
or similar as part of the professional services section, but for now
there is no point in maintaining this data.
2018-12-07 10:24:12 +01:00
bf6ca4a381 Update references for NOTIFICATION_EMAIL
This updates various references to use NOTIFICATION_EMAIL, since that's
what we actually send the emails too.

Also change the moderators group to be 'pgweb moderators'.
2018-09-24 10:04:49 -04:00
97626136af Make the varnish purge admin form nicer
Have the output list the actual type of purge instead of just they
keycode, and add possibility to purge both expressions and xkey.
2018-07-06 15:32:50 +02:00
76900b7657 Teach varnish purging code about xkey purges
It's just another  type of purge, so it's added as an extra option with
'K' as the key (as 'X' was already taken).
2018-07-06 15:32:14 +02:00
406a120a54 Pass pg context to render when rendering static pages
This is where we set both the gitrev and the do_esi, both of which are
needed. This means that gitrev has been broken on static pages since
forever - oops.
2018-06-29 19:40:45 +02:00
3e2b9ee6e2 Only call datetime.date.today once on the homepage. 2018-05-18 13:18:53 -04:00
5c3f229e44 Update homepage event display algorithm.
The event display algorithm shows up to two non-badged events
that take place over the next three months.  Subsequently, up to
seven minus |non-badged events| are returned.
2018-05-18 13:16:09 -04:00
8a74e5d14a Put ordering on event querysets on homepage.
As we are getting the first X of each event queryset, we need to
ensure there is ordering so it is the first X by date.
2018-05-18 09:55:49 -04:00
d252bdedf3 Updated event display algorithm on home page.
The homepage will now display seven events, allowing up to two
events that are not community badged to be present.
2018-05-17 12:25:27 -04:00
e91630c42e Homepage redesign utilizing new CSS and base HTML.
The new look of the homepage is optimized for both desktop and
mobile views and is setup to help guide new and returning users
to appropriate PostgreSQL content.

Authors: Sarah Conway <sarah.conway@crunchydata.com> and me
2018-04-17 13:43:12 -04:00
9256e2f00d New base HTML for PostgreSQL.org
The base HTML structure enables the responsiveness for the
website. In addition to the primary base template, the generic
page and form templates are also modernized.

Authors: Sarah Conway <sarah.conway@crunchydata.com> and me
2018-04-17 13:43:04 -04:00
f89d0d9b61 Allow "About" page to be render dynamically.
In prep for the new "About" page to serve dynamic (though
periodically cached) content.
2018-04-15 22:05:59 -04:00
487d86bee3 Fix that HttpServerError now takes a request as parameter 2018-03-10 10:54:13 -05:00
890f85be76 Show django version in system_information 2018-03-10 10:47:00 -05:00
fd37389a3b Replace NavContext and render_to_response with render_pgweb
render_to_response does not work on newer django, so it needs to be
replaced. And using a speicfic context actually overcomplicates things,
it's easier to just use a wrapper function. For those cases where we
don't need NavContext, just use render() (the new shortcut function from
django), which also removes the need to use RequestContext.
2018-03-10 10:38:11 -05:00
2e1b4a5f08 Add explicit group permissions check for varnish purge and pending mod
Previously we just used "is member of staff", but for better granuality
explicitly also check membership of groups. This introduces the new
group "varnish purgers" for that permission.
2018-01-26 11:03:10 +01:00
9bd151082e Add tag support for news items
This lets us separate things like project news from other OSS and from
commercial postings, for example, allowing for people to subscribe to
different feeds with just the parts they are interested in.
2017-12-13 20:55:07 +01:00
e7014d7ecc Enable events to be badged.
Adds the "badged" flag to the Event model in order to distinguish
community badged events from other PostgreSQL oriented events.
Seven total events will be displayed on the homepage, with up to
four community events displayed. If there are no upcoming
community events then, then the header "Events" is shown.

The event submission interface allows a user to opt-in to
listing an event as a "community" event and provide an
explanation for moderators as to why the event should be
considered a community event.

Expands the list of News and Planet PostgreSQL blog entries to 10.
2017-12-06 12:06:37 +09:00
0354a5ec0f Remove support for repo updated trigger
This was never actually completed, and we have other ways to deal with
the deployments now that are faster.
2017-06-27 15:14:20 +02:00
428f299f48 Generate internal sitemap including devel docs
We'll use this to index some things in our own search engine without
exposing it to external sitemap parsers. Not from a security standpoint
of course, but something that will lead to it being possible to search
the devel docs again.
2017-03-23 12:11:22 +01:00
7fc34e9eaf Replace login_required decorator with a validating one
This one will validate that the url is under /accounts/, which is
the only part we are going to be excluding from caching once we
move the website to https-only.
2016-05-24 21:14:34 +02:00
9bcaa6ab33 Remove the "is behind cache" functionality
We're always behind cache now (we may or may not be cached, but that's
not what this check was about)
2016-05-24 21:14:33 +02:00
fd904ebc27 Fix robots.txt in https only scenario
We now allow all searching
2016-05-24 21:14:33 +02:00
3c089cd09a Remove SSL decorators and middleware
The site is now served regardless of SSL, and assumes that the webserver
or web cache ensures that things rae always SSL.
2016-05-24 21:13:00 +02:00
753d20545a Remove SSL optional tag 2016-05-24 21:13:00 +02:00
a126594260 Update sitemap URLs for https 2016-05-24 21:13:00 +02:00
59166227fd today() is a function
Callables in querysets are deprecated, so make sure we don't end
up using them unintentionally...
2016-05-14 21:29:59 +02:00
da812e682b mimetype is now called content_type 2016-05-14 19:49:12 +02:00
350b936e58 Prefix cross-application imports with pgweb
As required by the new project layout.
2016-05-14 19:49:12 +02:00
856dbd31a2 Update for new transaction handling in newer django versions 2016-05-14 19:49:12 +02:00
498e786c0e Move files and directories for new project layout
Move manage.py up one step, set up a new wsgi.py file, and adjust
relative paths that refer to other directories for the new project
layout that we need to use in django 1.8.
2016-05-14 19:49:12 +02:00
2f8bbc40dd Replace pgq with trivial local queue implementation
The queue used for varnish purges has so few entries that it's really
not worth paying the management overhead for skytools/pgq. Instead we
can use a very simple local deamon using LISTEN/NOTIFY to fire them off.

Now include a proper nagios plugin in this package, so we can get rid
of the not-very-nice munin plugin currently used in the deployment.
2016-05-14 19:49:12 +02:00