followability 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +20 -5
- data/docs/youtube-video.jpeg +0 -0
- data/lib/followability/followable/actions/follow.rb +2 -2
- data/lib/followability/followable/callbacks.rb +2 -2
- data/lib/followability/followable.rb +9 -2
- data/lib/followability/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46c4bbdfdbae3003841116e1a71dae9c1573350a800c2bf4138031673cebe1a6
|
4
|
+
data.tar.gz: bc915022b767b6f945108d65442fefb42c72680b63e81649cff1dc315f6da0d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3606b82feba15a46ba17284800f9a750279d1429fcbec0a679fa530f9ffbe97c4b8f11020ca572a977a82cc16fd2652e99694d5ee03ca28d5a7391545a7f8cbd
|
7
|
+
data.tar.gz: ea8d95ad732334a1576a44966c03da676e0966bf6ba79b9eba28394d63e2068c01392c88e8a056ce89cfd24cbaa8014d73100a520c555e1724b2567cd887af14
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -72,6 +72,12 @@ Avaiable methods:
|
|
72
72
|
@bar.errors.full_messages
|
73
73
|
# => [...]
|
74
74
|
|
75
|
+
@bar.unfollow(@foo)
|
76
|
+
# => false
|
77
|
+
|
78
|
+
@bar.errors.full_messages
|
79
|
+
# => [...]
|
80
|
+
|
75
81
|
@foo.remove_follow_request_for(@bar)
|
76
82
|
# => false
|
77
83
|
|
@@ -133,6 +139,7 @@ Avaiable methods:
|
|
133
139
|
- followers
|
134
140
|
- following
|
135
141
|
- blocks
|
142
|
+
- blockers
|
136
143
|
|
137
144
|
### Usage
|
138
145
|
```ruby
|
@@ -156,6 +163,9 @@ Avaiable methods:
|
|
156
163
|
|
157
164
|
@foo.blocks
|
158
165
|
# => [#<User ...>]
|
166
|
+
|
167
|
+
@foo.blockers
|
168
|
+
# => [#<User ...>]
|
159
169
|
```
|
160
170
|
|
161
171
|
### Callback Methods
|
@@ -172,8 +182,8 @@ Available methods:
|
|
172
182
|
- followable_blocked_by_someone
|
173
183
|
- followable_unblocked_by_me
|
174
184
|
- followable_unblocked_by_someone
|
175
|
-
-
|
176
|
-
-
|
185
|
+
- unfollowed_by_me
|
186
|
+
- unfollowed_by_someone
|
177
187
|
- followability_triggered
|
178
188
|
|
179
189
|
### Usage
|
@@ -196,10 +206,10 @@ class User < ActiveRecord::Base
|
|
196
206
|
def followable_blocked_by_someone(record); end
|
197
207
|
def followable_unblocked_by_me(record); end
|
198
208
|
def followable_unblocked_by_someone(record); end
|
199
|
-
def
|
209
|
+
def unfollowed_by_me(record); end
|
200
210
|
|
201
|
-
def
|
202
|
-
Followability::
|
211
|
+
def unfollowed_by_someone(record)
|
212
|
+
Followability::RemoveFollowedUserJob.perform_later(user_id: record.id)
|
203
213
|
end
|
204
214
|
|
205
215
|
def followability_triggered(record, callback_name); end
|
@@ -241,6 +251,11 @@ en:
|
|
241
251
|
blocked: 'You can not send follow request to blocked %{klass}'
|
242
252
|
```
|
243
253
|
|
254
|
+
## Mentioned Youtube Video
|
255
|
+
![Friend Request And Followers - Followability Gem | Ruby On Rails 7 Tutorial](docs/youtube-video.jpeg)
|
256
|
+
|
257
|
+
You can watch [@Deanout](https://github.com/Deanout)'s [Friend Request And Followers - Followability Gem | Ruby On Rails 7 Tutorial Video](https://www.youtube.com/watch?v=UVa1QPaITQM) on Youtube.
|
258
|
+
|
244
259
|
## Development
|
245
260
|
|
246
261
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
Binary file
|
@@ -51,8 +51,8 @@ module Followability
|
|
51
51
|
status: Followable::Relationship.statuses[:following])
|
52
52
|
|
53
53
|
if relation.destroy
|
54
|
-
run_callback(self, affected: record, callback: :
|
55
|
-
run_callback(record, affected: self, callback: :
|
54
|
+
run_callback(self, affected: record, callback: :unfollowed_by_me)
|
55
|
+
run_callback(record, affected: self, callback: :unfollowed_by_someone)
|
56
56
|
|
57
57
|
true
|
58
58
|
else
|
@@ -6,7 +6,7 @@ module Followability
|
|
6
6
|
false
|
7
7
|
end
|
8
8
|
|
9
|
-
# rubocop:disable Metrics/MethodLength
|
9
|
+
# rubocop:disable Metrics/MethodLength, Metrics/BlockLength
|
10
10
|
def followability
|
11
11
|
class_eval do
|
12
12
|
def self.followability?
|
@@ -43,6 +43,13 @@ module Followability
|
|
43
43
|
source: :followable,
|
44
44
|
class_name: name,
|
45
45
|
source_type: name
|
46
|
+
|
47
|
+
has_many :blockers,
|
48
|
+
-> { Followability::Relationship.blocked },
|
49
|
+
through: :followable_relationships,
|
50
|
+
source: :followerable,
|
51
|
+
class_name: name,
|
52
|
+
source_type: name
|
46
53
|
end
|
47
54
|
|
48
55
|
include Followability::Followable::Associations
|
@@ -51,6 +58,6 @@ module Followability
|
|
51
58
|
include Followability::Followable::Actions::Follow
|
52
59
|
include Followability::Followable::Actions::Block
|
53
60
|
end
|
54
|
-
# rubocop:enable Metrics/MethodLength
|
61
|
+
# rubocop:enable Metrics/MethodLength, Metrics/BlockLength
|
55
62
|
end
|
56
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: followability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nejdetkadir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Implements the social network followable functionality for your Active
|
14
14
|
Record models.
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- README.md
|
29
29
|
- Rakefile
|
30
30
|
- config/locales/en.yml
|
31
|
+
- docs/youtube-video.jpeg
|
31
32
|
- followability.gemspec
|
32
33
|
- lib/followability.rb
|
33
34
|
- lib/followability/followable.rb
|