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.
This commit is contained in:
evazion
2020-01-17 19:59:47 -06:00
parent 2095dd3084
commit 4a7322b197
15 changed files with 44 additions and 38 deletions

View File

@@ -40,7 +40,7 @@ class User < ApplicationRecord
always_resize_images
enable_post_navigation
new_post_navigation_layout
enable_privacy_mode
enable_private_favorites
enable_sequential_post_navigation
hide_deleted_posts
style_usernames
@@ -653,7 +653,7 @@ class User < ApplicationRecord
end
def favorite_group_count
favorite_groups.count
favorite_groups.visible(CurrentUser.user).count
end
def appeal_count
@@ -792,7 +792,7 @@ class User < ApplicationRecord
end
def hide_favorites?
!CurrentUser.is_admin? && enable_privacy_mode? && CurrentUser.user.id != id
!CurrentUser.is_admin? && enable_private_favorites? && CurrentUser.user.id != id
end
def initialize_attributes