This commit adds most of the optional metadata for programs. The event
related to the program's publication is an actual relationship to an
Event model. The idea is to expand on that model in the future to
include:
- A link to the event's main topic
- List of programs published in the event
- Possibly, a list of all related topics (announcement, start, results,
etc) all sharing a common 1-line header so they are linked together
- This would be used for event-related trophies
- And possibly for an event calendar
* Add an automatic job every day at 4 AM to recompute the progrank of
every program. Currently everyone gets progrank 0.
[MIGRATION] This commit contains a new version of the schema.
[SETUP]
* Install flask-crontab (with pip)
* Run `flask crontab add` to register the jobs
* Add a TagListField which automatically validates its input against the
TagInformation database, and has a richer .selected_tags() method
* Add a dynamic tag input widget, available through a macro (*import
with context*), that supports both JS and non-JS input
* Add a TagInformation.all_tags() function
* Add colored tag display to all themes
* Fix a bug causing programs to have no names
* Add tags: games.action, games.narrative, courses.informatics
[MASTER] Run the 'update-tags' command of master.py.
Adds the tagging system, with 3 types of tags:
* Calculator models grouped by compatibility classes
* Programming languages
* Game, tools, and course categories
[MIGRATION] This commit contains a new version of the schema.
[BREAKS] This commit breaks existing tag assignments.
[MASTER] Run the 'update-tags' command of master.py.
Also added is_default_accessible() to Thread class as its owner may be a
Topic with forum access restrictions or public main content (like
Program)
[MIGRATION] This commit contains a new version of the schema. /!\ This
migration breaks all attachments
This is useful to quickly browse a list of polymorphic Posts for topics,
programs, etc. The main application is from Member.posts, since
polymorphic collection seems both difficult and edgy.
[MIGRATION] This commit contains a new version of the schema.
* Sorted privileges into categories, similar to the v4.3 style
Added privilege check utilities:
* Forum: is_news(), is_default_accessible() and is_default_postable()
* Member: can_access_forum(), can_post_in_forum(), can_edit_post(),
and can_delete_post()
Unfortunately current_user is not a Guest when logged out, so one
cannot usually write current_user.can_*() without checking for
authentication first, so the checks are still somewhat verbose.
Reviewed forum permissions; the following permission issues have been
fixed (I have tested most but not all of them prior to fixing):
* app/routes/forum/index.py: Users that were not meant to access a
forum could still obtain a listing of the topics
* app/routes/forum/topic.py: Users that were not meant to see topics
could still read them by browsing the URL
* app/routes/forum/topic.py: Authenticated users could post in any
topic, including ones that they should not have access to
* app/routes/posts/edit.py: Users with edit.posts (eg. mods) could edit
and delete messages in forums they can't access (eg. creativecalc)
* app/templates/account/user.html: Users with admin panel access would
see account editing links they can't use (affects developers)
* app/templates/base/navbar/forum.html: The "Forum" tab would list all
forums including ones the user doesn't have access to
* app/templates/forum/index.html: Users would see every single forum,
including ones they can't access
* app/template/widgets/thread.html: Anyone would see Edit/Delete links
on every message, even though most were unusable
Miscellaneous changes:
* app/routes/forum/topic.py: Ordered comments by date as intended,
which I assume worked by chance until now
* Removed the old assets/privs.txt files which is now superseded by the
list implemented in app/data/groups.yaml
This commit changes group and forum information, run master.py with:
@> forums update
@> groups update
Each object has a .delete() which removes it and its owned subcontents.
This delete() unfortunately has to commit the database session because
circularly-dependent objects (such as a thread and its top comment)
cannot be deleted together; two commits are needed.
Not tested yet since there is a lack of tools to manipulate comments,
topics and programs. The /programmes routes is used to display a list of
all programs, temporarily.