Commit Graph
375 Commits
Author SHA1 Message Date
evazion e16ae00efc Fix hardcoded http:// urls. 2018-04-19 00:45:10 -05:00
Albert Yi d9d98f05c2 Merge branch 'rails-5.1' 2018-04-11 11:40:36 -07:00
Albert Yi 485c3b01c7 add uploader-id and top-tagger-id data attrs to post previews 2018-04-09 11:12:07 -07:00
r888888888andevazion abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
Albert Yi 6c790c61d3 replace uploader information post previews and comment listing, rename tagger to top tagger 2018-03-27 10:49:41 -07:00
evazion 41a4ff15cd posts: remove unused file path / url methods.
* Remove file_path_for, cropped_file_url (dead code)
* Remove complete_preview_file_url (preview_file_url now returns absolute links)
* Remove `file_name` (only used for Download link in sidebar)
2018-03-20 19:49:55 -05:00
r888888888 3657cacd17 * post keeper is calculated synchronously
* add fallback mechanism in case archive service is not up
* pass along most recently added tags to any keeper calculation
2018-03-08 16:00:44 -08:00
evazion 88f4a56890 Fix #3497: Invalid DText denial of service attack. 2018-01-14 16:14:18 -06:00
evazion b711566c14 Fix #3438: Thumbnails on user profiles don't respect safe mode. 2017-12-19 13:58:41 -06:00
Albert Yi 850ac353ed Merge pull request #3399 from BrokenEagle/fix-gold-safemode-message
Changed safe mode error message for Gold+ users
2017-12-13 14:26:50 -08:00
BrokenEagle 839f0f653f Changed safe mode error message for Gold+ users
- Made explicit the error messages and their order
- Banned takes priority, then Gold+, then Safe
- Made the groups exclusive of each other
2017-12-05 19:08:01 -08:00
evazion aeb24b6253 Fix "Similarity: %98" -> "Similarity: 98%". 2017-11-25 16:50:12 -06:00
r888888888 70e592e823 round similarity score on post presenter 2017-11-21 10:25:12 -08:00
r888888888 42c9c71a5f fixes #3306 2017-11-17 14:29:59 -08:00
evazion 56bf518e6d Fix #3371: Add CSS classes to tag categories in the split tag list. 2017-11-14 19:51:47 -06:00
Albert Yi 0674a03fb6 Merge pull request #3353 from BrokenEagle/feat-add-meta-tag-category
Migrated tag logic into config file and added fifth tag category meta
2017-11-13 11:44:15 -08:00
r888888888 8b1fca4662 add most viewed posts page 2017-11-10 16:21:01 -08:00
r888888888 8458c62e8a eliminate month scale for popular searches (takes up too much space in redis) 2017-11-10 15:40:10 -08:00
BrokenEagle 6838901aac Moved non-config tag category info to its own class 2017-11-07 16:21:29 -08:00
BrokenEagle 1e5540f3a0 Moved most of the tag category config logic to the config file
-Fixed an unused Post class method (fix_post_counts) that didn't have a parameter
2017-11-06 15:27:54 -08:00
r888888888 7ba7458897 fix syntax error 2017-09-12 15:43:47 -07:00
r888888888 4fb55657c0 refactor cropped images into explore/posts/intro 2017-09-12 13:03:59 -07:00
r888888888 68863ed018 fixes #3287 2017-09-08 15:01:12 -07:00
r888888888 63f7edd0c6 add toggle for testing cropped thumbnails 2017-09-06 17:02:43 -07:00
evazion 1ef363dd68 upload limits: add time remaining until next upload to profiles (fix #3262). 2017-08-10 23:58:58 -05:00
evazion bf3101da48 upload limits: show how upload limits are calculated in profiles.
* Allow mousing over the upload limit on profile pages to show the full
  formula for the upload limit calculation. In particular, show how the
  upload limit multiplier is derived from the deletion confidence.

* Refactor to avoid duplicating upload limit calculations in the
  presenter, as much as possible.
2017-08-10 23:48:50 -05:00
evazion 40e006f7cb Fix keyboard navigation in pools (#3238).
Don't display the search navigation bar when browsing pools. Doing so
breaks the A/D keyboard shortcuts because the search navigator takes
precedence over the pool navigator.

https://danbooru.donmai.us/forum_topics/9127?page=195#forum_post_134297
2017-08-04 19:28:36 -05:00
Albert Yi 05a25a6baf Merge pull request #3239 from evazion/fix-md5-leaks
Fix censored post exposures in data attributes / legacy API (#3237)
2017-07-26 17:09:18 -07:00
evazion f2bf756422 Fix hidden attribute leaks in data attributes (#3237). 2017-07-24 20:35:12 -05:00
evazion 0129891213 Fix #1156: Allow sequential search navigator to work without a search. 2017-07-24 19:30:30 -05:00
evazion 1b310dcc0b Post#expunge!: fix remove_from_all_pools to clear deleted pools.
* Change Post#pools to return all pools, including deleted pools. This
  fixes remove_all_from_pools to remove the post from deleted pools too.

* Change other users of Post#pools to explicitly select undeleted pools.
2017-07-21 00:13:20 -05:00
evazion 7cb7c2fbab Remove ruby DText implementation (#3206). 2017-07-19 16:48:42 -05:00
evazion 4c61e547b9 posts: add data-is-favorited attribute to thumbnails. 2017-05-23 11:53:04 -05:00
evazion a3db5ba346 post replacement: move presenter methods to post_replacement.rb. 2017-05-17 00:14:41 -05:00
evazion d40da8c5c9 post replacement: leave a system comment after replacement. 2017-05-05 16:10:43 -05:00
r888888888 3b414db844 defer to popular searches for popular tag list 2017-05-01 17:56:34 -07:00
evazion 8404064854 related_tag_calculator.rb: fix memcache lookup in inner loop.
Remove the category constraint option from RelatedTagCalculator.calculate_from_posts.
It slows things down and isn't used.

This method is used to calculate the related tags sidebar during
searches for single metatags. Using Tag.category_for in the inner loop
caused a memcache call on every iteration. At 100 posts per page and
20-30 tags per post, this led to up to 2000-3000 total memcache calls,
which significantly slowed pageloads.
2017-04-23 17:10:20 -05:00
r888888888 97da8f8647 deprecate tag subscriptions with warnings 2017-04-14 16:00:20 -07:00
evazion 26e8b7144a Fix exception in h(post.source) when source is nil (fixes #2940).
Fixes this exception:

    TypeError exception raised

    no implicit conversion of nil into String
    app/presenters/presenter.rb:3:in `escapeHTML'
    app/presenters/presenter.rb:3:in `h'
    app/presenters/post_presenter.rb:91:in `data_attributes'
    app/presenters/post_presenter.rb:24:in `preview'
    app/presenters/post_set_presenters/base.rb:15:in `block in post_previews_html'
    app/presenters/post_set_presenters/base.rb:14:in `post_previews_html'
    app/views/posts/partials/index/_posts.html.erb:3:in `_app_views_posts_partials_index__posts_html_erb___2716396856929289512_70158315986180'
    app/views/posts/index.html.erb:39:in `_app_views_posts_index_html_erb__1345252938355811220_70158296799280'
    app/controllers/posts_controller.rb:16:in `index'
2017-03-25 23:43:20 -05:00
evazion 0793beded9 alias_and_implication_list: refactor alias/implication lookup.
Add alias and implications associations to Tag. Use them in
alias_and_implication list instead of duplicating the alias/implication
lookup code.
2017-03-23 02:47:21 -05:00
r888888888 19a82bde30 fix syntax error 2017-03-22 14:24:06 -07:00
evazion d1debecd0b Fix XSS in post thumbnail data attributes. 2017-03-21 17:17:19 -05:00
r888888888 91c21b1bac fixes #2880: Change link from User page "Comments in xxxx posts" to comment_bumped 2017-03-21 14:05:32 -07:00
Albert Yi 92fe0c7b7c Merge pull request #2922 from evazion/fix-artcomm-fetch-source
When merging artcomms, list source as html page url, not image url.
2017-03-20 12:22:18 -07:00
r888888888 5cef0321f2 switch to use Cache.get_multi for tag types 2017-03-17 18:36:53 -07:00
evazion 2051981170 When merging artcomms, list source as html page url, not image url. 2017-03-16 18:09:59 -05:00
r888888888 da06bee0ab revamp saved search implementation 2017-03-15 15:36:48 -07:00
evazion b80976bce7 modqueue: link tags, like they are in /comments. 2017-02-24 21:03:14 -06:00
r888888888 aa41c41572 fixes #2876: Changing approver/contributor privileges should log mod action 2017-02-14 12:46:54 -08:00
r888888888 ed8a8001f4 fixes #2859: search:uncategorized should search for uncategorized saved searches 2017-02-14 11:58:43 -08:00