thredded 0.0.1 → 0.1.0

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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. metadata +303 -193
  3. data/MIT-LICENSE +0 -20
  4. data/README.mkdn +0 -46
  5. data/Rakefile +0 -31
  6. data/app/assets/javascripts/thredded/application.js +0 -15
  7. data/app/assets/stylesheets/thredded/application.css +0 -13
  8. data/app/controllers/thredded/application_controller.rb +0 -50
  9. data/app/controllers/thredded/messageboards_controller.rb +0 -9
  10. data/app/controllers/thredded/posts_controller.rb +0 -86
  11. data/app/controllers/thredded/preferences_controller.rb +0 -20
  12. data/app/controllers/thredded/private_topics_controller.rb +0 -25
  13. data/app/controllers/thredded/setups_controller.rb +0 -39
  14. data/app/controllers/thredded/topics_controller.rb +0 -121
  15. data/app/decorators/thredded/post_decorator.rb +0 -52
  16. data/app/decorators/thredded/topic_decorator.rb +0 -96
  17. data/app/helpers/thredded/application_helper.rb +0 -9
  18. data/app/helpers/thredded/messageboard_helper.rb +0 -52
  19. data/app/helpers/thredded/posts_helper.rb +0 -7
  20. data/app/helpers/thredded/topics_helper.rb +0 -21
  21. data/app/mailers/thredded/post_mailer.rb +0 -28
  22. data/app/mailers/thredded/topic_mailer.rb +0 -29
  23. data/app/models/thredded/ability.rb +0 -50
  24. data/app/models/thredded/attachment.rb +0 -24
  25. data/app/models/thredded/category.rb +0 -10
  26. data/app/models/thredded/image.rb +0 -27
  27. data/app/models/thredded/messageboard.rb +0 -92
  28. data/app/models/thredded/messageboard_decorator.rb +0 -18
  29. data/app/models/thredded/messageboard_preference.rb +0 -15
  30. data/app/models/thredded/null_preference.rb +0 -9
  31. data/app/models/thredded/null_topic_read.rb +0 -13
  32. data/app/models/thredded/null_user.rb +0 -27
  33. data/app/models/thredded/post.rb +0 -75
  34. data/app/models/thredded/post_notification.rb +0 -6
  35. data/app/models/thredded/private_topic.rb +0 -33
  36. data/app/models/thredded/private_user.rb +0 -7
  37. data/app/models/thredded/role.rb +0 -18
  38. data/app/models/thredded/topic.rb +0 -145
  39. data/app/models/thredded/topic_category.rb +0 -7
  40. data/app/models/thredded/user_detail.rb +0 -6
  41. data/app/models/thredded/user_extender.rb +0 -27
  42. data/app/models/thredded/user_preference.rb +0 -6
  43. data/app/models/thredded/user_topic_read.rb +0 -67
  44. data/app/uploaders/thredded/attachment_uploader.rb +0 -30
  45. data/app/uploaders/thredded/image_uploader.rb +0 -17
  46. data/app/views/thredded/messageboards/_messageboard.html.erb +0 -17
  47. data/app/views/thredded/messageboards/index.html.erb +0 -15
  48. data/app/views/thredded/post_mailer/at_notification.html.erb +0 -17
  49. data/app/views/thredded/post_mailer/at_notification.text.erb +0 -13
  50. data/app/views/thredded/posts/_form.html.erb +0 -25
  51. data/app/views/thredded/posts/_null_user.html.erb +0 -0
  52. data/app/views/thredded/posts/_post.html.erb +0 -25
  53. data/app/views/thredded/posts/_user.html.erb +0 -7
  54. data/app/views/thredded/posts/edit.html.erb +0 -28
  55. data/app/views/thredded/posts/index.html.erb +0 -74
  56. data/app/views/thredded/preferences/edit.html.erb +0 -23
  57. data/app/views/thredded/search/_form.html.erb +0 -9
  58. data/app/views/thredded/setups/_form.html.erb +0 -35
  59. data/app/views/thredded/setups/new.html.erb +0 -5
  60. data/app/views/thredded/shared/_currently_online.html.erb +0 -10
  61. data/app/views/thredded/shared/_error_msgs.html.erb +0 -7
  62. data/app/views/thredded/shared/_google_analytics.html.erb +0 -10
  63. data/app/views/thredded/shared/_topic_nav.html.erb +0 -18
  64. data/app/views/thredded/topic_mailer/message_notification.html.erb +0 -17
  65. data/app/views/thredded/topic_mailer/message_notification.text.erb +0 -13
  66. data/app/views/thredded/topics/_form.html.erb +0 -6
  67. data/app/views/thredded/topics/_topic_condensed.html.erb +0 -20
  68. data/app/views/thredded/topics/_topic_form.html.erb +0 -27
  69. data/app/views/thredded/topics/by_category.html.erb +0 -51
  70. data/app/views/thredded/topics/edit.html.erb +0 -25
  71. data/app/views/thredded/topics/index.html.erb +0 -52
  72. data/app/views/thredded/topics/menu/_new_topic.html.erb +0 -3
  73. data/app/views/thredded/topics/new.html.erb +0 -18
  74. data/app/views/thredded/topics/search.html.erb +0 -45
  75. data/config/routes.rb +0 -26
  76. data/db/migrate/20130425230852_create_thredded_tables.rb +0 -143
  77. data/lib/tasks/thredded_tasks.rake +0 -4
  78. data/lib/thredded/at_notification_extractor.rb +0 -15
  79. data/lib/thredded/at_notifier.rb +0 -65
  80. data/lib/thredded/at_users.rb +0 -17
  81. data/lib/thredded/email_processor.rb +0 -74
  82. data/lib/thredded/engine.rb +0 -17
  83. data/lib/thredded/filter/at_notification.rb +0 -11
  84. data/lib/thredded/filter/attachment.rb +0 -51
  85. data/lib/thredded/filter/base.rb +0 -13
  86. data/lib/thredded/filter/bbcode.rb +0 -75
  87. data/lib/thredded/filter/emoji.rb +0 -11
  88. data/lib/thredded/filter/markdown.rb +0 -25
  89. data/lib/thredded/filter/syntax.rb +0 -28
  90. data/lib/thredded/filter/textile.rb +0 -21
  91. data/lib/thredded/filter.rb +0 -4
  92. data/lib/thredded/messageboard_user_permissions.rb +0 -27
  93. data/lib/thredded/post_sql_builder.rb +0 -34
  94. data/lib/thredded/post_user_permissions.rb +0 -37
  95. data/lib/thredded/private_topic_notifier.rb +0 -56
  96. data/lib/thredded/private_topic_user_permissions.rb +0 -32
  97. data/lib/thredded/search_parser.rb +0 -45
  98. data/lib/thredded/search_sql_builder.rb +0 -25
  99. data/lib/thredded/setup_thredded.rb +0 -7
  100. data/lib/thredded/table_sql_builder.rb +0 -105
  101. data/lib/thredded/topic_sql_builder.rb +0 -32
  102. data/lib/thredded/topic_user_permissions.rb +0 -51
  103. data/lib/thredded/version.rb +0 -3
  104. data/lib/thredded.rb +0 -38
@@ -1,7 +0,0 @@
1
- module Thredded
2
- module PostsHelper
3
- def link_to_edit_post(site, messageboard, topic, post)
4
- path = edit_messageboard_topic_post_path(messageboard.name, topic, post)
5
- end
6
- end
7
- end
@@ -1,21 +0,0 @@
1
- module Thredded
2
- module TopicsHelper
3
- require 'digest/md5'
4
-
5
- def md5(s)
6
- Digest::MD5.hexdigest(s)
7
- end
8
-
9
- def already_read(topic, tracked_user_reads)
10
- if tracked_user_reads
11
- topic_status = tracked_user_reads.select{ |t| t.topic_id == topic.id }.first
12
-
13
- if topic_status && topic_status.posts_count == topic.posts_count
14
- 'read'
15
- else
16
- 'unread'
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,28 +0,0 @@
1
- module Thredded
2
- class PostMailer < ActionMailer::Base
3
- def at_notification(post_id, user_emails)
4
- @post = Post.find(post_id)
5
-
6
- headers['X-SMTPAPI'] = %Q{{"category": ["thredded_#{@post.messageboard.name}","at_notification"]}}
7
- mail from: no_reply,
8
- to: no_reply,
9
- bcc: user_emails,
10
- reply_to: reply_to,
11
- subject: subject
12
- end
13
-
14
- private
15
-
16
- def subject
17
- "#{Thredded.email_outgoing_prefix} #{@post.topic.title}"
18
- end
19
-
20
- def reply_to
21
- "#{@post.topic.hash_id}@#{Thredded.email_incoming_host}"
22
- end
23
-
24
- def no_reply
25
- Thredded.email_from
26
- end
27
- end
28
- end
@@ -1,29 +0,0 @@
1
- module Thredded
2
- class TopicMailer < ActionMailer::Base
3
- def message_notification(topic_id, emails)
4
- @topic = Topic.find(topic_id)
5
- headers['X-SMTPAPI'] =
6
- %Q{{"category": ["thredded_#{@topic.messageboard.name}","at_notification"]}}
7
-
8
- mail from: no_reply,
9
- to: no_reply,
10
- bcc: emails,
11
- reply_to: reply_to,
12
- subject: subject
13
- end
14
-
15
- private
16
-
17
- def subject
18
- "#{Thredded.email_outgoing_prefix} #{@topic.title}"
19
- end
20
-
21
- def reply_to
22
- "#{@topic.hash_id}@#{Thredded.email_incoming_host}"
23
- end
24
-
25
- def no_reply
26
- Thredded.email_from
27
- end
28
- end
29
- end
@@ -1,50 +0,0 @@
1
- module Thredded
2
- class Ability
3
- include ::CanCan::Ability
4
-
5
- def initialize(user)
6
- user ||= Thredded::NullUser.new
7
- user_details = Thredded::UserDetail.where(user_id: user.id).first
8
-
9
- can :manage, :all if user_details.try(:superadmin?)
10
-
11
- can :read, Thredded::Messageboard do |messageboard|
12
- Thredded::MessageboardUserPermissions.new(messageboard, user).readable?
13
- end
14
-
15
- can :manage, Thredded::Topic do |topic|
16
- Thredded::TopicUserPermissions.new(topic, user, user_details).manageable?
17
- end
18
-
19
- can :read, Thredded::Topic do |topic|
20
- Thredded::TopicUserPermissions.new(topic, user, user_details).readable?
21
- end
22
-
23
- can :create, Thredded::Topic do |topic|
24
- Thredded::TopicUserPermissions.new(topic, user, user_details).creatable?
25
- end
26
-
27
- cannot :manage, Thredded::PrivateTopic
28
-
29
- can :manage, Thredded::PrivateTopic do |private_topic|
30
- Thredded::PrivateTopicUserPermissions.new(private_topic, user, user_details).manageable?
31
- end
32
-
33
- can :create, Thredded::PrivateTopic do |private_topic|
34
- Thredded::PrivateTopicUserPermissions.new(private_topic, user, user_details).creatable?
35
- end
36
-
37
- can :read, Thredded::PrivateTopic do |private_topic|
38
- Thredded::PrivateTopicUserPermissions.new(private_topic, user, user_details).readable?
39
- end
40
-
41
- can :manage, Thredded::Post do |post|
42
- Thredded::PostUserPermissions.new(post, user, user_details).manageable?
43
- end
44
-
45
- can :create, Thredded::Post do |post|
46
- Thredded::PostUserPermissions.new(post, user, user_details).creatable?
47
- end
48
- end
49
- end
50
- end
@@ -1,24 +0,0 @@
1
- module Thredded
2
- class Attachment < ActiveRecord::Base
3
- belongs_to :post
4
- validates_presence_of :attachment
5
- attr_accessible :attachment
6
- mount_uploader :attachment, Thredded::AttachmentUploader
7
- before_save :update_attachment_attributes
8
-
9
- def cache_dir
10
- "#{Rails.root}/tmp/uploads"
11
- end
12
-
13
- def filename
14
- File.basename(attachment.path)
15
- end
16
-
17
- def update_attachment_attributes
18
- if attachment.present? && attachment_changed?
19
- self.content_type = attachment.file.content_type
20
- self.file_size = attachment.file.size
21
- end
22
- end
23
- end
24
- end
@@ -1,10 +0,0 @@
1
- module Thredded
2
- class Category < ActiveRecord::Base
3
- attr_accessible :description, :messageboard_id, :name
4
- validates :name, presence: true
5
-
6
- belongs_to :messageboard
7
- has_many :topic_categories
8
- has_many :topics, through: :topic_categories
9
- end
10
- end
@@ -1,27 +0,0 @@
1
- module Thredded
2
- class Image < ActiveRecord::Base
3
- mount_uploader :image, ImageUploader
4
- attr_accessible :height, :orientation, :width
5
- validates :image, presence: true
6
- before_validation :save_dimensions, :save_orientation, :save_position
7
-
8
- private
9
-
10
- def save_dimensions
11
- if image.path
12
- self.width = MiniMagick::Image.open(image.path)[:width]
13
- self.height = MiniMagick::Image.open(image.path)[:height]
14
- end
15
- end
16
-
17
- def save_orientation
18
- if image.path
19
- self.orientation = (height.to_i > width.to_i) ? 'portrait' : 'landscape'
20
- end
21
- end
22
-
23
- def save_position
24
- self.position = (self._index + 1) if self.new_record? and self._index
25
- end
26
- end
27
- end
@@ -1,92 +0,0 @@
1
- module Thredded
2
- class Messageboard < ActiveRecord::Base
3
- SECURITY = %w{private logged_in public}
4
- PERMISSIONS = %w{members logged_in anonymous}
5
-
6
- extend FriendlyId
7
- friendly_id :name
8
-
9
- attr_accessible :description,
10
- :name,
11
- :posting_permission,
12
- :security
13
-
14
- default_scope where(closed: false).order('topics_count DESC')
15
-
16
- validates_numericality_of :topics_count
17
- validates_inclusion_of :security, in: SECURITY
18
- validates_inclusion_of :posting_permission, in: PERMISSIONS
19
- validates_presence_of :name
20
- validates_format_of :name, with: /\A[\w\-]+\z/, on: :create,
21
- message: 'should be letters, nums, dash, underscore only.'
22
- validates_uniqueness_of :name,
23
- message: 'must be a unique board name. Try again.'
24
- validates_length_of :name, within: 1..16,
25
- message: 'should be between 1 and 16 characters'
26
-
27
- has_many :categories
28
- has_many :messageboard_preferences
29
- has_many :posts
30
- has_many :roles
31
- has_many :topics
32
- has_many :private_topics
33
- has_many :users, through: :roles, class_name: Thredded.user_class
34
-
35
- def active_users
36
- Role
37
- .joins(:user)
38
- .where(messageboard_id: self.id)
39
- .where('last_seen > ?', 5.minutes.ago)
40
- .order(:last_seen)
41
- .map(&:user)
42
- end
43
-
44
- def decorate
45
- MessageboardDecorator.new(self)
46
- end
47
-
48
- def add_member(user, as='member')
49
- roles.create(user_id: user.id, level: as)
50
- end
51
-
52
- def has_member?(user)
53
- roles.where(user_id: user.id).exists?
54
- end
55
-
56
- def member_is_a?(user, as)
57
- roles.where(user_id: user.id, level: as).exists?
58
- end
59
-
60
- def members_from_list(user_list)
61
- users.where('lower(name) in (?)', user_list.map(&:downcase))
62
- end
63
-
64
- def posting_for_anonymous?
65
- 'anonymous' == posting_permission
66
- end
67
-
68
- def posting_for_logged_in?
69
- 'logged_in' == posting_permission
70
- end
71
-
72
- def posting_for_members?
73
- 'members' == posting_permission
74
- end
75
-
76
- def public?
77
- 'public' == security
78
- end
79
-
80
- def restricted_to_logged_in?
81
- 'logged_in' == security
82
- end
83
-
84
- def restricted_to_private?
85
- 'private' == security
86
- end
87
-
88
- def to_param
89
- name.downcase
90
- end
91
- end
92
- end
@@ -1,18 +0,0 @@
1
- module Thredded
2
- class MessageboardDecorator < SimpleDelegator
3
- attr_reader :messageboard
4
-
5
- def initialize(messageboard)
6
- super
7
- @messageboard = messageboard
8
- end
9
-
10
- def category_options
11
- messageboard.categories.collect { |cat| [cat.name, cat.id] }
12
- end
13
-
14
- def users_options
15
- messageboard.users.collect{ |user| [user.name, user.id] }
16
- end
17
- end
18
- end
@@ -1,15 +0,0 @@
1
- module Thredded
2
- class MessageboardPreference < ActiveRecord::Base
3
- attr_accessible :notify_on_mention, :notify_on_message, :filter
4
- belongs_to :user
5
- belongs_to :messageboard
6
-
7
- def self.for(user)
8
- where(user_id: user.id)
9
- end
10
-
11
- def self.in(messageboard)
12
- where(messageboard_id: messageboard.id)
13
- end
14
- end
15
- end
@@ -1,9 +0,0 @@
1
- class NullPreference
2
- def notify_on_mention
3
- true
4
- end
5
-
6
- def notify_on_message
7
- true
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- class NullTopicRead
2
- def update_status(topic)
3
- # ¯\_(ツ)_/¯
4
- end
5
-
6
- def page
7
- 0
8
- end
9
-
10
- def post_id
11
- 0
12
- end
13
- end
@@ -1,27 +0,0 @@
1
- module Thredded
2
- class NullUser
3
- def admins?(messageboard)
4
- false
5
- end
6
-
7
- def can_read_messageboard?(messageboard)
8
- messageboard.public?
9
- end
10
-
11
- def id
12
- 0
13
- end
14
-
15
- def member_of?(messageboard)
16
- false
17
- end
18
-
19
- def name
20
- 'Anonymous User'
21
- end
22
-
23
- def valid?
24
- false
25
- end
26
- end
27
- end
@@ -1,75 +0,0 @@
1
- module Thredded
2
- class Post < ActiveRecord::Base
3
- require 'gravtastic'
4
- include Gravtastic
5
- include Thredded::Filter::Base
6
- include Thredded::Filter::Textile
7
- include Thredded::Filter::Bbcode
8
- include Thredded::Filter::Markdown
9
- include Thredded::Filter::Attachment
10
- include Thredded::Filter::Emoji
11
- include Thredded::Filter::AtNotification
12
-
13
- gravtastic :user_email
14
- paginates_per 50
15
-
16
- attr_accessible :attachments_attributes,
17
- :content,
18
- :filter,
19
- :ip,
20
- :messageboard,
21
- :source,
22
- :topic,
23
- :user
24
-
25
- default_scope order: 'id ASC'
26
-
27
- belongs_to :messageboard, counter_cache: true
28
- belongs_to :topic, counter_cache: true
29
- belongs_to :user, class_name: Thredded.user_class
30
- has_many :attachments
31
- has_many :post_notifications
32
-
33
- accepts_nested_attributes_for :attachments
34
-
35
- validates_presence_of :content, :messageboard_id
36
-
37
- before_validation :set_user_email
38
- after_create :modify_parent_topic
39
-
40
- def create
41
- UserDetail.increment_counter(:posts_count, user_id)
42
- super
43
- end
44
-
45
- def created_date
46
- created_at.strftime("%b %d, %Y %I:%M:%S %Z") if created_at
47
- end
48
-
49
- def created_timestamp
50
- created_at.strftime("%Y-%m-%dT%H:%M:%S") if created_at
51
- end
52
-
53
- def gravatar_url
54
- super.gsub /http:/, ''
55
- end
56
-
57
- def self.filters
58
- ['bbcode', 'markdown']
59
- end
60
-
61
- private
62
-
63
- def modify_parent_topic
64
- topic.last_user = user
65
- topic.touch
66
- topic.save
67
- end
68
-
69
- def set_user_email
70
- if user
71
- self.user_email = user.email
72
- end
73
- end
74
- end
75
- end
@@ -1,6 +0,0 @@
1
- module Thredded
2
- class PostNotification < ActiveRecord::Base
3
- attr_accessible :email, :post_id
4
- belongs_to :post
5
- end
6
- end
@@ -1,33 +0,0 @@
1
- module Thredded
2
- class PrivateTopic < Thredded::Topic
3
- has_many :private_users
4
- has_many :users, through: :private_users
5
- attr_accessible :user_id
6
-
7
- def add_user(user)
8
- if String == user.class
9
- user = User.find_by_name(user)
10
- end
11
-
12
- users << user
13
- end
14
-
15
- def public?
16
- false
17
- end
18
-
19
- def private?
20
- true
21
- end
22
-
23
- def user_id=(ids)
24
- if ids.size > 0
25
- self.users = User.where(id: ids.uniq)
26
- end
27
- end
28
-
29
- def users_to_sentence
30
- users.map{ |user| user.name.capitalize }.to_sentence
31
- end
32
- end
33
- end
@@ -1,7 +0,0 @@
1
- module Thredded
2
- class PrivateUser < ActiveRecord::Base
3
- attr_accessible :private_topic_id, :user_id
4
- belongs_to :private_topic
5
- belongs_to :user
6
- end
7
- end
@@ -1,18 +0,0 @@
1
- module Thredded
2
- class Role < ActiveRecord::Base
3
- ROLES = ['superadmin', 'admin', 'moderator', 'member']
4
-
5
- belongs_to :messageboard
6
- belongs_to :user, class_name: Thredded.user_class
7
-
8
- validates_presence_of :level
9
- validates_inclusion_of :level, in: ROLES
10
- validates_presence_of :messageboard_id
11
- validates_presence_of :user_id
12
-
13
- attr_accessible :level, :messageboard_id, :user_id
14
-
15
- scope :for, lambda { |messageboard| where(messageboard_id: messageboard.id) }
16
- scope :as, lambda { |role| where(level: role) }
17
- end
18
- end
@@ -1,145 +0,0 @@
1
- require 'thredded/search_sql_builder'
2
-
3
- module Thredded
4
- class Topic < ActiveRecord::Base
5
- STATES = %w{pending approved}
6
-
7
- extend FriendlyId
8
- friendly_id :title, use: :scoped, scope: :messageboard
9
- paginates_per 50 if self.respond_to?(:paginates_per)
10
-
11
- has_many :posts, include: :attachments
12
- has_many :topic_categories
13
- has_many :categories, through: :topic_categories
14
-
15
- belongs_to :last_user, class_name: Thredded.user_class,
16
- foreign_key: 'last_user_id'
17
-
18
- belongs_to :user, class_name: Thredded.user_class
19
-
20
- belongs_to :messageboard, counter_cache: true, touch: true
21
-
22
- validates_inclusion_of :state, in: STATES
23
- validates_presence_of :hash_id
24
- validates_presence_of :last_user_id
25
- validates_presence_of :messageboard_id
26
- validates_numericality_of :posts_count
27
- validates_uniqueness_of :hash_id
28
-
29
- attr_accessible :category_ids,
30
- :last_user,
31
- :locked,
32
- :messageboard,
33
- :posts_attributes,
34
- :sticky,
35
- :type,
36
- :title,
37
- :user,
38
- :usernames
39
-
40
- accepts_nested_attributes_for :posts, reject_if: :updating?
41
- accepts_nested_attributes_for :categories
42
-
43
- default_scope order('updated_at DESC')
44
-
45
- delegate :name, :name=, :email, :email=, to: :user, prefix: true
46
-
47
- before_validation do
48
- self.hash_id = SecureRandom.hex(10) if self.hash_id.nil?
49
- end
50
-
51
- def self.stuck
52
- where(sticky: true)
53
- end
54
-
55
- def self.unstuck
56
- where(sticky: false)
57
- end
58
-
59
- def self.on_page(page_num)
60
- page(page_num).per(30)
61
- end
62
-
63
- def self.for_messageboard(messageboard)
64
- where(messageboard_id: messageboard.id)
65
- end
66
-
67
- def self.order_by_updated
68
- order('updated_at DESC')
69
- end
70
-
71
- def self.full_text_search(query, messageboard)
72
- if query.empty?
73
- []
74
- else
75
- sql_builder = SearchSqlBuilder.new(query, messageboard)
76
- sql = sql_builder.build
77
- sql_params = [sql].concat(sql_builder.binds)
78
- find_by_sql sql_params
79
- end
80
- end
81
-
82
- def self.decorate
83
- all.map do |topic|
84
- TopicDecorator.new(topic)
85
- end
86
- end
87
-
88
- def decorate
89
- TopicDecorator.new(self)
90
- end
91
-
92
- def create
93
- UserDetail.increment_counter(:topics_count, user_id)
94
- super
95
- end
96
-
97
- def last_user
98
- super || NullUser.new
99
- end
100
-
101
- def public?
102
- true
103
- end
104
-
105
- def private?
106
- false
107
- end
108
-
109
- def pending?
110
- state == 'pending'
111
- end
112
-
113
- def users
114
- []
115
- end
116
-
117
- def users_to_sentence
118
- ''
119
- end
120
-
121
- def self.inherited(child)
122
- child.instance_eval do
123
- def model_name
124
- Topic.model_name
125
- end
126
- end
127
-
128
- super
129
- end
130
-
131
- def self.select_options
132
- subclasses.map(&:to_s).sort
133
- end
134
-
135
- def updating?
136
- id.present?
137
- end
138
-
139
- def categories_to_sentence
140
- if categories
141
- categories.map(&:name).to_sentence
142
- end
143
- end
144
- end
145
- end
@@ -1,7 +0,0 @@
1
- module Thredded
2
- class TopicCategory < ActiveRecord::Base
3
- attr_accessible :category_id, :topic_id
4
- belongs_to :category
5
- belongs_to :topic
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- module Thredded
2
- class UserDetail < ActiveRecord::Base
3
- belongs_to :user, class_name: Thredded.user_class
4
- validates :user_id, presence: true
5
- end
6
- end