Commit Graph

1322 Commits

Author SHA1 Message Date
evazion
bbabaffb07 /comment_votes: make visible to banned users.
Let banned users see their own comment votes.
2020-02-16 03:24:21 -06:00
evazion
a214989447 controllers: move /moderator/post/disapprovals to /post_disapprovals. 2020-02-15 07:10:45 -06:00
evazion
60ff2ae929 models: rename post/pool archives to post/pool versions. 2020-02-15 06:52:10 -06:00
evazion
2564e885c8 controllers: refactor only param includes.
Add extra includes needed by the `only` param inside `respond_with`.
2020-02-15 06:17:22 -06:00
evazion
8649ff6dbe API: remove various associated fields included by default.
Remove various associated fields that were included by default on
certain endpoints. API users can use the only param to include the
full association if they need these fields.

* /artists.json: urls.
* /artist_urls.json: artist.
* /comments.json: creator_name and updater_name.
* /notes.json: creator_name.
* /pools.json: creator_name.
* /posts.json: uploader_name, children_ids, pixiv_ugoira_frame_data.
* /post_appeals.json: is_resolved.
* /post_versions.json: updater_name.
* /uploads.json: uploader_name.
2020-02-15 06:17:11 -06:00
evazion
1e426a50f7 controllers: standardize request format checks. 2020-02-14 17:28:25 -06:00
BrokenEagle
75f4af8991 Don't do unnecessary processing on posts when using the API 2020-02-12 23:58:54 +00:00
BrokenEagle
f7495f5e26 Removed unused controller code 2020-02-12 23:58:54 +00:00
BrokenEagle
63b3503bfc Add ability to use nested only parameter
- The only string works much the same as before with its comma separation
-- Nested includes are indicated with square brackets "[ ]"
-- The nested include is the value immediately preceding the square brackets
-- The only string is the comma separated string inside those brackets
- Default includes are split between format types when necessary
-- This prevents unnecessary includes from being added on page load
- Available includes are those items which are allowed to be accessible to the user
-- Some aren't because they are sensitive, such as the creator of a flag
-- Some aren't because the number of associated items is too large
- The amount of times the same model can be included to prevent recursions
-- One exception is the root model may include the same model once
--- e.g. the user model can include the inviter which is also the user model
-- Another exception is if the include is a has_many association
--- e.g. artist urls can include the artist, and then artist urls again
2020-02-12 23:58:53 +00:00
evazion
69f653b0c4 forum_topics/show: fix N+1 query patterns. 2020-02-05 18:08:39 -06:00
evazion
ccb87e13b1 Fix #4282: Related tag search no longer allows the JSON/XML formats. 2020-02-05 14:38:32 -06:00
evazion
2d0e0769cb /ip_addresses: add paginator to group_by=(user|ip_addr) pages. 2020-02-05 14:28:30 -06:00
evazion
fcfdd94fe9 controllers: temp fix exception in show actions.
Temp fix a regression caused by c7185724d.
2020-02-04 03:51:59 -06:00
evazion
df2573359d mod reports: add show page redirect. 2020-02-03 22:05:58 -06:00
evazion
170a0e8a48 dmails: remove ability to mark dmails as spam.
Instead of marking messages as spam, users can either report the message
or mark it as deleted.
2020-02-03 04:52:12 -06:00
evazion
b8aa223ecb dmails: fix users being able to update other user's dmails.
Fix it being possible to mark dmails belonging to other users as read or
deleted. Anyone who had a permalink to a dmail could update the dmail.
2020-02-03 04:48:50 -06:00
evazion
73219f38ce dmails: fix security issues with dmail permalinks.
Fix a couple security issues related to dmail permalinks. Dmails have a
permalink that you can give to a Mod to let them read the dmail. This is
done with a key param that grants access when the dmail is opened by
another user. The key param had several problems:

* The key contained a full copy of the message's title and body encoded in
  base64. This meant that anyone given a dmail permalink could read the
  full dmail just by decoding the key in the link, without even having
  to open the link.

* The key was derived from the dmail's title and body. If you knew or
  could guess a dmail's title and body you could open the dmail. One
  case when this was possible was when sending dmails. You could send
  someone a dmail, take the permalink from your sent copy of the dmail,
  then increment the dmail id to open the receiver's copy of the dmail.
  Since the sent copy and the received copy both had the same title and
  body, they both had the same dmail key. This let you check whether a
  person had read your dmail, and what time they read it at.

* The key verification was done with an insecure string comparison
  rather than a secure constant-time comparison. This was potentially
  vulnerable to timing attacks.

* Opening a dmail belonging to another user would mark it as read for them.

The fix to all this is to use the dmail's id as the key instead of the
dmail's title and body. This means that old permalinks no longer work.
This is unavoidable given the issues above.

Other changes:

* The name of the 'Permalink' link is now 'Share'.
* Anyone with the 'Share' link can view the dmail, not just Mods.
2020-02-02 22:27:49 -06:00
evazion
6468df6d44 dmails: allow marking dmails as unread.
* Add ability to mark dmails as unread.
* Fix users.unread_dmail_count to not count deleted dmails.
* Fix show action so that API calls don't mark dmails as read.
* Don't show the unread dmail notice on the /dmails page itself.
* Stop using users.has_mail flag.
2020-02-01 15:49:33 -06:00
evazion
d8eba59cfa dmails: add unread folder, show only received messages by default.
* Add unread and deleted dmail folders.
* Remove dmail_folder cookie (wasn't used).
* Default to the received folder so that we don't show sent messages by default.
2020-01-31 16:24:53 -06:00
evazion
f8db577c25 dmails: replace hard deletions with soft deletions.
Turn deletions into soft deletions (set the is_deleted flag) instead of
hard deletions (remove from database). The is_deleted flag actually
already existed, but it was never used before.
2020-01-31 16:24:27 -06:00
evazion
5df8d08aae dmails: allow Members to mark dmails as spam.
* Allow Members to mark dmails as spam or not spam (previously Gold only).
* Replace spam and ham endpoints with single update endpoint.
2020-01-31 02:43:08 -06:00
evazion
c7185724d5 controllers: set @current_item globally in respond_with. 2020-01-31 02:43:08 -06:00
evazion
74d77c1e23 Update robots.txt.
* Generate /robots.txt dynamically.
* Include link to sitemap.
* Update list of allowed urls.
* Disallow crawling of non-canonical subdomains.
2020-01-31 02:43:07 -06:00
evazion
e715bfad8a Fix #4278: Certain users are unable to use the report function. 2020-01-30 12:35:05 -06:00
evazion
588280c8cc views: add embed_wiki helper.
Also remove options to configure names of wiki notice pages. These names
generally don't need to be changed and we already hardcode links to wiki
pages in other places anyway.
2020-01-27 17:14:38 -06:00
evazion
af044c45db mod reports: enable reporting for members, add dmail reporting.
* Add ability to report dmails.
* Enable reports for comments, forum posts, and dmails.
* Allow Members to send reports.
* Don't allow users to report the same thing twice.
2020-01-27 17:12:39 -06:00
evazion
60dae29fed Merge pull request #4272 from BrokenEagle/fix-wiki-quick-search-check
Fix title parameter checking
2020-01-27 00:52:26 -06:00
evazion
fbe39148cd users: remove opt_out_tracking account setting.
This setting doesn't do anything any more. It was only ever used to
disable tracking of some (but not all) data in Mixpanel, then later in
Matomo.
2020-01-26 19:16:38 -06:00
BrokenEagle
3b2b5abb6a Fix title parameter checking
It was fixed on the quick search form with 217f5e6 but wasn't
fixed on the parameter checking in the controller.
2020-01-26 07:19:07 +00:00
evazion
1a3ce17bf0 Merge pull request #4270 from BrokenEagle/universal-index-redirect
Add universal index redirect
2020-01-25 14:52:52 -06:00
BrokenEagle
75ac11166c Added universal redirect on the index action
- Only controllers with show actions will redirect on the index action
- Parameter checking is individualized per controller for the redirect check
2020-01-25 20:48:01 +00:00
evazion
fcb6f96979 forum: add /forum_topic_visits.{json,xml} endpoint.
For debugging purposes only.
2020-01-22 21:30:00 -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
edaf6323fd /favorite_groups: add search, creators, timestamps, edit/delete links. 2020-01-22 02:03:19 -06:00
evazion
f2f236c23a mod reports: remove use of belongs_to_creator macro.
Remove use of belongs_to_creator macro as per b4ce2d83a.
2020-01-21 00:25:29 -06:00
evazion
b5603f0d39 forum: optimize unread forum topics on forum index.
Avoid doing one SQL query per topic when checking for new topics on the
forum index.

This also changes it so that forum topics aren't always marked as new
for anonymous users.
2020-01-21 00:12:03 -06:00
evazion
71cf1f65be forum: fix exception when viewing empty forum topics.
* https://danbooru.donmai.us/forum_topics?search[response_count]=0&search[is_deleted]=true
* https://danbooru.donmai.us/forum_topics/11313
2020-01-21 00:11:12 -06:00
evazion
cca3f98765 forum: remove ability to merge forum topics.
* Rarely used (only used ~15 times in total, not used at all since 2015-2016).
* Merging topics didn't properly bump the new topic.
* Merging topics didn't log a modaction when the old topic was deleted.
* Merging topics broke the old topic. Moving all the posts from one topic
  to another leaves the old topic with zero posts. This normally can't
  happen and it causes exceptions when you try to view the empty topic.
* It was technically possible to merge a topic with itself. This would
  break the response_count.
* It was technically possible for a mod to merge a topic into an
  admin-only topic.
2020-01-21 00:10:21 -06:00
evazion
13528ac2d3 Drop forum subscriptions.
Few people used forum subscriptions (only around 100), and even fewer
people were subscribed to active threads. Most subscriptions were for
old threads that will never be bumped again. The implementation also had
a few problems:

* Unsubscribe links in emails didn't work (they unset the user's
  receive_email_notifications flag, but forum subscriptions didn't
  respect this flag).
* Some users had invalid email addresses, which caused notifications to
  bounce. There was no mechanism for preventing bounces.
* The implementation wasn't scalable. It involved a daily linear scan
  over _all_ forum subscriptions looking for any topics that had been updated.
2020-01-21 00:10:21 -06:00
evazion
cae9a5d7e3 Drop dmail filters.
Few people used dmail filters (~900 users in 5 years) and even fewer
used them correctly. Most people used them to try to block dmail spam,
but usually they either blocked too much (by adding common words that
are present in nearly all dmails, causing all mails to them to be
filtered) or too little (blocking specific email addresses or urls,
which usually are never seen again after the spammer is banned).
Nowadays the spam detection system does a better job of filtering spam.
2020-01-21 00:10:20 -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
BrokenEagle
5f746c1a34 Made recommended changes to moderator reports (see #4267) 2020-01-21 01:38:08 +00:00
BrokenEagle
4cef0e45c2 Create the ability to send reports to moderators
- Limited to Builders+
-- Moderator+ can also use as they may be too busy ATM
- Only on users, comments, and forum posts
- Multiple reports can be generated per instance
- Primarily posts to a moderator-only topic for viewability
- Secondarily has a table for searchability
-- Viewable only by moderators
2020-01-18 06:40:20 +00:00
evazion
4a7322b197 users: rework privacy mode into private favorites (fix #4257).
* Rename 'privacy mode' to 'private favorites'.
* Make the private favorites setting only hide favorites, not favgroups
  and not the user's uploads on their profile page.
* Make the favgroup is_public flag default to true instead of false and
  fix existing favgroups to be public if the user didn't have privacy mode
  enabled before.
* List _all_ public favgroups on the /favorite_groups index, not just
  favgroups belonging to the current user.
* Add a /users/<id>/favorite_groups endpoint.
2020-01-17 22:24:29 -06:00
evazion
ab325c5d2b favgroups: convert post_ids from string to array. 2020-01-17 00:19:20 -06:00
evazion
09833e9b61 Merge pull request #4259 from BrokenEagle/upload-commentary-enhancements
Add upload commentary enhancements
2020-01-17 00:18:17 -06:00
BrokenEagle
3a422b26df Removed unneeded commentary tag checkboxes
As per the discussion on GitHub, these will be handled instead
by the existing mechanisms of related and frequent tags.
2020-01-16 21:40:14 +00:00
evazion
7d53af64c1 favgroups: add create new option to add to favgroup dialog.
Add option to create a new favgroup when the user opens the Add to
Favgroup dialog and they don't have any favgroups yet.
2020-01-15 13:18:25 -06:00
BrokenEagle
82b621d87d Added upload commentary enhancements
- Can now translate commentary from the upload page
- Can now add commentary tags with a checkbox
2020-01-14 23:59:27 +00:00
evazion
ec8c427ef3 reports/uploads: remove upload report page. 2020-01-13 12:58:20 -06:00