thredded 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/concerns/thredded/topic_common.rb +2 -1
- data/app/models/thredded/messageboard.rb +3 -2
- data/app/models/thredded/post.rb +4 -2
- data/app/models/thredded/post_moderation_record.rb +12 -4
- data/app/models/thredded/private_post.rb +4 -2
- data/app/models/thredded/private_topic.rb +4 -2
- data/app/models/thredded/topic.rb +4 -2
- data/app/models/thredded/user_detail.rb +1 -1
- data/lib/thredded/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4828ad3ea2181802a2dfed9b9d38d847601296c7
|
4
|
+
data.tar.gz: a9ba9ca29c21221ce8492c47e724671da64f4c66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d3d3e5e71c7b784ab6a8c9ab1fffaf31cd30ca5a8f7a01768d15f920c004b0317d27653f54c8f546b9973986cb2445efd2d9981ea889562471555a2a3fc1c7
|
7
|
+
data.tar.gz: a3ecc14362ffbadd481d0862f6e5f861f22889cbdf51e4dbd898ab94169366248180e7bf389d74afb0cc022c527297aa7f50b4447f22f57ee972e370328c4a41
|
data/README.md
CHANGED
@@ -99,7 +99,7 @@ Then, see the rest of this Readme for more information about using and customizi
|
|
99
99
|
Add the gem to your Gemfile:
|
100
100
|
|
101
101
|
```ruby
|
102
|
-
gem 'thredded', '~> 0.12.
|
102
|
+
gem 'thredded', '~> 0.12.3'
|
103
103
|
```
|
104
104
|
|
105
105
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
@@ -8,7 +8,8 @@ module Thredded
|
|
8
8
|
|
9
9
|
belongs_to :last_user,
|
10
10
|
class_name: Thredded.user_class_name,
|
11
|
-
foreign_key: 'last_user_id'
|
11
|
+
foreign_key: 'last_user_id',
|
12
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
12
13
|
|
13
14
|
scope :order_recently_posted_first, -> { order(last_post_at: :desc, id: :desc) }
|
14
15
|
scope :on_page, ->(page_num) { page(page_num) }
|
@@ -33,7 +33,7 @@ module Thredded
|
|
33
33
|
has_many :posts, dependent: :destroy
|
34
34
|
has_many :topics, dependent: :destroy, inverse_of: :messageboard
|
35
35
|
|
36
|
-
belongs_to :last_topic, class_name: 'Thredded::Topic'
|
36
|
+
belongs_to :last_topic, class_name: 'Thredded::Topic', **(Thredded.rails_gte_51? ? { optional: true } : {})
|
37
37
|
|
38
38
|
has_many :user_details, through: :posts
|
39
39
|
has_many :messageboard_users,
|
@@ -53,7 +53,8 @@ module Thredded
|
|
53
53
|
belongs_to :group,
|
54
54
|
inverse_of: :messageboards,
|
55
55
|
foreign_key: :messageboard_group_id,
|
56
|
-
class_name: 'Thredded::MessageboardGroup'
|
56
|
+
class_name: 'Thredded::MessageboardGroup',
|
57
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
57
58
|
|
58
59
|
has_many :post_moderation_records, inverse_of: :messageboard, dependent: :delete_all
|
59
60
|
|
data/app/models/thredded/post.rb
CHANGED
@@ -7,7 +7,8 @@ module Thredded
|
|
7
7
|
|
8
8
|
belongs_to :user,
|
9
9
|
class_name: Thredded.user_class_name,
|
10
|
-
inverse_of: :thredded_posts
|
10
|
+
inverse_of: :thredded_posts,
|
11
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
11
12
|
belongs_to :messageboard,
|
12
13
|
counter_cache: true
|
13
14
|
belongs_to :postable,
|
@@ -18,7 +19,8 @@ module Thredded
|
|
18
19
|
inverse_of: :posts,
|
19
20
|
primary_key: :user_id,
|
20
21
|
foreign_key: :user_id,
|
21
|
-
counter_cache: true
|
22
|
+
counter_cache: true,
|
23
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
22
24
|
has_many :moderation_records,
|
23
25
|
class_name: 'Thredded::PostModerationRecord',
|
24
26
|
dependent: :nullify
|
@@ -12,10 +12,18 @@ module Thredded
|
|
12
12
|
scope :order_newest_first, -> { order(created_at: :desc, id: :desc) }
|
13
13
|
|
14
14
|
belongs_to :messageboard, inverse_of: :post_moderation_records
|
15
|
-
validates :messageboard_id, presence: true
|
16
|
-
belongs_to :post,
|
17
|
-
|
18
|
-
|
15
|
+
validates :messageboard_id, presence: true unless Thredded.rails_gte_51?
|
16
|
+
belongs_to :post,
|
17
|
+
inverse_of: :moderation_records,
|
18
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
19
|
+
belongs_to :post_user,
|
20
|
+
class_name: Thredded.user_class_name,
|
21
|
+
inverse_of: :thredded_post_moderation_records,
|
22
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
23
|
+
belongs_to :moderator,
|
24
|
+
class_name: Thredded.user_class_name,
|
25
|
+
inverse_of: :thredded_post_moderation_records,
|
26
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
19
27
|
|
20
28
|
validates_each :moderation_state do |record, attr, value|
|
21
29
|
if record.previous_moderation_state == value
|
@@ -6,7 +6,8 @@ module Thredded
|
|
6
6
|
|
7
7
|
belongs_to :user,
|
8
8
|
class_name: Thredded.user_class_name,
|
9
|
-
inverse_of: :thredded_private_posts
|
9
|
+
inverse_of: :thredded_private_posts,
|
10
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
10
11
|
belongs_to :postable,
|
11
12
|
class_name: 'Thredded::PrivateTopic',
|
12
13
|
inverse_of: :posts,
|
@@ -14,7 +15,8 @@ module Thredded
|
|
14
15
|
belongs_to :user_detail,
|
15
16
|
inverse_of: :private_posts,
|
16
17
|
primary_key: :user_id,
|
17
|
-
foreign_key: :user_id
|
18
|
+
foreign_key: :user_id,
|
19
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
18
20
|
|
19
21
|
after_commit :update_parent_last_user_and_timestamp, on: %i[create destroy]
|
20
22
|
after_commit :notify_users, on: [:create]
|
@@ -14,11 +14,13 @@ module Thredded
|
|
14
14
|
|
15
15
|
belongs_to :user,
|
16
16
|
class_name: Thredded.user_class_name,
|
17
|
-
inverse_of: :thredded_private_topics
|
17
|
+
inverse_of: :thredded_private_topics,
|
18
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
18
19
|
belongs_to :user_detail,
|
19
20
|
primary_key: :user_id,
|
20
21
|
foreign_key: :user_id,
|
21
|
-
inverse_of: :private_topics
|
22
|
+
inverse_of: :private_topics,
|
23
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
22
24
|
|
23
25
|
has_many :posts,
|
24
26
|
class_name: 'Thredded::PrivatePost',
|
@@ -29,7 +29,8 @@ module Thredded
|
|
29
29
|
|
30
30
|
belongs_to :user,
|
31
31
|
class_name: Thredded.user_class_name,
|
32
|
-
inverse_of: :thredded_topics
|
32
|
+
inverse_of: :thredded_topics,
|
33
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
33
34
|
|
34
35
|
belongs_to :messageboard,
|
35
36
|
counter_cache: true,
|
@@ -41,7 +42,8 @@ module Thredded
|
|
41
42
|
primary_key: :user_id,
|
42
43
|
foreign_key: :user_id,
|
43
44
|
inverse_of: :topics,
|
44
|
-
counter_cache: :topics_count
|
45
|
+
counter_cache: :topics_count,
|
46
|
+
**(Thredded.rails_gte_51? ? { optional: true } : {})
|
45
47
|
|
46
48
|
has_many :posts,
|
47
49
|
autosave: true,
|
@@ -5,7 +5,7 @@ module Thredded
|
|
5
5
|
include Thredded::ModerationState
|
6
6
|
|
7
7
|
belongs_to :user, class_name: Thredded.user_class_name, inverse_of: :thredded_user_detail
|
8
|
-
validates :user_id,
|
8
|
+
validates :user_id, uniqueness: true, **(Thredded.rails_gte_51? ? {} : { presence: true })
|
9
9
|
|
10
10
|
has_many :topics, class_name: 'Thredded::Topic', foreign_key: :user_id, primary_key: :user_id
|
11
11
|
has_many :private_topics, class_name: 'Thredded::PrivateTopic', foreign_key: :user_id, primary_key: :user_id
|
data/lib/thredded/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thredded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Oliveira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
12
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pundit
|