socialization 2.0.0 → 2.0.2
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/CHANGELOG.md +8 -0
- data/README.md +1 -0
- data/lib/generators/socialization/socialization_generator.rb +4 -2
- data/lib/generators/socialization/templates/active_record/migration_follows.rb +1 -1
- data/lib/generators/socialization/templates/active_record/migration_likes.rb +1 -1
- data/lib/generators/socialization/templates/active_record/migration_mentions.rb +1 -1
- data/lib/socialization/stores/active_record/follow.rb +4 -4
- data/lib/socialization/stores/active_record/like.rb +4 -4
- data/lib/socialization/stores/active_record/mention.rb +4 -4
- data/lib/socialization/version.rb +1 -1
- data/spec/spec_support/data_stores.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ee82eab3ad3e0bd520446f3dd60d441d269403928fe8795d55dd7aabb61f2a0
|
4
|
+
data.tar.gz: 804dc944638a2069b875bf7df144feec37e8b544303d4812de6ddb4fb85964f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4bbf85e699b15b834faf97693cd773ba8f7da0fdc3b2b14c437e7e76399183ee9cce4e71cb59d7100a4a51c8467a40ac25c60aa0549d8702590e29bfb926e44
|
7
|
+
data.tar.gz: 1f177dfb54f701acf1383e84e6e11ba8fe789d153261a10ccace510eec3f32c255e3813cf710910add578e28226f4f3b2b4fb4c3396362483f17ffd08c4e1831
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.0.2 (August 12, 2024)
|
4
|
+
|
5
|
+
* Bug fix
|
6
|
+
|
7
|
+
## 2.0.1 (February 18, 2022)
|
8
|
+
|
9
|
+
* Added support for namespaced models (thanks @marciotoze, @twrk, @mensfeld)
|
10
|
+
|
3
11
|
## 2.0.0 (February 18, 2022)
|
4
12
|
|
5
13
|
* Dropped support for old Rails versions. Updated CI.
|
data/README.md
CHANGED
@@ -9,6 +9,7 @@ The Like feature works just like a Facebook Like. For example, John likes Pulp F
|
|
9
9
|
The Mention feature was written with Facebook mentions in mind. For example, John mentions Jane in a comment. Typically, Jane would be highlighted in the comment user interface and possibly notified that John mentioned her. This Facebook feature is occasionally called Tagging, although tagging is generally something [entirely different](http://en.wikipedia.org/wiki/Tag_(metadata).
|
10
10
|
|
11
11
|

|
12
|
+
[](https://badge.fury.io/rb/socialization)
|
12
13
|
|
13
14
|
## Installation
|
14
15
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
require 'rails/generators/migration'
|
3
3
|
|
4
|
+
# require 'rails/version'
|
5
|
+
|
4
6
|
STORES = %w(active_record redis)
|
5
7
|
|
6
8
|
class SocializationGenerator < Rails::Generators::Base
|
@@ -9,7 +11,7 @@ class SocializationGenerator < Rails::Generators::Base
|
|
9
11
|
class_option :store, :type => :string, :default => 'active_record', :description => "Type of datastore"
|
10
12
|
|
11
13
|
def self.next_migration_number(dirname)
|
12
|
-
if ActiveRecord::Base.timestamped_migrations
|
14
|
+
if ActiveRecord::Base.try(:timestamped_migrations) || ActiveRecord.try(:timestamped_migrations)
|
13
15
|
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
14
16
|
else
|
15
17
|
"%.3d" % (current_migration_number(dirname) + 1)
|
@@ -35,4 +37,4 @@ class SocializationGenerator < Rails::Generators::Base
|
|
35
37
|
migration_template "#{options[:store]}/migration_mentions.rb", 'db/migrate/create_mentions.rb'
|
36
38
|
end
|
37
39
|
end
|
38
|
-
end
|
40
|
+
end
|
@@ -9,12 +9,12 @@ module Socialization
|
|
9
9
|
belongs_to :followable, :polymorphic => true
|
10
10
|
|
11
11
|
scope :followed_by, lambda { |follower| where(
|
12
|
-
:follower_type => follower.class.
|
12
|
+
:follower_type => follower.class.name.classify,
|
13
13
|
:follower_id => follower.id)
|
14
14
|
}
|
15
15
|
|
16
16
|
scope :following, lambda { |followable| where(
|
17
|
-
:followable_type => followable.class.
|
17
|
+
:followable_type => followable.class.name.classify,
|
18
18
|
:followable_id => followable.id)
|
19
19
|
}
|
20
20
|
|
@@ -54,7 +54,7 @@ module Socialization
|
|
54
54
|
def followers_relation(followable, klass, opts = {})
|
55
55
|
rel = klass.where(klass.primary_key =>
|
56
56
|
self.select(:follower_id).
|
57
|
-
where(:follower_type => klass.
|
57
|
+
where(:follower_type => klass.name.classify).
|
58
58
|
where(:followable_type => followable.class.to_s).
|
59
59
|
where(:followable_id => followable.id)
|
60
60
|
)
|
@@ -75,7 +75,7 @@ module Socialization
|
|
75
75
|
def followables_relation(follower, klass, opts = {})
|
76
76
|
rel = klass.where(klass.primary_key =>
|
77
77
|
self.select(:followable_id).
|
78
|
-
where(:followable_type => klass.
|
78
|
+
where(:followable_type => klass.name.classify).
|
79
79
|
where(:follower_type => follower.class.to_s).
|
80
80
|
where(:follower_id => follower.id)
|
81
81
|
)
|
@@ -9,12 +9,12 @@ module Socialization
|
|
9
9
|
belongs_to :likeable, :polymorphic => true
|
10
10
|
|
11
11
|
scope :liked_by, lambda { |liker| where(
|
12
|
-
:liker_type => liker.class.
|
12
|
+
:liker_type => liker.class.name.classify,
|
13
13
|
:liker_id => liker.id)
|
14
14
|
}
|
15
15
|
|
16
16
|
scope :liking, lambda { |likeable| where(
|
17
|
-
:likeable_type => likeable.class.
|
17
|
+
:likeable_type => likeable.class.name.classify,
|
18
18
|
:likeable_id => likeable.id)
|
19
19
|
}
|
20
20
|
|
@@ -54,7 +54,7 @@ module Socialization
|
|
54
54
|
def likers_relation(likeable, klass, opts = {})
|
55
55
|
rel = klass.where(klass.primary_key =>
|
56
56
|
self.select(:liker_id).
|
57
|
-
where(:liker_type => klass.
|
57
|
+
where(:liker_type => klass.name.classify).
|
58
58
|
where(:likeable_type => likeable.class.to_s).
|
59
59
|
where(:likeable_id => likeable.id)
|
60
60
|
)
|
@@ -75,7 +75,7 @@ module Socialization
|
|
75
75
|
def likeables_relation(liker, klass, opts = {})
|
76
76
|
rel = klass.where(klass.primary_key =>
|
77
77
|
self.select(:likeable_id).
|
78
|
-
where(:likeable_type => klass.
|
78
|
+
where(:likeable_type => klass.name.classify).
|
79
79
|
where(:liker_type => liker.class.to_s).
|
80
80
|
where(:liker_id => liker.id)
|
81
81
|
)
|
@@ -9,12 +9,12 @@ module Socialization
|
|
9
9
|
belongs_to :mentionable, :polymorphic => true
|
10
10
|
|
11
11
|
scope :mentioned_by, lambda { |mentioner| where(
|
12
|
-
:mentioner_type => mentioner.class.
|
12
|
+
:mentioner_type => mentioner.class.name.classify,
|
13
13
|
:mentioner_id => mentioner.id)
|
14
14
|
}
|
15
15
|
|
16
16
|
scope :mentioning, lambda { |mentionable| where(
|
17
|
-
:mentionable_type => mentionable.class.
|
17
|
+
:mentionable_type => mentionable.class.name.classify,
|
18
18
|
:mentionable_id => mentionable.id)
|
19
19
|
}
|
20
20
|
|
@@ -54,7 +54,7 @@ module Socialization
|
|
54
54
|
def mentioners_relation(mentionable, klass, opts = {})
|
55
55
|
rel = klass.where(klass.primary_key =>
|
56
56
|
self.select(:mentioner_id).
|
57
|
-
where(:mentioner_type => klass.
|
57
|
+
where(:mentioner_type => klass.name.classify).
|
58
58
|
where(:mentionable_type => mentionable.class.to_s).
|
59
59
|
where(:mentionable_id => mentionable.id)
|
60
60
|
)
|
@@ -75,7 +75,7 @@ module Socialization
|
|
75
75
|
def mentionables_relation(mentioner, klass, opts = {})
|
76
76
|
rel = klass.where(klass.primary_key =>
|
77
77
|
self.select(:mentionable_id).
|
78
|
-
where(:mentionable_type => klass.
|
78
|
+
where(:mentionable_type => klass.name.classify).
|
79
79
|
where(:mentioner_type => mentioner.class.to_s).
|
80
80
|
where(:mentioner_id => mentioner.id)
|
81
81
|
)
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'mock_redis' if $MOCK_REDIS
|
2
2
|
require 'redis' unless $MOCK_REDIS
|
3
3
|
|
4
|
-
|
5
|
-
Redis = MockRedis if $MOCK_REDIS # Magic!
|
6
|
-
end
|
4
|
+
Redis = MockRedis if $MOCK_REDIS # Magic!
|
7
5
|
|
8
6
|
def use_redis_store
|
9
7
|
Socialization.follow_model = Socialization::RedisStores::Follow
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Mercier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|