favgroups: make private favgroups a Gold-only option.
Make private favgroups a Gold-only option. This is for consistency with private favorites and upvotes being Gold-only options. Existing Members with private favgroups are allowed to keep them, as long as they don't disable privacy. If they disable it, then they can't re-enable it again without upgrading to Gold first.
This commit is contained in:
@@ -10,7 +10,7 @@ class FavoriteGroupsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "index action" do
|
||||
setup do
|
||||
@mod_favgroup = create(:favorite_group, name: "monochrome", creator: build(:moderator_user, name: "fumimi"))
|
||||
@private_favgroup = create(:favorite_group, creator: @user, is_public: false)
|
||||
@private_favgroup = create(:private_favorite_group)
|
||||
end
|
||||
|
||||
should "render" do
|
||||
@@ -28,7 +28,7 @@ class FavoriteGroupsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
context "for private favorite groups as the creator" do
|
||||
setup do
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.user = @private_favgroup.creator
|
||||
end
|
||||
|
||||
should respond_to_search(is_public: "false").with { @private_favgroup }
|
||||
@@ -42,13 +42,13 @@ class FavoriteGroupsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
should "show private favgroups to the creator" do
|
||||
@favgroup.update!(is_public: false)
|
||||
@favgroup.update_columns(is_public: false)
|
||||
get_auth favorite_group_path(@favgroup), @user
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "not show private favgroups to other users" do
|
||||
@favgroup = create(:favorite_group, is_public: false)
|
||||
@favgroup = create(:private_favorite_group)
|
||||
get_auth favorite_group_path(@favgroup), create(:user)
|
||||
assert_response 403
|
||||
end
|
||||
@@ -91,6 +91,13 @@ class FavoriteGroupsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response 403
|
||||
assert_not_equal("foo", @favgroup.reload.name)
|
||||
end
|
||||
|
||||
should "not allow non-Gold users to enable private favgroups" do
|
||||
put_auth favorite_group_path(@favgroup), @user, params: { favorite_group: { is_private: true } }
|
||||
|
||||
assert_response :success
|
||||
assert_equal(false, @favgroup.is_private?)
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
|
||||
Reference in New Issue
Block a user