summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2019-12-30Minor refactor: Use TUWF::Validate's onerror clause for GET parametersYorhel9-29/+29
This allows for proper use of parameters that do validate while using defaults for those that don't. Also removes the need for error handling and potential duplication of default values. Requires latest TUWF git, so rebuild the docker image if you use that.
2019-12-30Discussions: Discourage necroing old and inactive threadsYorhel1-6/+10
2019-12-30Merge branch 'ulist'Yorhel54-6262/+408
2019-12-30ulist/API: Fix bug with "get wishlist" reporting high prio as mediumYorhel1-1/+1
2019-12-30Actually, let's get rid of v3 now that it doesn't work anymore anywayYorhel36-5220/+0
2019-12-30ulist: Remove remnants of old votes/vnlists/wlists tablesYorhel1-17/+0
2019-12-29ulist: Display labels on VN browserYorhel2-1/+10
Replaces the old "wishlist status" column that I removed earlier. It's kind of awkward, but at least the functionality still exists now.
2019-12-28ulist/API: Make (get|set) (votelist|vnlist|wishlist) commands work with new ↵Yorhel1-38/+77
ulist tables I made an attempt to be as backwards-compatible as possible, but this does introduce some weird and hard-to-fix behavior that didn't exist before. In particular: - Removing a VN from the votelist or wishlist will make it show up on 'get vnlist'. - Removing a VN from the vnlist will also remove it from the votelist and wishlist. - set wishlist status only works if the appropriately-named labels exist. Renaming the converted labels will break and these labels aren't created for new users.
2019-12-24ulist: Delete old lists code and redirect old URLsYorhel3-756/+11
2019-12-24ulist: Add list management widget on VN pagesYorhel4-41/+50
Minimal version. It reuses the LabelEdit and VoteEdit widgets, but doesn't allow setting a note or start/finish date at the moment. VN pages now have both v2rw.js and the old vndb.js; Those two scripts aren't meant to be used together on a single page, so I'm hoping this will be temporary. I removed the 'checkall' handling from vndb.js as that might conflict. It's only used on the old list pages anyway.
2019-12-22ulist: Update "My lists" VN filters to use new ulists featureYorhel2-15/+7
This is just a simple backwards-compatible port, proper integration should allow one to filter on individual labels. The "On my VN list" filter now works slightly differently in that it considers *everything* in ulist_vns to be on the users' VN list, including votes and wishlist. I've removed the option to display a "Wishlist" column. The wishlist works rather differently now, maybe this should instead just display all assigned labels - but that would consume quite a bit of space. :(
2019-12-22ulist: Use new lists for VN vote stats & listingYorhel4-18/+90
To my surprise, I actually managed to achieve acceptable performance by just adding two indices. I totally expected I'd have to keep a cache column in ulist_vns whether the row is private or not. The partial index on the users table in fact improves the performance of the vote graph query. A covering index improves that even further, but that requires Postgres 11+, which the Docker image doesn't have yet (and isn't all that crucial anyway). There's a rather annoying potential for confusion regarding the private flag on votes. The user page & list stats only look at whether the 'Voted' label is private, whereas the VN stats use the "proper" approach of checking for any public label. Not entirely sure which of the two is more intuitive.
2019-12-20ulist: Fix bug when user only has "no label" VNsYorhel1-1/+1
2019-12-20ulist: Allow usermod access to listsYorhel1-8/+14
2019-12-20ulist: Remove deprecated hide_list user preferenceYorhel4-9/+5
Old VNDB::* code still uses that preference in a few places, that needs to be fixed.
2019-12-20ulist: Update user pages to source stats from the new lists featureYorhel1-26/+44
2019-12-20Discussions::Thread: Ignore poll votes from ign_votes usersYorhel1-2/+3
2019-12-19ulist: Update user list with vnlist/votes/wishlist statsYorhel4-45/+47
This adds the users.c_vns and c_wish columns and a function to update the cache. Unlike my previous cache update approaches, I did not use SQL triggers here, as that seemed more complex and less efficient than updating the cache manually. That's not to say that I'm happy with the current approach, but meh... The cache update function is not automatically run for all users, but that could be added to Multi::Maintenance if it turns out that the cached values will not be updated properly in some cases.
2019-12-19Multi::Denpa: Incrementally fetch shop info by handle lookupYorhel1-43/+39
Rather than fetching the entire shop inventory as a single JSON, which doesn't work anymore now that Denpasoft has more products than its API allows you to fetch. Pagination support is kinda meh. The handle lookup method works fine and is also what we do with other shops.
2019-12-17ulist: Get rid of BETA warning, update menu and tab linksYorhel2-64/+59
Decided to go with option presets (e.g. '?wishlist=1') rather than add the full list of options to each link. Makes it easier to maintain and keeps URLs for basic pages short. As a result of that, I had to fix ColSelect.elm to not read the current URL but instead get the URL passed by Perl. Fortunately, it looks like the Erl package can deal with partial URLs (only the query string, in this case) just fine.
2019-12-16ulist: Convert vn.c_* vote stat updating to use ulist_vns tableYorhel1-12/+2
It turned out that naively changing the existing queries to refer to ulist_vns with a (WHERE vote IS NOT NULL) made them ultra slow (like, DNF-slow), for a reason I haven't been able to figure out yet. I had to rewrite the queries to use CTEs and in doing so figured that I could get an extra performance improvement by combining the popularity and rating updates in one query. The combined update function now runs faster than the old queries.
2019-12-16Discussions::Index: Add "Start a new thread" linkYorhel1-0/+3
For convenience and consistency with the board view.
2019-12-16Minor refactor: Make better use of SQL::Interp for INSERT INTO clausesYorhel3-32/+32
It's like I forgot halfway through that SQL::Interp has special, and very useful, syntax for inserts This also reduces the number of queries in Discussions::Edit a bit, as there's no more need for the INSERT-followed-by-UPDATE hack.
2019-12-12v2rw: Discussion board editing & thread creationYorhel9-414/+241
Now with BBCode preview, interactive board search, client-side error reporting and lots of new bugs. This took me far too long, turns out it wasn't such a trivial rewrite.
2019-12-10Elm: Add Redirect response + fix redirect to last post on replyYorhel4-13/+6
Fixes https://vndb.org/t2520/14#334 - I originally had some trouble to do this because `load` doesn't actually reload the page if you're just changing the hash. The `reload` following it handles that now. The Redirect response is just cleanup, there's several places that could benefit form it.
2019-12-09Add SubscribeStar buttonYorhel1-2/+7
2019-12-08Discussions::Thread: Show deleted post author & date to boardmodsYorhel1-1/+1
The username used to be visible to mods when hitting the edit button. Now that I'm rewriting the edit form I'm removing the username display field (it's not something you can edit, after all), so I'm moving the information to the thread, where it belongs.
2019-12-08Fix json_api() URL matching + move URL parameters to POST bodyYorhel9-23/+23
For more consistency. Only exception right now is the password reset form, which still has parameters in the URL. Didn't convert it as that code doesn't use the elm_form() framework at the moment.
2019-12-08Discussions: Add exception for uid 2 in sql_visible_threads()Yorhel1-0/+1
Turns out the recent update didn't allow me to moderate private threads anymore. :( I decided not make it a boardmod feature this time, one person for moderating private threads is enough.
2019-12-07ulist: Display useful message when list is empty or privateYorhel1-5/+10
2019-12-05v2rw: Convert thread reply form to ElmYorhel1-17/+33
So we can apply the new preview functionality. I got rid of the "Go advanced" button, because there's really nothing advanced about it.
2019-12-05ulist: Add search box + tabindex on filter input fieldsYorhel1-6/+10
2019-12-03API: Add labels field to "set ulist"Yorhel1-1/+15
2019-12-03API: Add "set ulist" commandYorhel1-0/+44
TODO: - Managing labels - Assigning labels to VNs Not yet sure what the API for the latter should look like.
2019-12-03API: Add "get ulist-labels" and "get ulist"Yorhel1-3/+77
To directly query the new list feature. I'll migrate the old vnlist/wishlist/votelist APIs later to query the 'ulist' tables.
2019-12-01Discussions: Do not highlight post when nagivating to the "last post"Yorhel4-6/+13
That behavior was more distracting, especially when the intention of the link isn't to link to that post in particular, but just to the more recent part of the thread. As an additional advantage, this doesn't rely on the t#.# redirect anymore, this making browsing the forums slightly faster.
2019-12-01v2rw: Convert thread display + poll votingYorhel6-224/+256
I did not reimplement the 'poll_recast' and 'poll_preview' settings, these actions are now always permitted. Updated CSS a little bit to highlight the linked post and fix the double border at the bottom. The nice thing about the sql_visible_threads() function I wrote earlier is that is can also be used for access control on a single thread. More code re-use. \o/
2019-11-28ulist: Fix display of vote date when not votedYorhel1-1/+1
2019-11-27ulist: Add column selection + voted, modified, release date & rating columnsYorhel3-28/+79
It works pretty well, but Lists.pm is getting *really* ugly now. :(
2019-11-27CSS: Less hacky .maintabsYorhel5-155/+98
Flexbox instead of floats. Apart from that, it's still very hacky. Uses relative positioning in order to overlay 1px over the .mainbox. This should fix the ages-old 'bottom tabs overlay next mainbox' bug and provide more flexibility with adding a top-level <fieldset> or centered buttons.
2019-11-27Multi: Fix parsing of ExtLinks.pm when TUWF::XML isn't loadedYorhel1-1/+1
2019-11-23ulist: Add some test menu linksYorhel1-0/+8
2019-11-23ulist: Make labels column sortableYorhel1-17/+18
This is pretty slow for large lists, but let's just see how it goes.
2019-11-19ulist: Keep sort column when updating filtersYorhel1-0/+2
2019-11-19Increase CSRF token validity window to 12 hoursYorhel1-4/+2
People leave their window open for a while, and that's fine.
2019-11-19ulist: Remove the notes iconYorhel1-1/+0
It's redundant. The goal was to make the notes feature more prominent so it'd stand out more, but in hindsight it seems more like a distraction.
2019-11-19Minor refactor: Use dbPage() in scalar context where applicableYorhel4-5/+5
Requires the latest git version of TUWF.
2019-11-19Discussions: Fix index linkYorhel1-1/+1
2019-11-19Fix consistency between discussion counter in the dbentry tabs and actual ↵Yorhel2-6/+10
listing i.e. private and hidden threads are now included in the counter if you can see those threads.
2019-11-19v2rw: Convert discussion board listings + change link structure a bitYorhel5-132/+84
A board-wide "tab"-like structure rather than breadcrumbs, has a more consistent feeling.