Commit Graph

79 Commits

Author SHA1 Message Date
Nicolas F 8614da6322 view.html: fix comment text copypasting in Firefox
Firefox would insert a lot of weird whitespace, because its
user-select would default to "all" and not "text", so it copypastes
the whitespace of otherwise completely invisible HTML elements.

I don't know why Firefox does this. It's stupid, and not what the
user expects. They're copying what they see, not what the DOM is.
2019-04-30 23:12:11 +02:00
Alex Ingram 75e7e942fb Fix some JOIN insanity with SQLAlchemy. 2019-04-08 19:18:11 +02:00
Nicolas F 6a63ee241a templates: cache torrent view filelist (#542)
* templates: cache torrent view filelist

Using flask-caching, we can add a 1 hour cache to the template
output of a filelist, varying it by the key "filelist" + the
hex infohash of a torrent.

Using a very big filelist as a test, I get a difference in page
load speeds of about a magnitude. (400ms -> 37 ms)

* templates: increase filelist cache to 24 hours
2019-03-08 06:29:51 -08:00
Nicolas F 51192342a6
view: fix template throwing exception on edge case (#549)
If a user has a comment under the edit time limit in a comment
locked torrent, but also are still affected by the new account CAPTCHA
cooldown, the template would throw an error as we tried to getattr on
a None object (namely, the comment_form).

To fix this, we also need to check around the edit form whether the
comment_form exists.
2019-02-24 15:03:38 +01:00
doge 3190394eea Comment Hiding
This commit adds the ability hide comments on torrent pages, and a user
preferences tab to allow registered users to make this the default
behavior.
2018-11-20 13:45:31 +01:00
Nicolas F f04e0fd2ae comments: fix editing for users with a CAPTCHA (#502)
* comments: fix editing for users with a CAPTCHA

My bad!

* Update help.html
2018-06-16 16:57:14 -07:00
Arylide 03094b6d36 Commit editing time 2018-04-02 13:18:39 -07:00
Nicolas F 60ce4ec3f1 Implement comment locking (#439)
* Implement comment locking

This adds a new flags to torrents, which is only editable by
moderators and admins. If checked, it does not allow unprivileged
users to post, edit or delete comments on that torrent.

* Rename "locked" to "comment_locked".

* Shorter button and additional words on alt text

* Admin log: Change comment locking message

dude I love bikeshedding xd

* Bikeshedding over admin log messages

* >&
Also some bikeshedding
2018-03-25 17:03:49 -07:00
Arylide 0b98b2454a New help section for IRC and some prod changes I never put in the repo because lazy. 2018-02-22 23:23:53 -08:00
Nicolas F 0285c12264 commenting: show CAPTCHA to new accounts (#443)
Basically re-use the upload CAPTCHA code to also do this for
comments.
2018-02-01 10:50:00 -08:00
TheAMM e183d420ea Fix CF-stripped newlines for comments 2017-11-10 05:50:57 +02:00
TheAMM faf7548cd0 Convert edited timestamp to local time 2017-11-10 05:50:50 +02:00
Shane 72c997173c [Schema+config change] Comment editing (#396)
* Comment editing
* Optional time limit for comment editing
2017-11-05 16:26:30 +02:00
Nicolas F 214952e7b6 Disable report button on empty reason (#374)
Previously, people couldn't quite tell you needed to give a report
reason. Now we disable the submit button until there is a reason,
and flask.flash() if someone manages to submit an empty reason
anyway.
2017-10-03 17:03:22 -07:00
nyaadev 0bcd782695 Minor improvements 2017-08-15 01:41:31 +02:00
Kfir Hadas 93f94023d1 Move delete_comment and submit_report into blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas ef56e54521 Move torrent magnet and torrent download into 'torrents' blueprint 2017-07-27 14:14:00 +03:00
Kfir Hadas 9fef343c1b Move torrent edit and upload into 'torrents' blueprint
Move supporting functions and variables into other files
* nyaa.views.torrents:
  - _create_upload_category_choices
* nyaa.backend:
  - get_category_id_map
2017-07-27 14:14:00 +03:00
Kfir Hadas eccb0ebdff Move '/' and '/rss' routes into 'main' blueprint
and update templates.
2017-07-27 14:14:00 +03:00
Kfir Hadas 0887dde6fc Move /user/<user_name> route into a blueprint
Move supporting functions and variables into other files
* nyaa.utils:
  - cached_function
  - chain_get
* nyaa.search:
  - DEFAULT_MAX_SEARCH_RESULT
  - DEFAULT_PER_PAGE
  - SERACH_PAGINATE_DISPLAY_MSG
  - _generate_query_string
2017-07-27 14:14:00 +03:00
Kfir Hadas 911fbc317f Move static routes into a blueprint
and update templates

Routes:
* /help
* /rules
* /xmlns/nyaa
* /about (commented out)
2017-07-27 14:14:00 +03:00
Nicolas F f1df776410 Add alert about reports that nobody will read
Apparently some people don't understand what the report button
is for. Adding this small warning can be considered a success even
if it just leads to one less stupid report.
2017-06-27 14:40:58 +02:00
Kfir Hadas 94574d1682 Hide "Report" button for site guests (#265) 2017-06-14 20:07:53 +03:00
Kfir Hadas c70a60b719 UI Fixes (#246)
* Fix markdown renderer

Use a simple for loop instead of `for (var target of markdownTargets)`, because it's unsupported in IE.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#Browser_compatibility

* view.html : HTML Fixes

- Remove unmatched `</a>`
- Add missing `</div>`
- Use single quotes in {{ }}
- Closing tags comments

* layout.html

- Use single quotes in {{ }}
- Closing tags comments

* help.html: Convert all `<p>` to `<div>`

HTML spec doesn't allow lists inside `<p>` elements.

* Missing semicolon in `<script>`
2017-06-05 20:23:30 -04:00
Alex Ingram 0a12db74d0 Change report button to btn-xs as a temporary fix. 2017-06-05 00:45:50 -05:00
ReimuHakurei 3e2437bba1 Fix merge mistake. 2017-06-01 11:37:50 +00:00
Alex Ingram b5e70ba0b0 Merge branch 'master' into focus-report-field 2017-06-01 06:30:34 -05:00
TheAMM 505b4e18bd Move to markdown-it, render markdown in DOMContentLoaded
No more separate <script>s for comments
Adds a link to a GFM cheatsheet on markdown form
Spaces to tabs on "markdownEditors" DOMContentLoaded
2017-06-01 06:28:38 -05:00
Nicolas F 07d45b6223 Focus report reason text field when reporting
A small convenience change which by sets the focus to the newly
opened modal dialog's text field if the report button is hit.

This way, people can type away their gripes with the torrent without
having to click into the text field first.
2017-05-30 19:31:28 +02:00
nyaazi bea63315cd Merge branch 'master' into reports 2017-05-29 16:20:48 +03:00
TheAMM 32fa021f34 Turn comments icon on search result into link to comments
Also cleans up torrent.id/torrent.meta.id
2017-05-28 02:46:04 +03:00
nyaazi 5332ba1a49 Merge branch 'master' into reports 2017-05-26 15:25:02 +03:00
shm0o 8b7712b1d0 templates/view.html: use url_for for the 'edit_torrent' endpoint 2017-05-25 19:33:47 -04:00
TheAMM 3f49f17baa Add simple OG metadata tags to templates
Hello, #185
2017-05-26 01:03:59 +03:00
Kfir Hadas 559602d19b Fix inverted icons in file list 2017-05-25 22:16:12 +03:00
Anna-Maria Meriniemi 0394639954 Calculate comment age clientside, show timestamp in mouseover title (#191)
Resolves outdated comment ages thanks to caching and will show timestamps in local time.
2017-05-25 21:13:35 +03:00
Kfir Hadas e91fdb70da Strip collapse functionality from file list panel 2017-05-25 16:41:07 +03:00
Kfir Hadas ae4d75ecde Show first level's items based on amount
Currently set to show when list has 20 items or less
2017-05-25 15:16:29 +03:00
Kfir Hadas a64cac5e5e Basic collapsible file tree 2017-05-25 12:53:23 +03:00
TheAMM b09c61980c Add new route for torrent download, fix Content-Disposition
New route is `/download/<torrent_id>.torrent`, which will help people using tools that do not consider headers.
Old torrent download route still works.
Updated one remaining link to use url_for.

Added plain `filename="..."` to `Content-Disposition`, since it is still the most common standard with percent encoded UTF-8.
Fixes part 2 of #45
2017-05-25 11:15:45 +03:00
aldacron d5e2311c56 Resolves #181 2017-05-24 23:25:21 -07:00
TheAMM 0e89d3f24b Show torrent hash on torrent page 2017-05-24 17:17:51 +03:00
ReimuHakurei 3418cb6175 More validation. 2017-05-24 06:45:00 +00:00
ReimuHakurei 42928c2a41 More validation. 2017-05-24 06:19:15 +00:00
nyaadev 020a0871bd fix #173 and add avatar to mod user info
add rank color to username everywhere
some other minor changes
2017-05-24 00:28:17 +02:00
nyaadev f32d1a0c64 use enumerated index for comment anchors 2017-05-23 02:59:31 +02:00
nyaadev af61e5b1e9 some html + css changes around comments 2017-05-23 02:47:20 +02:00
nyaadev 3fc347d049 Move posting comments to view_torrent to fix displaying form errors. 2017-05-23 00:04:27 +02:00
nyaadev b7144f80f9 Make comments great again. 2017-05-22 23:38:06 +02:00
snowfag aab3eaccaa Spruce up comments. 2017-05-22 23:20:52 +02:00