Commit Graph

128 Commits

Author SHA1 Message Date
Lephe 417fc05d29
program: add metadata and a basic model for events (#114)
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
2022-06-16 17:00:59 +01:00
Lephe 8ff21c615d
program: add infrastructure for the progrank job (#114)
* 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
2022-06-15 11:27:29 +01:00
Lephe db0e42d285
programs: add tag input and display (#114)
* 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.
2022-06-14 23:19:41 +01:00
Lephe c74abf3fcc
post: add a tagging system, with a common base set of tags
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.
2022-06-12 18:26:47 +01:00
Lephe 6756838882
forum: factor attachment creation code 2022-05-26 20:08:16 +01:00
Lephe b047ed97af
programs: program creation + view + comments
This is very much a work in progress, but the main ideas are here.

[MIGRATION] This commit contains a new version of the schema.
2022-05-19 20:34:46 +01:00
Lephe 0e1b434f7d
program: fix tag assignment 2022-05-19 19:12:09 +01:00
Lephe 011ea3d2a6
programs: add the model for tags
[MIGRATION] This commit contains a new version of the schema.
2022-05-19 18:51:05 +01:00
Lephe 8393cf1933
perf: eagerly load auxiliary data 2022-05-12 20:45:31 +01:00
Lephe 38c4f274a0
perf: optimize away more privilege requests
[MIGRATION] This commit contains a new version of the schema.
2022-05-12 20:00:24 +01:00
Lephe 7d9e897ae9
perf: optimize away special privilege requests by lazy loading 2022-05-12 19:24:17 +01:00
Lephe 5a87d29c7f
account: make default avatar selection less hacky 2022-05-05 20:33:45 +01:00
Darks eb5ce1bd5c
attachement: switch to uuid + check permission in dl widget (#109)
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
2022-04-26 23:29:11 +02:00
Lephe db5e613f7e
model: use methods to access a user's typed posts (#104) 2022-04-25 17:05:17 +01:00
Lephe 8098642d4b
model: add an index on Post.type
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.
2022-04-25 17:04:08 +01:00
Lephe 39748667ee
model: add a number of missing indexes
See #107.

[MIGRATION] This commit contains a new version of the schema.
2022-04-21 17:58:59 +01:00
Darks c6ef83d32c
post: add move to another thread operation (#79)
Currently only support forum
2021-07-14 19:55:16 +02:00
Lephe be644a6e18
forum: update trophies/xp of deleted topics' contributors 2021-07-12 20:39:44 +02:00
Lephe 76f03be60f
forum: do not delete threads of promoted topics
Threads of promoted topics belong to the programs they were promoted
into, so they shouldn't be deleted.
2021-07-12 20:39:19 +02:00
Lephe b8ed0bba99 forum: enable topic deletion
Topic modification does not work in this snapshot, this is normal.
2021-07-12 18:37:06 +02:00
Lephe 9727c2a986 forum: add an action to change the top comment of a topic
This also prepares the thread_leader macro for top comments of
topics, programs, etc. which have extra stuff to render and more
specific actions.
2021-07-12 18:37:06 +02:00
Lephe b1ca1c4bbc
model: fix a bug in Guest.__repr__ 2021-07-12 17:47:45 +02:00
Lephe 05f56a1cf4
forum: improve attachment inputs and allow edition (#49) 2021-07-08 16:50:28 +02:00
Lephe b3d99b93f8
account: add a theme setting (#14) 2021-07-08 11:43:09 +02:00
Lephe 61f48259f2
trophy: fix deleteion 2021-07-08 10:58:53 +02:00
Lephe cc5f4e481b
account: member deletion, with post anonymization (#57) 2021-07-08 10:39:22 +02:00
Lephe bee912f88c
model: add all deletion methods (except Guest/Member) 2021-07-07 21:23:35 +02:00
Lephe 3c5599adf7
model: avoid the foreign key cycle between Thread and Comment
By specifying use_alter=True on one of the keys, the ORM will generate
an ALTER command to set the second foreign key after inserting both
objects, in case two new objects referring to each other have to be
created.

See: https://docs.sqlalchemy.org/en/14/core/exceptions.html#sqlalchemy.exc.CircularDependencyError
2021-07-07 19:38:28 +02:00
Lephe b00d44ddc1
model: index comments by thread for faster lookup 2021-07-07 16:30:21 +02:00
Lephe 6f98cba65e
review of privileges and forum permissions
* 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
2021-02-26 18:32:45 +01:00
Lephe d50b58cd24
(random improvements on texts) 2021-02-26 18:31:10 +01:00
Eldeberen d6512bb197
polls: added multi-choices polls 2021-02-22 22:49:11 +01:00
Eldeberen cd8ce4f5bc
admin: fix name edition through admin panel (#85) 2021-02-20 19:32:18 +01:00
Lephe 1d457d7e65
topic: fix model preventing Post from polymorphic loading as Topic 2021-02-20 19:03:14 +01:00
Eldeberen cd8efcced8
Merge branch 'dev' of gitea.planet-casio.com:devs/PCv5 into polls 2021-02-20 01:36:04 +01:00
Eldeberen 473448ab5b
poll: add ability to vote
Fixed some bugs too
2021-02-20 00:33:34 +01:00
Eldeberen d2c5ddd874
polls: added models 2021-02-19 22:07:31 +01:00
Eragon c0ae3cc8ab
#84 Confirmation anti-nécropost 2021-01-12 16:40:52 +01:00
Darks 4aa1802afb
polls: created backbone of models (#72) 2020-11-12 00:11:33 +01:00
Lephe cf9cb8a8c6
forum: add true, recursive deletion methods
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.
2020-11-01 10:49:24 +01:00
Darks e265e003b9
admin: fixed the forum panel 2020-09-24 00:22:20 +02:00
Darks 7395835e71
refact: models files are nom uniform (all singular) 2020-08-06 21:19:01 +02:00
Darks a7bde62ff2
feat(trophies): added programs count 2020-08-06 21:05:49 +02:00
Darks 3fb3ee40d2
fix: better PEP8
Flake8 returns less errors. I ignored lots of them though
2020-08-05 22:52:56 +02:00
Darks 3a35c26bd7
forum: add pagination to topic list (#64) 2020-08-02 17:28:43 +02:00
Lephe 03c577316f
thread: add a reference to the owner post 2020-08-02 11:01:08 +02:00
Darks 554898db87
attachments: merged attachments system into dev 2020-08-01 21:47:25 +02:00
Darks 56a584c535
attachments: added attachments system
Still need some work on it…
2020-08-01 21:26:06 +02:00
Lephe d3f137b92d
programs: add models for programs and topic promotions (#20)
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.
2020-08-01 15:11:19 +02:00
Darks 47efd6689b
Merge remote-tracking branch 'filoji/dev' into attachments 2020-08-01 10:22:22 +02:00