Commit Graph
136 Commits
Author SHA1 Message Date
evazion 309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion a2ea2a65a1 db: drop IP addresses from certain tables.
Don't track IP addresses for post appeals, post flags, tag aliases, tag
implications, or user feedbacks. These things are already tightly
limited. We don't need IPs from them to detect sockpuppets.
2019-11-17 02:45:28 -06:00
evazion 72f17fd1de Fix #3534: Remove Janitor Trials. 2019-11-17 02:10:24 -06:00
evazion 364ecfe68f db: drop unused columns from users table.
Note that the password_hash column was replaced by bcrypt_password_hash
in 2013, but the old password_hash column was never dropped.
2019-11-16 19:34:30 -06:00
evazion f4376fc7a3 post votes: add index page. 2019-10-28 03:21:18 -05:00
evazion 0e159960a2 forum post votes: add index page. 2019-10-28 01:06:23 -05:00
evazion a0b6c9b116 wiki pages: drop creator and updater fields.
Drop the creator_id and updater_id fields from wiki pages. These fields
had several issues:

* The creator_id field was inconsistent with the wiki_page_versions
  table. Apparently during the migration to Danbooru 2 in 2012-2013 the
  creator_id field got reset to whoever last updated the wiki at that
  point in time.

* Saving a wiki would set the updater_id even when nothing actually
  changed. This also caused the updated_at timestamp to get bumped.
  Because of this, anything that saved a wiki, including things like
  creating aliases or implications, would bump the updater_id and
  updated_at even though the wiki didn't actually change. This meant
  these fields weren't consistent with the wiki_page_versions history.

Changes:

* Remove `creator_name` field from the /wiki_pages.json API.
* Remove creator name search option from /wiki_pages/search.
2019-10-24 19:48:30 -05:00
evazion 3b63f94968 user name changes: remove unused reason, status fields.
Remove all infrastructure around approving or rejecting user name
changes. Name changes haven't been moderated for several years.

* Remove status, approver_id, change_reason, and rejection_reason fields.
* Remove approve and reject controller actions.
2019-09-25 21:43:01 -05:00
evazion 6b8515811f tags: drop related_tags column. 2019-09-07 22:21:55 -05:00
evazion 7316f41d1d Fix #4106: Allow moderators to IP ban subnets. 2019-08-12 02:12:56 -05:00
evazion 7c8c4e9f82 tests: fix null uploader_ip_addr exceptions in create(:post).
Caused by a change in FactoryBot 5. Associations in factories are now
constructed using the same strategy as the base object, meaning that
using `build` to construct an object will also construct the
associations using `build`. This meant that overriding `create` to do
`build` + `save` broke the way that associations were constructed.

https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations
2019-08-04 12:43:12 -05:00
Albert Yi 04edc3f533 update factories + tests 2019-05-10 17:31:07 -07:00
evazion 44a54f75cd tests: don't automatically approve aliases/implications on creation.
Automagically approving inactive aliases makes testing more difficult.
2018-12-31 17:07:14 -06:00
evazion f5012464ab Fix #3965: Extraneous API attributes.
Remove the updater_id/updater_ip_addr virtual attributes from
pools/notes. Juss pass them in as params to create_version instead.
2018-10-30 15:41:17 -05:00
Albert Yi fdd7582fb0 add support for upload preprocessing 2018-06-14 17:52:41 -07:00
Albert Yi 9310b39fda hide forum votes if the request is not pending 2018-05-11 17:05:26 -07:00
Albert Yi c144159dd9 fix tests 2018-05-09 14:36:03 -07:00
evazion 7c1d5e25fb post approvals: add index page + search options (fix #3579). 2018-05-05 14:00:49 -05: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
evazion d089be9f8a tests: fix upload tests. 2018-03-20 19:49:58 -05:00
r888888888 e70c2a3085 remove references to tag subscriptions 2017-11-17 13:45:17 -08:00
evazion 3b3abac8f6 pools: disallow asterisks and numeric-only names. 2017-08-10 18:37:22 -05:00
evazion ef76ec0385 uploads: fix upload failure when given nil source (fix #3168). 2017-06-17 08:31:44 -05:00
Albert Yi 6ddf0821d8 Merge pull request #3055 from evazion/feat-post-replacement-controller
Add post replacements controller.
2017-05-15 16:19:34 -07:00
evazion cb09b6661d Add /post_replacements.json, /posts/1234/replacements.json. 2017-05-14 18:49:57 -05:00
evazion 087ce001e7 user name changes: don't force new name to lowercase. 2017-05-14 09:53:49 -05:00
evazion 19e91f438b bans: add test for logging in with expired ban. 2017-05-07 12:13:25 -05:00
Albert Yi 590bfa18f6 Merge pull request #3005 from evazion/fix-ss-query-normalization
Fix #2995: Saved searches’ tags are getting reordered
2017-05-01 14:51:01 -07:00
r888888888 48e9856f37 fixes #3007: Eliminate Janitor role 2017-05-01 14:38:30 -07:00
evazion 8e5491a536 saved searches: add query normalization tests. 2017-04-28 16:26:44 -05:00
r888888888 19b8d41d09 refactor forum notifications for tag changes 2017-04-12 16:43:15 -07:00
r888888888 d9a26975ba fix tests 2017-03-15 16:08:47 -07:00
evazion d852f98e4f /dmails: remove unused search[owner_id] param.
/dmails is restricted to viewing dmails for CurrentUser only (due to
Dmail.visible in the index action). Remove owner_id from subnavbar links
in /dmails, and don't support it in /dmails?search[owner_id], since it
doesn't actually do anything.

Also removes related dead methods and fixes tests that didn't test owner_id properly.
2017-02-23 22:51:17 -06:00
r888888888 6c9d5e4f9a remove advertisement code 2017-02-21 13:35:22 -08:00
evazion 35b3398142 post_test.rb: add more metatag search tests. 2017-02-06 18:48:39 -06:00
evazion 3edd814be5 tests: add iqdb queries controller tests. 2017-02-06 18:48:37 -06:00
evazion 490864e24d tests: add saved searches controller tests. 2017-02-06 18:48:35 -06:00
evazion 64b4004bbf tests: add favorite groups controller tests. 2017-02-06 18:48:35 -06:00
Albert Yi b9a1e115fb add additional mod actions 2017-01-03 16:02:36 -08:00
Albert Yi 91793fff82 fixes #2731: Expunged posts should clear favorite groups 2016-11-01 13:44:36 -07:00
evazion 88a8c02f4c Test /forum_posts doesn't list private forum topics. 2016-10-30 18:00:26 -05:00
Albert Yi 8e87d41a3c Merge pull request #2739 from evazion/fix-tag-alias
Fix "conflicting wikis" message; fix alias/implication approvers in BURs (#2715)
2016-10-27 10:44:51 -07:00
evazion 8672604ee7 Add upvote:/downvote: editing metatags. 2016-10-26 23:23:47 -05:00
evazion 1e8a68a56b Test that approving BUR sets approver of aliases/implications. 2016-10-26 21:52:18 -05:00
evazion 5e75dcecea Add test cases for anon/banned/member voting. 2016-10-14 04:47:51 +00:00
evazion 80895ef46e Add tests for reverting to foreign versions. 2016-10-11 06:57:05 +00:00
r888888888 2a87aad34e implement super voters 2016-02-22 14:11:25 -08:00
r888888888 d75546a4e4 add secondary validations to aliases+implications+requests 2016-02-11 11:48:56 -08:00
r888888888 21ab11d92a add support for saved search metatag + tests 2015-11-24 12:55:18 -08:00
r888888888 6480864718 fixes #2469 2015-10-15 15:24:24 -07:00