Commit graph

107 commits

Author SHA1 Message Date
Vincent Ambo
c5cf911a07 fix(db): Explicitly order posts in a thread 2018-04-16 14:14:26 +02:00
Vincent Ambo
9bc5bbff54 fix(templates): Fix alignment of columns in thread view
The author column is maybe slightly too large now, but that can be
sorted out later.
2018-04-16 13:33:47 +02:00
Vincent Ambo
9c2359c8c9 fix(templates): Fix double-escaping of thread titles 2018-04-16 11:03:15 +02:00
Vincent Ambo
1462810963 fix(render): Enable GFM's tagfilter extension 2018-04-16 03:15:50 +02:00
Vincent Ambo
a5f2677785 fix(templates): Add some pleasing spacing to thread layout 2018-04-16 02:56:55 +02:00
Vincent Ambo
1b662c8674 chore(oidc): Enable debug log statement for token responses 2018-04-16 02:16:34 +02:00
Vincent Ambo
985ca0a3e5 fix(build): Add PostgreSQL library to Nix dependencies 2018-04-16 01:06:20 +02:00
Vincent Ambo
72f6fa65fd fix(templates): Mark pre-escaped variables as 'safe' 2018-04-16 00:25:29 +02:00
Vincent Ambo
fc0b9d7fa5 refactor(main): Include Tera templates into application binary
Instead of loading the templates at launch time (which requires the
template folder to be present), include the template strings into the
binary.

This also re-enables auto-escaping in Tera.
2018-04-16 00:24:55 +02:00
Vincent Ambo
71c55b8bb8 feat(build): Add Nix build configuration
Adds a Nix build configuration baesd on the default rustPlatform
configuration.

The configuration pins a specific nixpkgs commit (which at the time
was a commit tracking nixpkgs-unstable).
2018-04-16 00:24:13 +02:00
Vincent Ambo
6fd7ee05f2 docs(todo): Update todo-list 2018-04-15 23:31:36 +02:00
Vincent Ambo
56d57edfd0 feat(handlers): Implement post editing handler
Implements a handler that receives the edit form result and updates
the database accordingly if the user identity matches.
2018-04-15 23:30:22 +02:00
Vincent Ambo
e130e15b79 feat(db): Support UpdatePost message
Simple message intended to be used for post editing.
2018-04-15 23:23:13 +02:00
Vincent Ambo
705097dab9 feat(handlers/render): Display edit form for user's own posts
Displays an edit form for posts that are owned by a user (which is
currently defined as "email addresses match").
2018-04-15 23:09:44 +02:00
Vincent Ambo
7a55786552 fix(templates/post): Correctly insert post body 2018-04-15 23:09:33 +02:00
Vincent Ambo
f4ca632c00 feat(db): Support GetPost message
Very simple message that retrieves a post from the DB.
2018-04-15 23:09:00 +02:00
Vincent Ambo
ce18cfa2d6 refactor: Add a message!-macro to reduce message boilerplate 2018-04-15 21:31:14 +02:00
Vincent Ambo
d9d1a3313f refactor(render): Pass serializable structs to Tera directly
No need to go the intermediate step via `Context::new()`
2018-04-15 21:18:27 +02:00
Vincent Ambo
ec712cc4c0 refactor(templates/render): Add generic post editing template
Adds a generic template that can be used for submitting, responding to
and editing posts.
2018-04-15 21:13:20 +02:00
Vincent Ambo
4c0e6552e8 refactor(main): Split enormous main() into smaller methods
A little bit of logical grouping of things has never hurt anyone.
2018-04-15 13:16:49 +02:00
Vincent Ambo
aeaa497a62 fix(handlers): Trim leading/trailing whitespace from new threads 2018-04-15 13:01:06 +02:00
Vincent Ambo
ee4b690d22 refactor(templates): Restyle thread view using flex layout 2018-04-15 12:38:33 +02:00
Vincent Ambo
9cee48f2da feat(handlers): Determine whether current user can edit a post 2018-04-15 12:38:12 +02:00
Vincent Ambo
02a466a28b style(templates): Minor fixes to search & index layouts 2018-04-15 00:41:17 +02:00
Vincent Ambo
ba33efd772 refactor(handlers): Receive search terms via query parameters
There are several reasons for this, but one important one is that
people expect to be able to share search links.
2018-04-14 23:28:34 +02:00
Vincent Ambo
e0b1bc2627 fix(render): Escape post bodies
... derp.

Well, the CSP prevented script executions already.
2018-04-14 22:33:35 +02:00
Vincent Ambo
8057b8849e feat(templates): Add 'sticky' badge to sticky threads 2018-04-14 22:33:35 +02:00
Vincent Ambo
06f7f23bab fix(migrations): Change weighting of title vs. body
After thinking for a little while I actually think the body of a post
may be more relevant when searching for posts than the thread title.

Right now this is just a hunch and we'll have to find out how it
actually ends up working in real life.
2018-04-14 22:21:55 +02:00
Vincent Ambo
4132869277 feat: Implement search result view & enable search
Implements a very simple and currently kinda broken-looking search
result view.
2018-04-14 22:21:55 +02:00
Vincent Ambo
dae97fdaf5 chore(db): Arbitrarily limit search result size
... until pagination is in place.
2018-04-14 22:21:55 +02:00
Vincent Ambo
39d1cd64bc feat(main/db): Schedule regular search view refresh
Schedules refreshes of the database view used for search at one-minute
intervals.
2018-04-14 22:21:55 +02:00
Vincent Ambo
3e5b1098c6 refactor(schema): Unify integer type usage across tables 2018-04-14 22:21:55 +02:00
Vincent Ambo
ea68bac427 refactor(handlers): Improve error handling in post creation 2018-04-14 22:21:55 +02:00
Vincent Ambo
31b0a550f2 feat(db): Implement handling of 'SearchPosts' message
Adds support for executing full-text search across a forum instance by
sending the `SearchPosts` message with a search query to the DB actor.

The struct used for results is mapped manually to the expected query
result as the query is embedded via raw SQL.
2018-04-14 22:21:55 +02:00
Vincent Ambo
2d8db52010 feat(migrations): Add materialized view & index for full text search
Adds a materialized view to be used for full-text searches that
indexes the tsvector documents for each post.
2018-04-14 22:21:55 +02:00
Vincent Ambo
529da884da fix(templates): Fluidly scale all images 2018-04-14 18:12:24 +02:00
Vincent Ambo
324778c7e0 fix(templates): Set CSPs on templates 2018-04-14 17:59:52 +02:00
Vincent Ambo
b684320a73 docs(todo): Stickies are done! 2018-04-14 17:56:36 +02:00
Vincent Ambo
c6995fcab3 feat(templates): Highlight stickied threads in index 2018-04-14 17:55:57 +02:00
Vincent Ambo
d1c45159b9 feat(db): Add support for stickies in database
Adds a 'sticky' column to threads and rewrites the thread index to
take sticky markings into account when ordering threads.

Stickies are not yet highlighted in any way in the forum overview.
2018-04-14 17:47:31 +02:00
Vincent Ambo
c136d34e79 docs(todo): Add note about stickies 2018-04-14 17:16:10 +02:00
Vincent Ambo
f10bd20276 feat(db): Add view for ordering thread index by most recent post
This implements the classic thread ordering expected by most forum
users (i.e. the thread with the most recent post is at the top).
2018-04-14 17:15:27 +02:00
Vincent Ambo
cf64826e4e feat(build): Configure Travis builds for Rust 2018-04-14 16:43:59 +02:00
Vincent Ambo
a326e1ea2e feat: License project under GPLv3 2018-04-14 16:40:56 +02:00
Vincent Ambo
d1acf4cfd7 docs(CODE_OF_CONDUCT): Add a reasonable code of conduct 2018-04-14 16:38:48 +02:00
Vincent Ambo
b0825f3850 docs(README): Add a very simple README file 2018-04-14 16:38:05 +02:00
Vincent Ambo
8c30ef92f6 refactor(db): Store thread body in the posts table
This is a simplification over the previous approach. The OP of a
thread is just a normal post like any other in this model, which
allows some code simplifications (and future query convenience).
2018-04-14 16:33:45 +02:00
Vincent Ambo
a90d1cc1a4 feat(migrations): Drop 'body' column from threads
As a data model simplification, the text of a thread's top post should
simply also go into the posts table.
2018-04-14 16:33:15 +02:00
Vincent Ambo
bf02c70f74 feat(handlers/main): Add 'anonymous' mode for forum
Adds a `REQUIRE_LOGIN` environment variable which, if set to anything
other than true, will let users post anonymously on the forums.
2018-04-12 01:28:37 +02:00
Vincent Ambo
e7a54a5aff feat(handler): Perform basic input validation on new thread view 2018-04-12 01:07:25 +02:00