thredded 0.12.1 → 0.12.2
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/commands/thredded/at_notification_extractor.rb +1 -0
- data/app/commands/thredded/autofollow_users.rb +1 -0
- data/app/commands/thredded/create_messageboard.rb +1 -0
- data/app/commands/thredded/mark_all_read.rb +1 -0
- data/app/commands/thredded/moderate_post.rb +1 -0
- data/app/commands/thredded/notify_following_users.rb +1 -0
- data/app/commands/thredded/notify_private_topic_users.rb +1 -0
- data/app/controllers/concerns/thredded/new_post_params.rb +1 -0
- data/app/controllers/concerns/thredded/new_private_post_params.rb +1 -0
- data/app/controllers/concerns/thredded/new_private_topic_params.rb +1 -0
- data/app/controllers/concerns/thredded/new_topic_params.rb +1 -0
- data/app/controllers/concerns/thredded/render_preview.rb +1 -0
- data/app/controllers/thredded/application_controller.rb +1 -0
- data/app/controllers/thredded/autocomplete_users_controller.rb +1 -0
- data/app/controllers/thredded/messageboards_controller.rb +4 -3
- data/app/controllers/thredded/moderation_controller.rb +1 -0
- data/app/controllers/thredded/post_permalinks_controller.rb +1 -0
- data/app/controllers/thredded/post_previews_controller.rb +1 -0
- data/app/controllers/thredded/posts_controller.rb +1 -0
- data/app/controllers/thredded/preferences_controller.rb +4 -3
- data/app/controllers/thredded/private_post_permalinks_controller.rb +1 -0
- data/app/controllers/thredded/private_post_previews_controller.rb +1 -0
- data/app/controllers/thredded/private_posts_controller.rb +1 -0
- data/app/controllers/thredded/private_topic_previews_controller.rb +1 -0
- data/app/controllers/thredded/private_topics_controller.rb +1 -0
- data/app/controllers/thredded/read_states_controller.rb +1 -0
- data/app/controllers/thredded/theme_previews_controller.rb +1 -0
- data/app/controllers/thredded/topic_previews_controller.rb +1 -0
- data/app/controllers/thredded/topics_controller.rb +5 -4
- data/app/forms/thredded/edit_topic_form.rb +1 -0
- data/app/forms/thredded/post_form.rb +2 -0
- data/app/forms/thredded/private_post_form.rb +2 -0
- data/app/forms/thredded/private_topic_form.rb +1 -0
- data/app/forms/thredded/topic_form.rb +1 -0
- data/app/forms/thredded/user_preferences_form.rb +1 -0
- data/app/helpers/thredded/application_helper.rb +1 -0
- data/app/helpers/thredded/nav_helper.rb +7 -6
- data/app/helpers/thredded/render_helper.rb +1 -0
- data/app/helpers/thredded/urls_helper.rb +1 -0
- data/app/jobs/thredded/activity_updater_job.rb +1 -0
- data/app/jobs/thredded/auto_follow_and_notify_job.rb +1 -0
- data/app/jobs/thredded/notify_private_topic_users_job.rb +1 -0
- data/app/mailer_previews/thredded/base_mailer_preview.rb +2 -1
- data/app/mailer_previews/thredded/post_mailer_preview.rb +3 -2
- data/app/mailer_previews/thredded/private_topic_mailer_preview.rb +2 -1
- data/app/mailers/thredded/base_mailer.rb +1 -0
- data/app/mailers/thredded/post_mailer.rb +1 -0
- data/app/mailers/thredded/private_topic_mailer.rb +1 -0
- data/app/models/concerns/thredded/content_moderation_state.rb +1 -0
- data/app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb +1 -0
- data/app/models/concerns/thredded/moderation_state.rb +2 -1
- data/app/models/concerns/thredded/notifier_preference.rb +1 -0
- data/app/models/concerns/thredded/post_common.rb +1 -0
- data/app/models/concerns/thredded/search_parser.rb +3 -2
- data/app/models/concerns/thredded/topic_common.rb +2 -1
- data/app/models/concerns/thredded/topics_search.rb +1 -0
- data/app/models/concerns/thredded/user_topic_read_state_common.rb +1 -0
- data/app/models/thredded/category.rb +2 -1
- data/app/models/thredded/messageboard.rb +5 -4
- data/app/models/thredded/messageboard_group.rb +1 -0
- data/app/models/thredded/messageboard_notifications_for_followed_topics.rb +2 -1
- data/app/models/thredded/messageboard_user.rb +1 -0
- data/app/models/thredded/notifications_for_followed_topics.rb +2 -1
- data/app/models/thredded/notifications_for_private_topics.rb +2 -1
- data/app/models/thredded/null_user.rb +1 -0
- data/app/models/thredded/null_user_topic_read_state.rb +1 -0
- data/app/models/thredded/post.rb +4 -3
- data/app/models/thredded/post_moderation_record.rb +3 -2
- data/app/models/thredded/private_post.rb +3 -2
- data/app/models/thredded/private_topic.rb +4 -3
- data/app/models/thredded/private_user.rb +2 -1
- data/app/models/thredded/stats.rb +1 -0
- data/app/models/thredded/topic.rb +6 -5
- data/app/models/thredded/topic_category.rb +1 -0
- data/app/models/thredded/user_detail.rb +2 -1
- data/app/models/thredded/user_extender.rb +2 -1
- data/app/models/thredded/user_messageboard_preference.rb +2 -1
- data/app/models/thredded/user_permissions/admin/if_admin_column_true.rb +1 -0
- data/app/models/thredded/user_permissions/admin/none.rb +1 -0
- data/app/models/thredded/user_permissions/message/readers_of_writeable_boards.rb +1 -0
- data/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb +1 -0
- data/app/models/thredded/user_permissions/moderate/none.rb +1 -0
- data/app/models/thredded/user_permissions/read/all.rb +1 -0
- data/app/models/thredded/user_permissions/write/all.rb +1 -0
- data/app/models/thredded/user_permissions/write/none.rb +1 -0
- data/app/models/thredded/user_post_notification.rb +2 -1
- data/app/models/thredded/user_preference.rb +2 -1
- data/app/models/thredded/user_private_topic_read_state.rb +2 -1
- data/app/models/thredded/user_topic_follow.rb +3 -2
- data/app/models/thredded/user_topic_read_state.rb +2 -1
- data/app/notifiers/thredded/base_notifier.rb +1 -1
- data/app/notifiers/thredded/email_notifier.rb +1 -0
- data/app/policies/thredded/messageboard_group_policy.rb +1 -0
- data/app/policies/thredded/messageboard_policy.rb +1 -0
- data/app/policies/thredded/post_policy.rb +1 -0
- data/app/policies/thredded/private_post_policy.rb +1 -0
- data/app/policies/thredded/private_topic_policy.rb +1 -0
- data/app/policies/thredded/topic_policy.rb +1 -0
- data/app/view_hooks/thredded/all_view_hooks.rb +1 -0
- data/app/view_models/thredded/base_topic_view.rb +1 -0
- data/app/view_models/thredded/messageboard_group_view.rb +1 -0
- data/app/view_models/thredded/post_view.rb +1 -0
- data/app/view_models/thredded/posts_page_view.rb +1 -0
- data/app/view_models/thredded/private_topic_view.rb +1 -0
- data/app/view_models/thredded/private_topics_page_view.rb +1 -0
- data/app/view_models/thredded/topic_email_view.rb +1 -0
- data/app/view_models/thredded/topic_posts_page_view.rb +1 -0
- data/app/view_models/thredded/topic_view.rb +1 -0
- data/app/view_models/thredded/topics_page_view.rb +1 -0
- data/app/views/thredded/messageboards/index.html.erb +2 -2
- data/app/views/thredded/posts_common/actions/_edit.html.erb +2 -1
- data/app/views/thredded/private_topics/_header.html.erb +2 -1
- data/app/views/thredded/topics/_header.html.erb +2 -1
- data/app/views/thredded/topics/index.html.erb +1 -1
- data/bin/rails +1 -0
- data/bin/rubocop +1 -0
- data/config/routes.rb +13 -12
- data/db/migrate/20160329231848_create_thredded.rb +75 -66
- data/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb +6 -3
- data/db/upgrade_migrations/20160723012349_upgrade_v0_6_to_v0_7.rb +4 -1
- data/db/upgrade_migrations/20161019150201_upgrade_v0_7_to_v0_8.rb +4 -1
- data/db/upgrade_migrations/20161113161801_upgrade_v0_8_to_v0_9.rb +11 -8
- data/db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb +12 -6
- data/db/upgrade_migrations/20170312131417_upgrade_thredded_v0_10_to_v0_11.rb +6 -3
- data/db/upgrade_migrations/20170420163138_upgrade_thredded_v0_11_to_v0_12.rb +4 -1
- data/lib/generators/thredded/install/install_generator.rb +1 -0
- data/lib/generators/thredded/install/templates/initializer.rb +1 -0
- data/lib/tasks/thredded_tasks.rake +1 -0
- data/lib/thredded.rb +7 -0
- data/lib/thredded/base_migration.rb +14 -0
- data/lib/thredded/collection_to_strings_with_cache_renderer.rb +1 -0
- data/lib/thredded/content_formatter.rb +7 -6
- data/lib/thredded/database_seeder.rb +1 -0
- data/lib/thredded/db_tools.rb +9 -8
- data/lib/thredded/email_transformer.rb +1 -0
- data/lib/thredded/email_transformer/onebox.rb +1 -0
- data/lib/thredded/engine.rb +3 -2
- data/lib/thredded/errors.rb +1 -0
- data/lib/thredded/formatting_demo_content.rb +1 -0
- data/lib/thredded/html_pipeline/at_mention_filter.rb +3 -2
- data/lib/thredded/html_pipeline/autolink_filter.rb +1 -0
- data/lib/thredded/html_pipeline/kramdown_filter.rb +2 -1
- data/lib/thredded/html_pipeline/onebox_filter.rb +2 -1
- data/lib/thredded/html_pipeline/wrap_iframes_filter.rb +1 -0
- data/lib/thredded/version.rb +2 -1
- data/lib/thredded/view_hooks/config.rb +1 -0
- data/lib/thredded/view_hooks/renderer.rb +1 -0
- metadata +5 -7
- data/db/upgrade_migrations/20160410111522_upgrade_v0_2_to_v0_3.rb +0 -63
- data/db/upgrade_migrations/20160429222452_upgrade_v0_3_to_v0_4.rb +0 -13
- data/db/upgrade_migrations/20160501151908_upgrade_v0_4_to_v0_5.rb +0 -56
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
# Previews for the PrivateTopicMailer
|
4
5
|
class PrivateTopicMailerPreview < BaseMailerPreview
|
@@ -9,7 +10,7 @@ module Thredded
|
|
9
10
|
post
|
10
11
|
]),
|
11
12
|
post,
|
12
|
-
%w
|
13
|
+
%w[glebm@test.com joel@test.com]
|
13
14
|
)
|
14
15
|
end
|
15
16
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
# Defines a moderation_state enum
|
4
5
|
# Requires an integer moderation_state column on the including class.
|
@@ -6,7 +7,7 @@ module Thredded
|
|
6
7
|
extend ActiveSupport::Concern
|
7
8
|
|
8
9
|
included do
|
9
|
-
enum moderation_state: %i
|
10
|
+
enum moderation_state: %i[pending_moderation approved blocked]
|
10
11
|
validates :moderation_state, presence: true
|
11
12
|
end
|
12
13
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class SearchParser
|
4
5
|
def initialize(query)
|
5
6
|
@query = query
|
6
|
-
@keywords = %w
|
7
|
+
@keywords = %w[in by order]
|
7
8
|
end
|
8
9
|
|
9
10
|
def parse
|
@@ -20,7 +21,7 @@ module Thredded
|
|
20
21
|
keyword_scan = @query.scan(regex)
|
21
22
|
@query = @query.gsub(regex, '')
|
22
23
|
|
23
|
-
next
|
24
|
+
next if keyword_scan.blank?
|
24
25
|
keyword_scan.each do |term|
|
25
26
|
found_terms_hash[keyword] ||= []
|
26
27
|
found_terms_hash[keyword] << term.delete(' ').split(':')[1]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
module TopicCommon
|
4
5
|
extend ActiveSupport::Concern
|
@@ -6,7 +7,7 @@ module Thredded
|
|
6
7
|
paginates_per 50 if respond_to?(:paginates_per)
|
7
8
|
|
8
9
|
belongs_to :last_user,
|
9
|
-
class_name:
|
10
|
+
class_name: Thredded.user_class_name,
|
10
11
|
foreign_key: 'last_user_id'
|
11
12
|
|
12
13
|
scope :order_recently_posted_first, -> { order(last_post_at: :desc, id: :desc) }
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class Category < ActiveRecord::Base
|
4
5
|
extend FriendlyId
|
5
6
|
belongs_to :messageboard
|
6
7
|
has_many :topic_categories
|
7
8
|
has_many :topics, through: :topic_categories
|
8
|
-
friendly_id :name, use: [
|
9
|
+
friendly_id :name, use: %i[history scoped], scope: :messageboard
|
9
10
|
|
10
11
|
validates :name, presence: true
|
11
12
|
validates :messageboard_id, presence: true
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class Messageboard < ActiveRecord::Base
|
4
5
|
extend FriendlyId
|
5
6
|
friendly_id :slug_candidates,
|
6
|
-
use: [
|
7
|
+
use: %i[slugged reserved],
|
7
8
|
# Avoid route conflicts
|
8
9
|
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(
|
9
|
-
%w
|
10
|
+
%w[
|
10
11
|
admin
|
11
12
|
autocomplete-users
|
12
13
|
messageboards
|
@@ -15,7 +16,7 @@ module Thredded
|
|
15
16
|
private-posts
|
16
17
|
private-topics
|
17
18
|
theme-preview
|
18
|
-
|
19
|
+
]
|
19
20
|
)
|
20
21
|
|
21
22
|
validates :name, uniqueness: true, length: { maximum: 60 }, presence: true
|
@@ -45,7 +46,7 @@ module Thredded
|
|
45
46
|
through: :messageboard_users,
|
46
47
|
source: :user_detail
|
47
48
|
has_many :recently_active_users,
|
48
|
-
class_name: Thredded.
|
49
|
+
class_name: Thredded.user_class_name,
|
49
50
|
through: :recently_active_user_details,
|
50
51
|
source: :user
|
51
52
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class MessageboardNotificationsForFollowedTopics < ActiveRecord::Base
|
4
5
|
belongs_to :user_preference,
|
@@ -6,7 +7,7 @@ module Thredded
|
|
6
7
|
foreign_key: :user_id,
|
7
8
|
inverse_of: :messageboard_notifications_for_followed_topics
|
8
9
|
belongs_to :user,
|
9
|
-
class_name: Thredded.
|
10
|
+
class_name: Thredded.user_class_name,
|
10
11
|
inverse_of: :thredded_user_messageboard_preferences
|
11
12
|
belongs_to :messageboard
|
12
13
|
scope :for_messageboard, ->(messageboard) { where(messageboard_id: messageboard.id) }
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class NotificationsForFollowedTopics < ActiveRecord::Base
|
4
5
|
belongs_to :user,
|
5
|
-
class_name: Thredded.
|
6
|
+
class_name: Thredded.user_class_name,
|
6
7
|
inverse_of: :thredded_notifications_for_followed_topics
|
7
8
|
belongs_to :messageboard # or is global
|
8
9
|
belongs_to :user_preference,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class NotificationsForPrivateTopics < ActiveRecord::Base
|
4
5
|
belongs_to :user,
|
5
|
-
class_name: Thredded.
|
6
|
+
class_name: Thredded.user_class_name,
|
6
7
|
inverse_of: :thredded_notifications_for_private_topics
|
7
8
|
belongs_to :user_preference,
|
8
9
|
primary_key: :user_id,
|
data/app/models/thredded/post.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class Post < ActiveRecord::Base
|
4
5
|
include Thredded::PostCommon
|
5
6
|
include Thredded::ContentModerationState
|
6
7
|
|
7
8
|
belongs_to :user,
|
8
|
-
class_name: Thredded.
|
9
|
+
class_name: Thredded.user_class_name,
|
9
10
|
inverse_of: :thredded_posts
|
10
11
|
belongs_to :messageboard,
|
11
12
|
counter_cache: true
|
@@ -29,10 +30,10 @@ module Thredded
|
|
29
30
|
|
30
31
|
validates :messageboard_id, presence: true
|
31
32
|
|
32
|
-
after_commit :update_parent_last_user_and_time_from_last_post, on: [
|
33
|
+
after_commit :update_parent_last_user_and_time_from_last_post, on: %i[create destroy]
|
33
34
|
after_commit :update_parent_last_user_and_time_from_last_post_if_moderation_state_changed, on: :update
|
34
35
|
|
35
|
-
after_commit :auto_follow_and_notify, on: [
|
36
|
+
after_commit :auto_follow_and_notify, on: %i[create update]
|
36
37
|
|
37
38
|
# @param [Integer] per_page
|
38
39
|
# @param [Thredded.user_class] user
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class PostModerationRecord < ActiveRecord::Base
|
4
5
|
include Thredded::ModerationState
|
@@ -13,8 +14,8 @@ module Thredded
|
|
13
14
|
belongs_to :messageboard, inverse_of: :post_moderation_records
|
14
15
|
validates :messageboard_id, presence: true
|
15
16
|
belongs_to :post, inverse_of: :moderation_records
|
16
|
-
belongs_to :post_user, class_name: Thredded.
|
17
|
-
belongs_to :moderator, class_name: Thredded.
|
17
|
+
belongs_to :post_user, class_name: Thredded.user_class_name, inverse_of: :thredded_post_moderation_records
|
18
|
+
belongs_to :moderator, class_name: Thredded.user_class_name, inverse_of: :thredded_post_moderation_records
|
18
19
|
|
19
20
|
validates_each :moderation_state do |record, attr, value|
|
20
21
|
if record.previous_moderation_state == value
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class PrivatePost < ActiveRecord::Base
|
4
5
|
include Thredded::PostCommon
|
5
6
|
|
6
7
|
belongs_to :user,
|
7
|
-
class_name: Thredded.
|
8
|
+
class_name: Thredded.user_class_name,
|
8
9
|
inverse_of: :thredded_private_posts
|
9
10
|
belongs_to :postable,
|
10
11
|
class_name: 'Thredded::PrivateTopic',
|
@@ -15,7 +16,7 @@ module Thredded
|
|
15
16
|
primary_key: :user_id,
|
16
17
|
foreign_key: :user_id
|
17
18
|
|
18
|
-
after_commit :update_parent_last_user_and_timestamp, on: [
|
19
|
+
after_commit :update_parent_last_user_and_timestamp, on: %i[create destroy]
|
19
20
|
after_commit :notify_users, on: [:create]
|
20
21
|
|
21
22
|
# @param [Integer] per_page
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class PrivateTopic < ActiveRecord::Base
|
4
5
|
include Thredded::TopicCommon
|
@@ -7,12 +8,12 @@ module Thredded
|
|
7
8
|
|
8
9
|
extend FriendlyId
|
9
10
|
friendly_id :slug_candidates,
|
10
|
-
use: [
|
11
|
+
use: %i[history reserved],
|
11
12
|
# Avoid route conflicts
|
12
|
-
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(%w
|
13
|
+
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(%w[new])
|
13
14
|
|
14
15
|
belongs_to :user,
|
15
|
-
class_name: Thredded.
|
16
|
+
class_name: Thredded.user_class_name,
|
16
17
|
inverse_of: :thredded_private_topics
|
17
18
|
belongs_to :user_detail,
|
18
19
|
primary_key: :user_id,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class PrivateUser < ActiveRecord::Base
|
4
5
|
belongs_to :private_topic, inverse_of: :private_users
|
5
|
-
belongs_to :user, class_name: Thredded.
|
6
|
+
belongs_to :user, class_name: Thredded.user_class_name, inverse_of: :thredded_private_users
|
6
7
|
end
|
7
8
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class Topic < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
|
4
5
|
include Thredded::TopicCommon
|
@@ -22,12 +23,12 @@ module Thredded
|
|
22
23
|
|
23
24
|
extend FriendlyId
|
24
25
|
friendly_id :slug_candidates,
|
25
|
-
use: %i
|
26
|
+
use: %i[history reserved],
|
26
27
|
# Avoid route conflicts
|
27
|
-
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(%w
|
28
|
+
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(%w[topics])
|
28
29
|
|
29
30
|
belongs_to :user,
|
30
|
-
class_name: Thredded.
|
31
|
+
class_name: Thredded.user_class_name,
|
31
32
|
inverse_of: :thredded_topics
|
32
33
|
|
33
34
|
belongs_to :messageboard,
|
@@ -67,14 +68,14 @@ module Thredded
|
|
67
68
|
inverse_of: :topic,
|
68
69
|
dependent: :destroy
|
69
70
|
has_many :followers,
|
70
|
-
class_name: Thredded.
|
71
|
+
class_name: Thredded.user_class_name,
|
71
72
|
source: :user,
|
72
73
|
through: :user_follows
|
73
74
|
|
74
75
|
delegate :name, to: :messageboard, prefix: true
|
75
76
|
|
76
77
|
after_commit :update_messageboard_last_topic, on: :update, if: -> { previous_changes.include?('moderation_state') }
|
77
|
-
|
78
|
+
after_commit :update_last_user_and_time_from_last_post!, if: -> { previous_changes.include?('moderation_state') }
|
78
79
|
|
79
80
|
after_commit :handle_messageboard_change_after_commit,
|
80
81
|
on: :update,
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class UserDetail < ActiveRecord::Base
|
4
5
|
include Thredded::ModerationState
|
5
6
|
|
6
|
-
belongs_to :user, class_name: Thredded.
|
7
|
+
belongs_to :user, class_name: Thredded.user_class_name, inverse_of: :thredded_user_detail
|
7
8
|
validates :user_id, presence: true, uniqueness: true
|
8
9
|
|
9
10
|
has_many :topics, class_name: 'Thredded::Topic', foreign_key: :user_id, primary_key: :user_id
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
module UserExtender
|
4
5
|
extend ActiveSupport::Concern
|
@@ -14,7 +15,7 @@ module Thredded
|
|
14
15
|
opt.has_many :thredded_posts, class_name: 'Thredded::Post'
|
15
16
|
opt.has_many :thredded_topics, class_name: 'Thredded::Topic'
|
16
17
|
opt.has_many :thredded_private_posts, class_name: 'Thredded::PrivatePost'
|
17
|
-
opt.has_many :
|
18
|
+
opt.has_many :thredded_started_private_topics, class_name: 'Thredded::PrivateTopic'
|
18
19
|
end
|
19
20
|
|
20
21
|
with_options dependent: :nullify, foreign_key: 'last_user_id', inverse_of: :last_user do |opt|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Thredded
|
3
4
|
class UserMessageboardPreference < ActiveRecord::Base
|
4
5
|
belongs_to :user_preference,
|
@@ -6,7 +7,7 @@ module Thredded
|
|
6
7
|
foreign_key: :user_id,
|
7
8
|
inverse_of: :messageboard_preferences
|
8
9
|
belongs_to :user,
|
9
|
-
class_name: Thredded.
|
10
|
+
class_name: Thredded.user_class_name,
|
10
11
|
inverse_of: :thredded_user_messageboard_preferences
|
11
12
|
belongs_to :messageboard
|
12
13
|
|