summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Discussions
AgeCommit message (Collapse)AuthorFilesLines
2024-03-20Fix a few user pages not being accessible by non-modsYorhel2-1/+2
Broken in 8a8593e91e5252a24fdfa7d46c28134668ab7c9c Oops.
2024-03-20Add support for account soft-deletion and email opt-out listYorhel1-1/+1
This work is to support a safe self-service account deletion feature, but I haven't implemented that part yet.
2023-12-04Stricter input validation for single-line fieldsYorhel1-3/+3
Tried some malicious multiline inputs, wasn't a big issue given that HTML doesn't render newlines, but could still be surprising in some places.
2023-10-10Validation: Remove "required" and be explicit about optional fieldsYorhel3-7/+7
See TUWF commit fd3d2ca6a18222dafaa13dbcb7a6ccce1c4d9e6e Fixes https://vndb.org/t2520.822 and a few related bugs. (I may have introduced a few new bugs with this, let's see...)
2023-09-14Discussions::Thread: Convert reply form to JSYorhel1-10/+7
2023-05-22Fix "sethash" of forum/review postsYorhel1-2/+2
Another bug found by the JS error logger \o/ Turns out numeric element IDs are kind of icky. They were disallowed in HTML4, then allowed in HTML5 but still not supported in CSS selectors. So let's just give them a little prefix to make sure it'll work.
2023-05-05CSS: Use <nav>/<menu> for maintabs + re-calibrate marginsYorhel1-2/+4
Previous solution relied on negative margins more than I liked. This solution is still surprisingly fiddly. This requires TUWF commit 4b0e2df89fe180bfa2f3da195a80684a46a649db
2023-05-05CSS: Use semantic tags + flexbox for global layoutYorhel6-12/+12
Hopefully without breaking anything. Switched to using flexbox for the homepage boxes instead of grid, in order to fix an overflow issue on Pale Moon. But I later fixed a similar issue with the relation graphs and history tables, so perhaps that switch wasn't necessary.
2023-04-15CSS: Use <b> as main "standout" elementYorhel1-2/+2
2023-04-15CSS: Use <strong>/<span> instead of <b> for bold/marker tagsYorhel2-5/+5
To reserve <b> for the standout styling.
2023-04-15CSS: Stop abusing <b> for grayedout, use <small> insteadYorhel2-2/+2
Which is also kind of an abuse, but at least the semantics are much closer. (Next up: the standout class. Slowly working towards a "font: inherit" and "color: inherit" reset, which'll remove the need for a bunch of ugly workarounds)
2023-03-25Discussions::Search: Add user filterYorhel1-9/+19
2023-03-24Search backend changes: faster results with trigram index + rankingYorhel1-21/+12
With this ranking system, searching for titles like 'L' and 'ONE.' is now at least possible, and YU-NO at least shows up on the first page when searching for "yu no". The actual normalization and matching algorithm hasn't really changed, except that all search terms must now match a single title, but there's still a whole bunch of false positives. Ranking is not available through the API yet. The trigram index should make it possible to do site-wide searching at a more reasonable speed, I'll experiment with that later.
2023-03-08Discussions::Thread: Ensure proper order of poll optionsYorhel1-1/+2
2023-02-20Discussions::Edit: Fix new-thread-on-someones-board formYorhel1-1/+1
2023-02-19Rework passing around entry titles + add proper HTML5 'lang' attrsYorhel7-16/+13
This is a huge back-end change for a small benefit, but it also improves consistency a bit in the way that titles are handled and passed around. The Elm code still uses separate title/alttitle fields at various places, not sure if I want to bother converting that, too. I'm sure there's bugs, given how many files this touches.
2023-02-04TitlePrefs: Also apply preferences to producer namesYorhel2-3/+3
Bit of an experiment. I should probably swap the schema columns too (i.e. name + latin) to be consistent with the recent VNs & releases, but that's not really a requirement for applying these preferences. And the more places where title preferences are applied, the more important it becomes to also set proper html "lang" attributes, which this commit doesn't do either.
2023-02-02Refactor part 2: get rid of temporary vnt/releasest viewsYorhel4-6/+6
Instead using the static view for the default title preferences, inline SELECT statements for custom preferences and wonderful vnt()/releasest() SQL functions for item_info(). Performance wise I don't expect much of a difference, except there's fewer writes and less per-page overhead from the CREATE TEMPORARY VIEW commands. Primary motivation for these changes is so that we can extend title preferences to other database types without incurring more overhead by needing to create more views.
2022-05-12Discussions::Search: Fix double-to_tsquery()ing of the search queryYorhel1-4/+4
For some reason applying to_tsquery() to a string twice gets different results than doing it once. Didn't expect that from a normalization function, but oh well. Fixes https://vndb.org/t2520.651
2022-03-01Discussions: Fix silly perl warning in previous commitsYorhel2-2/+2
Yeah, I forgot that user IDs can be undef for deleted users.
2022-03-01Discussions: Also mark "system notifications" in listingYorhel1-3/+4
This avoids leaking the initial list of targeted users in the list. These system notifications are still not supported all that well as the code doesn't handle threads with thousands of boards very efficiently, but for now that doesn't seem to be a problem yet.
2022-02-28Discussions::Thread: Support hack for system notificationsYorhel1-2/+7
2022-02-08VN: Add support for multiple titles in different languagesYorhel6-28/+23
This implements the main database model part of custom title languages (https://vndb.org/t12465). Selecting the right title for display is done in SQL through the 'vnt' VIEW, which can be overridden in each session with a TEMPORARY VIEW in order to support user title preferences, but that part has not been implemented yet. I had started out using an sql_vn() function that returned a subquery instead of using a VIEW, but then ran into trouble with the item_info() SQL function. This VIEW approach also happened to simplify much of the code. I did have to get rid of the Discusssions::Lib::sql_boards() function, as Postgres was unable to optimize the subquery inside a UNION inside a subquery for some reason. Haven't run into any other noticeable performance regressions yet. TODO: - Implement actual user title preferences - Add the correct 'lang' HTML attributes everywhere a title is displayed (we do have the information now, though it still isn't trivial) - Add title fetching support to API
2021-11-21Discussions::Elm: Fix case-insensitivity in user board searchYorhel1-1/+1
2021-11-20Discussions::Elm: Improve board search a bitYorhel1-23/+20
Both in the quality of the results and query performance. The performance boost wasn't as significant as I had hoped, but it's something.
2021-11-15Discussions::Search: Add reviews & review comment searchYorhel1-25/+44
2021-11-15Discussions::Search: Use Postgres websearch_to_tsquery() for better query ↵Yorhel1-8/+6
parsing
2021-11-07Add mod option to set deletion reason for forum postsYorhel4-12/+15
2021-11-07Add mod option to lock the boards for a threadYorhel1-16/+21
2021-07-19Remove hidden items in discussion board autocompleteYorhel2-6/+6
2021-06-13Discussions::UPosts: Show hidden posts to modsYorhel1-8/+8
2021-03-23cleanup: Fully remove old "type" argument to framework_()Yorhel2-2/+2
The type of the dbobj can be inferred from its id now that we use vndbid's for all database entries.
2021-03-01SQL: vndbid data type conversion for most DB entriesYorhel8-28/+27
I had wanted to split this up into multiple commits and roll out in stages, but couldn't really find a natural way to do so. There are several places that take a generic identifier and expect it to work the same for all entries they support, so changing one entry at a time wasn't going to be any easier. Only the tags & traits haven't been updated yet, I'll convert those later. While this is a major change and affects a lot of code, the individual changes are all pretty simple. I'm surprised how much code did not have to be updated at all. No doubt I've missed a few places, though, so this commit will almost certainly break something.
2021-01-29Discussions::Thread: Remove report link on deleted postsYorhel1-1/+1
https://vndb.org/t2520.537
2020-10-08notifications: Add subscription management UI + finalize DB migrationYorhel1-1/+1
Seems to be working so far. I'll find the actual bugs in production.
2020-10-07notifications: Mark as read when opening page + delete when deleting ↵Yorhel3-6/+5
posts/reviews The mark as read functionality was already present in some form for threads, but is now made consistent among all notification types. This removes the need for the redirect from the notification listing. The deletion of notifications is intended to avoid pointless notifications, especially in case of spam.
2020-09-05Notifications: Modernize SQL schemaYorhel3-3/+3
By removing the ltype, using the vndbid type, renaming 'subid' to 'num' (as used elsewhere) and removing the reference to uid=0.
2020-09-02BBCode: Consolidate bb2html & bb2text + only convert ids in thread titlesYorhel2-3/+3
Fixing bb2html to only convert ids would complicate options a lot, adding a new formatting function to only convert ids would make sense, but then all formatting functions kind of look alike, so I figured a single bb_format() to support all use cases may be a better approach. Trigger for this was that people do (understandably) put [spoiler] in thread titles, and that should not be interpreted as the spoiler tag.
2020-08-31Discussions/Reviews: Return 404 when requested post or comment does not existYorhel1-1/+1
2020-08-24reviews: Get rid of summary field & split mini/full reviewsYorhel1-1/+1
Much to my disappointment, people don't write proper summaries and, as such, summaries are not useful to be considered a "short review" on their own right. This necessitates splitting the reviews onto different pages.
2020-08-19reviews: Count & list review comments as posts on user pageYorhel1-12/+18
2020-08-18Discussions::Edit: Fix permission check when editing threadYorhel1-1/+1
Oh man, the can_edit() interface is way too obscure when it comes to threads and posts.
2020-08-16Reports: Get rid of report_type, split vndbid/num + allow reporting reviews ↵Yorhel1-1/+1
and comments rtype is not necessary, the DB identifier is sufficient. The separate type column was supposed to simplify DB lookups (but that's all consolidated in a single function anyway, so it didn't help much) and easy filtering depending on what mods have access to (but there is no such filter, and even with vndbids that should be easy enough). Converting the object ID into a vndbid + num should make it easier to correlate reports if necessary.
2020-08-16Discussions: Split post editing out of Discussions::Edit + support editing ↵Yorhel2-54/+127
review comments This split simplifies Discussions::Edit a little bit and allows Discussions::PostEdit to be generic enough to handle editing review comments as well.
2020-08-14reviews: Add schema & display for commentsYorhel1-1/+2
Not really sure how to integrate and handle this, to be honest. I'll just play around and see what works.
2020-08-07Discussions: Fix handling of user deletionYorhel3-4/+4
Which I broke by removing the DEFAULT clause on threads_posts.uid. That column still used the old uid=0 for deleted users rather than the uid=NULL that I was planning to migrate the entire DB to. So while I'm fixing up the threads schema, may as well update this too. There's still a bunch of columns relying on uid=0, but I can fix that later.
2020-08-06Discussions: Fix emulation of location.hashYorhel1-1/+1
Setting location.hash directly has the downside of adding an entry to the browser's history, which is annoying.
2020-08-06Discussions: Don't show deletion button when creating a new threadYorhel1-1/+1
Both pointless and wrong.
2020-08-06Discussions: Allow discontinuous post numbers + ignore hidden posts in ↵Yorhel3-15/+12
counts/lastpost This solves a few problems: - 'hidden' posts will no longer cause the thread to be bumped to the front page. - Deleting posts will no longer cause other posts to be renumbered (and hence will not break existing links to posts) - Numbers of deleted posts will no longer be re-used (except when they were the last post in the thread - fixing this would require an additional column in 'threads', but it didn't seem worth the trouble)
2020-08-06Discussions: Make /t#.# load the correct page without redirectYorhel3-20/+10
This removes the need for the post_url() function. This is a small step towards supporting non-continuous post numbers.