[Git][noosfero/noosfero][master] 2 commits: add permission to profile owner post scrap
Leandro Nunes
gitlab at mg.gitlab.com
Thu Sep 26 11:43:19 BRT 2019
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
fe2044e8 by Leandro Nunes dos Santos at 2019-09-26T13:57:20Z
add permission to profile owner post scrap
- - - - -
bebcb876 by Leandro Nunes at 2019-09-26T14:43:16Z
Merge branch 'allow-post-scrap' into 'master'
add permission to profile owner post scrap
See merge request noosfero/noosfero!1748
- - - - -
2 changed files:
- app/models/profile.rb
- test/models/profile_test.rb
Changes:
=====================================
app/models/profile.rb
=====================================
@@ -1279,7 +1279,7 @@ class Profile < ApplicationRecord
def allow_post_scrap?(person = nil)
if self.kind_of?(Person) && person.kind_of?(Person)
- self.is_a_friend?(person)
+ self == person || self.is_a_friend?(person)
else
person.kind_of?(Profile) && person.has_permission?("post_content", self)
end
=====================================
test/models/profile_test.rb
=====================================
@@ -2564,7 +2564,6 @@ class ProfileTest < ActiveSupport::TestCase
assert_not_includes Profile.accessible_to(without_permission), profile
end
-
should "return true to allow_post_scrap? when user is a friend of person profile" do
person = fast_create(Person)
friend = fast_create(Person)
@@ -2573,6 +2572,12 @@ class ProfileTest < ActiveSupport::TestCase
assert person.send("allow_post_scrap?", friend)
end
+ should "return true to allow_post_scrap? when user is the profile's owner" do
+ person = fast_create(Person)
+
+ assert person.send("allow_post_scrap?", person)
+ end
+
should "return false to allow_post_scrap? when user is not a friend of person profile" do
person = fast_create(Person)
friend = fast_create(Person)
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/24359f0414cd4b78cba4517ecc16c51372de491c...bebcb876c816984ebd6018f55e71f167632457fd
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/24359f0414cd4b78cba4517ecc16c51372de491c...bebcb876c816984ebd6018f55e71f167632457fd
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20190926/a371c274/attachment-0001.html>
More information about the Noosfero-dev
mailing list