has_friendship 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/has_friendship/friendable.rb +3 -3
- data/lib/has_friendship/friendship.rb +5 -4
- data/lib/has_friendship/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13eb70587325d65d16b6ddb7a5d2d1c31ea7820363cf263eb4519b6a6a0ae087
|
|
4
|
+
data.tar.gz: 2589815aa21a588236ab240f10b29b68e8fbb4a99c93dcdda1d49a47ed44fdba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00366d386441bf4bbfd90ffc527e563d4296dd40d1597e97de8a3db93c47eb88745014859aa73af25ce5cea23ed0d4ccb1e78ec38b3fa0bb2d0fcbd4827f285b
|
|
7
|
+
data.tar.gz: 51ef8240e5efb99bf76d0d0d731d71932c8062e51ac84ce24d753001b22c16f0c4262f567b6f17adc2a158e6ea0daaf62ae4897526b235354ea4487c01ba5d57
|
|
@@ -77,12 +77,12 @@ module HasFriendship
|
|
|
77
77
|
|
|
78
78
|
def block_friend(friend)
|
|
79
79
|
on_relation_with(friend) do |one, other|
|
|
80
|
-
HasFriendship::Friendship.find_unblocked_friendship(one, other).
|
|
80
|
+
HasFriendship::Friendship.find_unblocked_friendship(one, other).block_by(self)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def unblock_friend(friend)
|
|
85
|
-
return unless has_blocked(friend)
|
|
85
|
+
return unless has_blocked?(friend)
|
|
86
86
|
on_relation_with(friend) do |one, other|
|
|
87
87
|
HasFriendship::Friendship.find_blocked_friendship(one, other).destroy
|
|
88
88
|
end
|
|
@@ -101,7 +101,7 @@ module HasFriendship
|
|
|
101
101
|
|
|
102
102
|
private
|
|
103
103
|
|
|
104
|
-
def has_blocked(friend)
|
|
104
|
+
def has_blocked?(friend)
|
|
105
105
|
HasFriendship::Friendship.find_one_side(self, friend).blocker_id == self.id
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -34,10 +34,6 @@ module HasFriendship
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
event :block do
|
|
37
|
-
before do
|
|
38
|
-
self.blocker_id = self.friendable.id
|
|
39
|
-
end
|
|
40
|
-
|
|
41
37
|
after do
|
|
42
38
|
friendable.on_friendship_blocked(self)
|
|
43
39
|
end
|
|
@@ -45,6 +41,11 @@ module HasFriendship
|
|
|
45
41
|
end
|
|
46
42
|
end
|
|
47
43
|
|
|
44
|
+
def block_by(blocker)
|
|
45
|
+
self.blocker_id = blocker.id
|
|
46
|
+
self.block!
|
|
47
|
+
end
|
|
48
|
+
|
|
48
49
|
def self.relation_attributes(one, other, status: nil)
|
|
49
50
|
attr = {
|
|
50
51
|
friendable_id: one.id,
|
metadata
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: has_friendship
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sung Won Cho
|
|
8
|
+
- Paul Walrath
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
11
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -249,6 +250,7 @@ dependencies:
|
|
|
249
250
|
version: '0'
|
|
250
251
|
email:
|
|
251
252
|
- mikeswcho@gmail.com
|
|
253
|
+
- paul@walrath.ca
|
|
252
254
|
executables: []
|
|
253
255
|
extensions: []
|
|
254
256
|
extra_rdoc_files: []
|