followability 1.1.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5381804ee6dcba9d0a7fcd76d2a560e9b6ff371aa3b2c4212cb394f8abbf4468
4
- data.tar.gz: 4aae8e97665f8b10f1a1ee31d9b244d1a63fed320d7e9777249c907c215e3d5f
3
+ metadata.gz: 46c4bbdfdbae3003841116e1a71dae9c1573350a800c2bf4138031673cebe1a6
4
+ data.tar.gz: bc915022b767b6f945108d65442fefb42c72680b63e81649cff1dc315f6da0d8
5
5
  SHA512:
6
- metadata.gz: db1fab64911111ec2ef69ca06f4b173f4bd0daf4e49085fcbaae2674c6b1efac9e549ffe492ab2205eee0bc413200c09910094fa4819b914cb92a0bfbe1a6fa5
7
- data.tar.gz: fb8e8e23c3b63158ba16e7981d85de9ee0382ee530d3b0de2194feb125e6d6ba5ed209c1c5caa12476814701e50038bd906c1b70fb19b2cc1c808d0b526636d2
6
+ metadata.gz: 3606b82feba15a46ba17284800f9a750279d1429fcbec0a679fa530f9ffbe97c4b8f11020ca572a977a82cc16fd2652e99694d5ee03ca28d5a7391545a7f8cbd
7
+ data.tar.gz: ea8d95ad732334a1576a44966c03da676e0966bf6ba79b9eba28394d63e2068c01392c88e8a056ce89cfd24cbaa8014d73100a520c555e1724b2567cd887af14
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- followability (1.0.0)
4
+ followability (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- - unfollow_by_me
176
- - unfollow_by_someone
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 unfollow_by_me(record); end
209
+ def unfollowed_by_me(record); end
200
210
 
201
- def unfollow_by_someone(record)
202
- Followability::RemoveFollowedUser(user_id: record.id)
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: :unfollow_by_me)
55
- run_callback(record, affected: self, callback: :unfollow_by_someone)
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
@@ -16,8 +16,8 @@ module Followability
16
16
  followable_blocked_by_someone
17
17
  followable_unblocked_by_me
18
18
  followable_unblocked_by_someone
19
- unfollow_by_me
20
- unfollow_by_someone
19
+ unfollowed_by_me
20
+ unfollowed_by_someone
21
21
  followability_triggered
22
22
  ].freeze
23
23
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Followability
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  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.0
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-17 00:00:00.000000000 Z
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