Commit Graph

46 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
46606e5284 Set on_delete=models.CASCADE on all ForeignKey fields
This is the bardware compatible value that will be needed once we
upgrade django later.
2020-03-31 22:34:51 +02: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
18b09872ef Make it possible to block OAuth signin to accounts
This adds a checkbox to each user account letting the user block the use
of OAuth to this account, forcing the use of internal authentication.
2019-02-10 14:48:34 +01:00
3120efd192 Remove trailing windows newline 2019-01-26 16:19:26 +01:00
a156829375 Generic unicode updates 2019-01-26 16:19:26 +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
ceb90c9d72 Fix unicode in error message about ssh keys
Caused an exception when somebody tried to upload an SSH key where the
*key type* contains non-ascii (this would normally be things like
"ssh-rsa", and there are definitely no legit key types outside the ascii
range, but we still shouldn't crash)
2018-12-26 12:45:17 +01:00
669b3782e6 Modify version policy language to be more clear about how releases occur.
In essence, a release is supported until its 5 year anniversary, and
will receive one additional set of fixes after that. This is inline
with what we are currently doing, but should help make it more clear.
2018-09-18 16:04:29 -04:00
f49e1b870b Fix unnecessary warning
null=False means nothing on a ManyToMany, new django warns about it.
2018-03-23 13:54:22 +01:00
b1aa5e1f21 Validate ssh keys as they are entered in the profile
In particular, reject ssh-dss keys here. They don't work anymore since
an upgrade, for security reasons, but there was not really a way for the
user to know why. With this they will at least know if when they try to
save or change the keys.
2018-03-09 15:15:33 -05:00
0cb56d9355 Database:ify the list of security patches
This finally moves the patches into the db, which makes it a lot easier
to filter patches in the views.

It also adds the new way of categorising patches, which is assigning
them a CVSSv3 score.

For now, there are no public views to this, and the old static pages
remain. This is so we can backfill all existing security patches before
we make it public.
2018-01-25 21:59:13 +01:00
2cbf0bf048 Add support for notification emails on m2m changes
Unfortunately, we'll send one email for each m2m field, instead of
collecting them to a single one. That's because there is no signal
delivered at the end of them all, there will be one sent for each field.

Luckily we don't have a lot of m2m fields at this point, and no model
has more than one, so at this point that part is not a problem.

It also means that if a regular field *and* an m2m field is changed,
then we will get two notifications.

Finally, enable these notifications for the Organisation fields, meaning
we will get a notification when an Organisation changes managers, which
was not working before.
2017-12-13 20:49:52 +01:00
88d6fdc224 Invent the concept of a "numtree" for versions
This property returns a single digit numbers for versions 10 and up (10,
11 etc), and keeps the two digit number for earlier (9.0, 9.1 etc).
2017-05-19 13:42:58 +02:00
cd37dac7fd Move submitbug under /account/
In passing make it require ssl, make it no longer csrf-exempt,
and make it require a login so we don't let unauthenticated emails
through.
2016-05-17 17:37:09 -04:00
c97ea7cf4d Fix default value for language
Needs to be a static value for it to work properly once we enable
migrations.
2016-05-14 19:49:12 +02:00
217f9ef62a Fix model warnings and deprecations
1. ForeignKey with unique -> OneToOneField
2. IPAddressField -> GenericIPAddressField
3. Fix fields with default=datetime.now() which gives server start time,
   not the insert time (clearly this default was never used, and the
   field was always explicitly set, but it should still not be incorrectly
   defined)
2016-05-14 19:49:12 +02:00
8058accee0 Get rid of PgModel, replacing it with simple signals
We were already using signals for everything except delete, and even
in our old version of django the delete signal exists (it didn't exist
when this code was first written).

Django doesn't really like models to be OOP like this, so keeping PgModel
would cause issues with upcoming changes in django 1.8. Using simple functions
is easier, and the actual functionality is replicated straight off.
2016-03-07 21:41:45 +01:00
6341b22f17 Handle Alpha versions. 2015-07-02 14:57:58 +01:00
abeaa24106 Remove hardcoding of list of unsupported versions
Instead, query it from the database, so that it's properly updated when
a new release goes out of support.
2014-03-15 15:03:24 +01:00
f31c58ddaa Fix beta versioning to be more generic test versioning
This allows us to specify both beta and rc versions.

Requires SQL:

ALTER TABLE core_version RENAME COLUMN beta TO testing;
ALTER TABLE core_version ALTER COLUMN testing TYPE integer USING CASE WHEN testing THEN 2 ELSE 0 END;
2013-08-22 14:45:33 +02:00
d4fd69a712 Expire list of docs and manuals when versions are updated 2013-08-17 17:33:52 +02:00
fdd1404f37 Get the list of documentation versions out of the database
Instead of having to update this list manually in multiple places when
releasing new versions, just take the information out of the database
where it has to be anyway.

Fixes #90
Closes #93

Also make the code automatically pick up wich PDF files exist in the
static checkout, and auto-detect their size, both A4 and US sizes. This
removes yet one more manual step, yay!

Fixes #163
2013-08-17 17:28:36 +02:00
8e458731cb Make an actual foreign key between docs versions and core versions
This was originally not done because we had a lot of old legacy data
that didn't have entries in both tables. This is no longer the case,
and the docloads script already enforced that it couldn't happen again.

Requires SQL:
ALTER TABLE core_version ADD CONSTRAINT version_unique_tree UNIQUE(tree);
ALTER TABLE docs ADD CONSTRAINT docs_version_fkey FOREIGN KEY (version) REFERENCES core_version(tree);
2013-08-17 16:48:03 +02:00
8be717d99d Use a proper database field for beta releases
This replaces the previous ugly hack where beta versions had a negative number
as latestminor, giving a much cleaner model.

Requires SQL:
ALTER TABLE core_version ADD COLUMN beta boolean NOT NULL DEFAULT 'f';
ALTER TABLE core_version ALTER COLUMN beta DROP DEFAULT;

(Yes, we really need to move to something that can do automatic migrations)
2013-08-17 15:37:45 +02:00
9781cd656e Add a Language model to core
This lists all ISO-639-2 languages, and can be used in foreign keys
from other models.
2013-01-30 15:13:37 +01:00
7855d1b06c Implement ability for moderators to send notices to organisations
Notices entered will be sent to the organisations email address - so there
needs to be one (if not, the notification field doesn't show up).

Notifications also go in the database, and show up on each object so you
can see the previous history of it, and get emailed to the slaves list.

Finally, it's possible to reject-with-notification, in which case the
notification is sent off to the user and after that the object is deleted.
The notification history stays in the database, but is not linked anywhere
(but can be viewed from the admin interface on that model directly).
Unfortunately, this seems to cause double notifications to the slaves list,
but we'll have to live with that for now.

Closes #137
2012-06-26 14:34:26 +02:00
78ab264578 Include last modified date in sitemap 2012-01-14 16:55:53 +01:00
e4f54e7cb4 Purge supported version list from frontends when changina version object 2012-01-07 13:46:59 +01:00
31fa6e465c Add two fields to the version model, for tracking release dates
This requires the following to be run on all developer installations:

alter table core_version add column "firstreldate" date NOT NULL default current_date;
alter table core_version add column "eoldate" date NOT NULL default current_date;
alter table core_version alter column "firstreldate" drop default;
alter table core_version alter column "eoldate" drop default;
2012-01-07 13:00:23 +01:00
1ea8ecd12a Include docs load timestamp in developer docs
This makes it possible to figure out when the docs were actually
loaded, since developer docs don't carry a version number. This is
actually going to be the docs *load* timestamp, and not build timestamp,
but they should be close enough together that it shouldn't matter.

Fixes #108
2011-12-04 15:14:54 +01:00
22d121f643 Purge related URLs from varnish when a new item is fetched from RSS
Fixes #95
2011-12-04 14:34:52 +01:00
27fc2a7e3c Migrate ssh keys and store them in a UserProfile table 2011-11-27 14:44:18 +01:00
70ba99ff01 Fix verbose names 2011-11-07 22:07:08 +01:00
72977ae59e Must include the leading slash in purges. 2011-11-06 16:12:52 +01:00
223e587479 Version must be a PgModel in order to purge things
And it was already set up to purge things like the front page...
2011-11-06 16:00:19 +01:00
f136a665fe Add concept of supported versions
Also, only index docs for supported versions...
2011-07-12 14:15:20 +01:00
f92709d2a6 Implement basic varnish purging
This allows all models inherited from PgModel to specify which
URLs to purge by either setting a field or defining a function
called purge_urls, at which point they will be purged whenever
the save signal is fired.

Also implements a form under /admin/purge/ that allows for manual
purging. This should probably be extended in the future to show
the status of the pgq slaves, but that will come later.

Includes a SQL function that posts the expires to a pgq queue. For
a local deployment, this can be replaced with a simple void function
to turn off varnish purging.
2011-06-14 19:48:48 +02:00
e3d8eae0ce Add the concept of a "current version", and use this when determining
which version to map /current/ to in the docs section.
2010-02-26 13:14:03 +01:00
7b3bb5d09b Make organisations support multiple "managers" and not just one
"submitter", thus making it possible for a single person to manage
multiple organisations, as well as for a single organisation to have
multiple different manages.

Re-hook events and news items to use organisation of the submitter
instead of the user who did the submission. (product listings already
did this)
2010-02-26 12:34:19 +01:00
fcc9e08e95 Add simple RSS parser, currently only does planet. Use this for the
planet list on the frontpage and the community page.
2009-12-28 19:21:32 +01:00
3aa6730487 Make sure organisation and product names are unique 2009-12-28 14:31:08 +01:00
f216b00037 Implement software catalogue. Break the organisation object out as
part of the core, since it seems like it could be useful for other
kinds of objects as well in the future, but for now only the
software catalogue uses it.
2009-12-28 14:22:17 +01:00
90b758c247 A first very basic import.
Contains basic functionality, and an import of most of the static content
from the old site.

There is still plenty more to do...
2009-09-14 14:39:25 +02:00