Commit Graph

36 Commits

Author SHA1 Message Date
evazion
56722df753 forum: delete posts when topic is deleted.
Fix it so that when a forum topic is deleted, all posts in the topic are
deleted too. Also make it so that when a forum topic is undeleted, all
posts in it are undeleted too.

Before when a topic was deleted, only the topic itself was marked as
deleted, not the posts inside the topic. This meant that when a spam
topic was deleted, the OP wouldn't be marked as deleted, so any
modreports against it wouldn't be marked as handled.

Also change it so that it's not possible to undelete a post in a deleted
topic, or to delete the OP of a topic without deleting the topic itself.

Finally, add a fix script to delete all active posts in deleted topics,
and to undelete all deleted OPs in active topics.
2022-01-21 22:35:20 -06:00
evazion
ad523b3745 Fix #4895: Deleted forum topics visible by default in index.
The bug was that since search parameters normally come from URL request
parameters, a string value is expected here.
2021-10-01 17:14:48 -05:00
evazion
4719a5ed1c users: set default settings in ruby instead of in database.
Specify the default settings for new users inside the User model instead
of inside the database. This makes it easier to change defaults, and it
makes the code clearer.
2021-01-15 02:03:54 -06:00
BrokenEagle
7291de42f4 Fix issue with test since Mod topics aren't visible to anonymous 2020-07-27 19:29:22 +00:00
BrokenEagle
a903bd95f9 Add tests for all models with includes searches 2020-07-27 19:29:22 +00:00
evazion
42f0112c38 seo: increase sitemap coverage.
Rework sitemaps to provide more coverage of the site. We want every
important page on the site - including every post, tag, and wiki page -
to be indexed by Google. We do this by generating sitemaps and sitemap
indexes that contain links to every important page on the site.
2020-07-10 00:18:30 -05:00
evazion
99a9149fc4 tests: eliminate as_user helper. 2020-06-11 01:02:01 -05:00
evazion
db63b6d44f pundit: convert forum topics / forum posts to pundit.
Fix it being possible for users to delete or undelete their own forum
posts and topics, even if they were deleted by a mod.
2020-03-20 18:03:00 -05:00
evazion
9389fee726 forum: fixup broken tests.
Fix tests broken by recent addition of BUR status indicators.
2020-03-16 14:33:52 -05:00
evazion
143bfdfb5b forum: fix mods not being able to lock forum topics. 2020-03-03 03:54:19 -06:00
evazion
cc96f30e47 forum: fix topics being incorrectly marked as unread (again).
Second attempt at 71690cacc. Fix topics on page 2+ being still marked as
unread after the user has marked all topics as read.
2020-01-22 21:09:32 -06:00
evazion
b4ce2d83a6 models: remove belongs_to_creator macro.
The belongs_to_creator macro was used to initialize the creator_id field
to the CurrentUser. This made tests complicated because it meant you had
to create and set the current user every time you wanted to create an
object, when lead to the current user being set over and over again. It
also meant you had to constantly be aware of what the CurrentUser was in
many different contexts, which was often confusing. Setting creators
explicitly simplifies everything greatly.
2020-01-21 00:09:38 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
d812a19902 tests: fixup tests. 2019-09-09 11:51:01 -05:00
evazion
32343303d2 forum posts: raise privilege error when viewing restricted topics.
Raise a privilege error when trying to view a restricted topic instead
of handling it in the controller. This way error handling is standardized.
2019-09-08 15:32:31 -05:00
r888888888
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
1d62ea3220 /forum_topics: don't list stickies first in json/atom responses. 2017-06-04 16:14:55 -05:00
Albert Yi
79484586cd Merge branch 'master' into fix-forum-topic-visits 2017-05-15 16:10:21 -07:00
evazion
71a19c28f1 forum topics: don't record a topic visit for api requests. 2017-05-13 13:50:20 -05:00
evazion
8c88e87710 /forum_topics.atom: add atom feed for forum topics. 2017-05-13 10:37:59 -05:00
Albert Yi
eb6746a8a8 additional checks on forum topic visibility 2016-11-07 10:48:04 -08:00
evazion
4e9f7391e6 Test private topics don't bump forum. 2016-10-30 18:00:26 -05:00
Albert Yi
589df5f301 implements #2658: private forum topics 2016-10-24 16:56:18 -07:00
Toks
e041d7d615 fix tests 2015-07-15 01:01:05 -04:00
r888888888
bb402f5a27 fixes #2197 2014-07-17 16:34:54 -07:00
r888888888
f65691b5e6 fix tests 2014-06-18 16:51:55 -07:00
r888888888
58a0086e69 potential fix for #2192 2014-06-12 21:41:37 -07:00
Toks
cb629613bd #2079: Fix tests 2014-01-08 17:06:56 -05:00
Toks
adf4c614f1 update tests for #1508 2013-06-30 11:57:55 -04:00
r888888888
a40331cfe8 fixed forum topics test 2013-06-17 16:00:53 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
9fb0f16f01 fixed tests 2012-03-12 18:22:44 -04:00
albert
d6f1d09da0 deleting a forum topic should delete its posts 2011-01-12 18:06:46 -05:00
albert
668fbab77a * Updated gemfile
* Added forum post/topic unit tests
* Added forum post/topic controller tests
2011-01-12 18:00:07 -05:00
albert
ac98d7db37 stubbed in blank controllers/helpers/functional tests 2010-03-10 18:21:43 -05:00