thredded 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/commands/thredded/at_notification_extractor.rb +1 -0
  4. data/app/commands/thredded/autofollow_users.rb +1 -0
  5. data/app/commands/thredded/create_messageboard.rb +1 -0
  6. data/app/commands/thredded/mark_all_read.rb +1 -0
  7. data/app/commands/thredded/moderate_post.rb +1 -0
  8. data/app/commands/thredded/notify_following_users.rb +1 -0
  9. data/app/commands/thredded/notify_private_topic_users.rb +1 -0
  10. data/app/controllers/concerns/thredded/new_post_params.rb +1 -0
  11. data/app/controllers/concerns/thredded/new_private_post_params.rb +1 -0
  12. data/app/controllers/concerns/thredded/new_private_topic_params.rb +1 -0
  13. data/app/controllers/concerns/thredded/new_topic_params.rb +1 -0
  14. data/app/controllers/concerns/thredded/render_preview.rb +1 -0
  15. data/app/controllers/thredded/application_controller.rb +1 -0
  16. data/app/controllers/thredded/autocomplete_users_controller.rb +1 -0
  17. data/app/controllers/thredded/messageboards_controller.rb +4 -3
  18. data/app/controllers/thredded/moderation_controller.rb +1 -0
  19. data/app/controllers/thredded/post_permalinks_controller.rb +1 -0
  20. data/app/controllers/thredded/post_previews_controller.rb +1 -0
  21. data/app/controllers/thredded/posts_controller.rb +1 -0
  22. data/app/controllers/thredded/preferences_controller.rb +4 -3
  23. data/app/controllers/thredded/private_post_permalinks_controller.rb +1 -0
  24. data/app/controllers/thredded/private_post_previews_controller.rb +1 -0
  25. data/app/controllers/thredded/private_posts_controller.rb +1 -0
  26. data/app/controllers/thredded/private_topic_previews_controller.rb +1 -0
  27. data/app/controllers/thredded/private_topics_controller.rb +1 -0
  28. data/app/controllers/thredded/read_states_controller.rb +1 -0
  29. data/app/controllers/thredded/theme_previews_controller.rb +1 -0
  30. data/app/controllers/thredded/topic_previews_controller.rb +1 -0
  31. data/app/controllers/thredded/topics_controller.rb +5 -4
  32. data/app/forms/thredded/edit_topic_form.rb +1 -0
  33. data/app/forms/thredded/post_form.rb +2 -0
  34. data/app/forms/thredded/private_post_form.rb +2 -0
  35. data/app/forms/thredded/private_topic_form.rb +1 -0
  36. data/app/forms/thredded/topic_form.rb +1 -0
  37. data/app/forms/thredded/user_preferences_form.rb +1 -0
  38. data/app/helpers/thredded/application_helper.rb +1 -0
  39. data/app/helpers/thredded/nav_helper.rb +7 -6
  40. data/app/helpers/thredded/render_helper.rb +1 -0
  41. data/app/helpers/thredded/urls_helper.rb +1 -0
  42. data/app/jobs/thredded/activity_updater_job.rb +1 -0
  43. data/app/jobs/thredded/auto_follow_and_notify_job.rb +1 -0
  44. data/app/jobs/thredded/notify_private_topic_users_job.rb +1 -0
  45. data/app/mailer_previews/thredded/base_mailer_preview.rb +2 -1
  46. data/app/mailer_previews/thredded/post_mailer_preview.rb +3 -2
  47. data/app/mailer_previews/thredded/private_topic_mailer_preview.rb +2 -1
  48. data/app/mailers/thredded/base_mailer.rb +1 -0
  49. data/app/mailers/thredded/post_mailer.rb +1 -0
  50. data/app/mailers/thredded/private_topic_mailer.rb +1 -0
  51. data/app/models/concerns/thredded/content_moderation_state.rb +1 -0
  52. data/app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb +1 -0
  53. data/app/models/concerns/thredded/moderation_state.rb +2 -1
  54. data/app/models/concerns/thredded/notifier_preference.rb +1 -0
  55. data/app/models/concerns/thredded/post_common.rb +1 -0
  56. data/app/models/concerns/thredded/search_parser.rb +3 -2
  57. data/app/models/concerns/thredded/topic_common.rb +2 -1
  58. data/app/models/concerns/thredded/topics_search.rb +1 -0
  59. data/app/models/concerns/thredded/user_topic_read_state_common.rb +1 -0
  60. data/app/models/thredded/category.rb +2 -1
  61. data/app/models/thredded/messageboard.rb +5 -4
  62. data/app/models/thredded/messageboard_group.rb +1 -0
  63. data/app/models/thredded/messageboard_notifications_for_followed_topics.rb +2 -1
  64. data/app/models/thredded/messageboard_user.rb +1 -0
  65. data/app/models/thredded/notifications_for_followed_topics.rb +2 -1
  66. data/app/models/thredded/notifications_for_private_topics.rb +2 -1
  67. data/app/models/thredded/null_user.rb +1 -0
  68. data/app/models/thredded/null_user_topic_read_state.rb +1 -0
  69. data/app/models/thredded/post.rb +4 -3
  70. data/app/models/thredded/post_moderation_record.rb +3 -2
  71. data/app/models/thredded/private_post.rb +3 -2
  72. data/app/models/thredded/private_topic.rb +4 -3
  73. data/app/models/thredded/private_user.rb +2 -1
  74. data/app/models/thredded/stats.rb +1 -0
  75. data/app/models/thredded/topic.rb +6 -5
  76. data/app/models/thredded/topic_category.rb +1 -0
  77. data/app/models/thredded/user_detail.rb +2 -1
  78. data/app/models/thredded/user_extender.rb +2 -1
  79. data/app/models/thredded/user_messageboard_preference.rb +2 -1
  80. data/app/models/thredded/user_permissions/admin/if_admin_column_true.rb +1 -0
  81. data/app/models/thredded/user_permissions/admin/none.rb +1 -0
  82. data/app/models/thredded/user_permissions/message/readers_of_writeable_boards.rb +1 -0
  83. data/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb +1 -0
  84. data/app/models/thredded/user_permissions/moderate/none.rb +1 -0
  85. data/app/models/thredded/user_permissions/read/all.rb +1 -0
  86. data/app/models/thredded/user_permissions/write/all.rb +1 -0
  87. data/app/models/thredded/user_permissions/write/none.rb +1 -0
  88. data/app/models/thredded/user_post_notification.rb +2 -1
  89. data/app/models/thredded/user_preference.rb +2 -1
  90. data/app/models/thredded/user_private_topic_read_state.rb +2 -1
  91. data/app/models/thredded/user_topic_follow.rb +3 -2
  92. data/app/models/thredded/user_topic_read_state.rb +2 -1
  93. data/app/notifiers/thredded/base_notifier.rb +1 -1
  94. data/app/notifiers/thredded/email_notifier.rb +1 -0
  95. data/app/policies/thredded/messageboard_group_policy.rb +1 -0
  96. data/app/policies/thredded/messageboard_policy.rb +1 -0
  97. data/app/policies/thredded/post_policy.rb +1 -0
  98. data/app/policies/thredded/private_post_policy.rb +1 -0
  99. data/app/policies/thredded/private_topic_policy.rb +1 -0
  100. data/app/policies/thredded/topic_policy.rb +1 -0
  101. data/app/view_hooks/thredded/all_view_hooks.rb +1 -0
  102. data/app/view_models/thredded/base_topic_view.rb +1 -0
  103. data/app/view_models/thredded/messageboard_group_view.rb +1 -0
  104. data/app/view_models/thredded/post_view.rb +1 -0
  105. data/app/view_models/thredded/posts_page_view.rb +1 -0
  106. data/app/view_models/thredded/private_topic_view.rb +1 -0
  107. data/app/view_models/thredded/private_topics_page_view.rb +1 -0
  108. data/app/view_models/thredded/topic_email_view.rb +1 -0
  109. data/app/view_models/thredded/topic_posts_page_view.rb +1 -0
  110. data/app/view_models/thredded/topic_view.rb +1 -0
  111. data/app/view_models/thredded/topics_page_view.rb +1 -0
  112. data/app/views/thredded/messageboards/index.html.erb +2 -2
  113. data/app/views/thredded/posts_common/actions/_edit.html.erb +2 -1
  114. data/app/views/thredded/private_topics/_header.html.erb +2 -1
  115. data/app/views/thredded/topics/_header.html.erb +2 -1
  116. data/app/views/thredded/topics/index.html.erb +1 -1
  117. data/bin/rails +1 -0
  118. data/bin/rubocop +1 -0
  119. data/config/routes.rb +13 -12
  120. data/db/migrate/20160329231848_create_thredded.rb +75 -66
  121. data/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb +6 -3
  122. data/db/upgrade_migrations/20160723012349_upgrade_v0_6_to_v0_7.rb +4 -1
  123. data/db/upgrade_migrations/20161019150201_upgrade_v0_7_to_v0_8.rb +4 -1
  124. data/db/upgrade_migrations/20161113161801_upgrade_v0_8_to_v0_9.rb +11 -8
  125. data/db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb +12 -6
  126. data/db/upgrade_migrations/20170312131417_upgrade_thredded_v0_10_to_v0_11.rb +6 -3
  127. data/db/upgrade_migrations/20170420163138_upgrade_thredded_v0_11_to_v0_12.rb +4 -1
  128. data/lib/generators/thredded/install/install_generator.rb +1 -0
  129. data/lib/generators/thredded/install/templates/initializer.rb +1 -0
  130. data/lib/tasks/thredded_tasks.rake +1 -0
  131. data/lib/thredded.rb +7 -0
  132. data/lib/thredded/base_migration.rb +14 -0
  133. data/lib/thredded/collection_to_strings_with_cache_renderer.rb +1 -0
  134. data/lib/thredded/content_formatter.rb +7 -6
  135. data/lib/thredded/database_seeder.rb +1 -0
  136. data/lib/thredded/db_tools.rb +9 -8
  137. data/lib/thredded/email_transformer.rb +1 -0
  138. data/lib/thredded/email_transformer/onebox.rb +1 -0
  139. data/lib/thredded/engine.rb +3 -2
  140. data/lib/thredded/errors.rb +1 -0
  141. data/lib/thredded/formatting_demo_content.rb +1 -0
  142. data/lib/thredded/html_pipeline/at_mention_filter.rb +3 -2
  143. data/lib/thredded/html_pipeline/autolink_filter.rb +1 -0
  144. data/lib/thredded/html_pipeline/kramdown_filter.rb +2 -1
  145. data/lib/thredded/html_pipeline/onebox_filter.rb +2 -1
  146. data/lib/thredded/html_pipeline/wrap_iframes_filter.rb +1 -0
  147. data/lib/thredded/version.rb +2 -1
  148. data/lib/thredded/view_hooks/config.rb +1 -0
  149. data/lib/thredded/view_hooks/renderer.rb +1 -0
  150. metadata +5 -7
  151. data/db/upgrade_migrations/20160410111522_upgrade_v0_2_to_v0_3.rb +0 -63
  152. data/db/upgrade_migrations/20160429222452_upgrade_v0_3_to_v0_4.rb +0 -13
  153. data/db/upgrade_migrations/20160501151908_upgrade_v0_4_to_v0_5.rb +0 -56
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeV05ToV06 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeV05ToV06 < Thredded::BaseMigration
3
6
  def up
4
- add_column :thredded_messageboards, :last_topic_id, :integer
7
+ add_column :thredded_messageboards, :last_topic_id, column_type(:thredded_topics, :id)
5
8
  Thredded::Messageboard.reset_column_information
6
9
  Thredded::Messageboard.all.each do |messageboard|
7
- messageboard.update!(last_topic_id: messageboard.topics.order(updated_at: :desc, id: :desc).first.try(:id))
10
+ messageboard.update_column :last_topic_id, messageboard.topics.order(updated_at: :desc, id: :desc).first.try(:id)
8
11
  end
9
12
  change_column_null :thredded_posts, :postable_id, false
10
13
  # Allow null on user_id and last_user_id because users can get deleted.
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeV06ToV07 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeV06ToV07 < Thredded::BaseMigration
3
6
  def up
4
7
  Thredded::MessageboardGroup.transaction do
5
8
  Thredded::MessageboardGroup.where(
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeV07ToV08 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeV07ToV08 < Thredded::BaseMigration
3
6
  def up
4
7
  closed_messageboards = Thredded::Messageboard.unscoped.where(closed: true).to_a
5
8
  if closed_messageboards.present?
@@ -1,27 +1,30 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require 'thredded/base_migration'
4
+
2
5
  # rubocop:disable Metrics/MethodLength
3
- class UpgradeV08ToV09 < ActiveRecord::Migration
6
+ class UpgradeV08ToV09 < Thredded::BaseMigration
4
7
  def up
5
8
  create_table :thredded_notifications_for_private_topics do |t|
6
- t.integer :user_id, null: false
9
+ t.references :user, null: false, index: false, type: user_id_type
7
10
  t.string :notifier_key, null: false, limit: 90
8
11
  t.boolean :enabled, default: true, null: false
9
- t.index [:user_id, :notifier_key],
12
+ t.index %i[user_id notifier_key],
10
13
  name: 'thredded_notifications_for_private_topics_unique', unique: true
11
14
  end
12
15
  create_table :thredded_notifications_for_followed_topics do |t|
13
- t.integer :user_id, null: false
16
+ t.references :user, null: false, index: false, type: user_id_type
14
17
  t.string :notifier_key, null: false, limit: 90
15
18
  t.boolean :enabled, default: true, null: false
16
- t.index [:user_id, :notifier_key],
19
+ t.index %i[user_id notifier_key],
17
20
  name: 'thredded_notifications_for_followed_topics_unique', unique: true
18
21
  end
19
22
  create_table :thredded_messageboard_notifications_for_followed_topics do |t|
20
- t.integer :user_id, null: false
21
- t.integer :messageboard_id, null: false
23
+ t.references :user, null: false, index: false, type: user_id_type
24
+ t.references :messageboard, null: false, index: false, type: column_type(:thredded_messageboards, :id)
22
25
  t.string :notifier_key, null: false, limit: 90
23
26
  t.boolean :enabled, default: true, null: false
24
- t.index [:user_id, :messageboard_id, :notifier_key],
27
+ t.index %i[user_id messageboard_id notifier_key],
25
28
  name: 'thredded_messageboard_notifications_for_followed_topics_unique', unique: true
26
29
  end
27
30
 
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeV09ToV010 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeV09ToV010 < Thredded::BaseMigration
3
6
  def up
4
7
  remove_foreign_key :thredded_messageboard_users, :thredded_messageboards
5
8
  add_foreign_key :thredded_messageboard_users, :thredded_messageboards, on_delete: :cascade
@@ -7,14 +10,17 @@ class UpgradeV09ToV010 < ActiveRecord::Migration
7
10
  add_foreign_key :thredded_messageboard_users, :thredded_user_details, on_delete: :cascade
8
11
 
9
12
  create_table :thredded_user_post_notifications do |t|
10
- t.references :user, null: false
11
- t.foreign_key Thredded.user_class.table_name, column: :user_id, on_delete: :cascade
12
- t.references :post, null: false
13
- t.foreign_key :thredded_posts, column: :post_id, on_delete: :cascade
13
+ t.references :user, null: false, index: false, type: user_id_type
14
+ t.references :post, null: false, index: false, type: column_type(:thredded_posts, :id)
14
15
  t.datetime :notified_at, null: false
15
16
  t.index :post_id, name: :index_thredded_user_post_notifications_on_post_id
16
- t.index [:user_id, :post_id], name: :index_thredded_user_post_notifications_on_user_id_and_post_id, unique: true
17
+ t.index %i[user_id post_id], name: :index_thredded_user_post_notifications_on_user_id_and_post_id, unique: true
17
18
  end
19
+
20
+ add_foreign_key :thredded_user_post_notifications,
21
+ Thredded.user_class.table_name, column: :user_id, on_delete: :cascade
22
+ add_foreign_key :thredded_user_post_notifications,
23
+ :thredded_posts, column: :post_id, on_delete: :cascade
18
24
  end
19
25
 
20
26
  def down
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeThreddedV010ToV011 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeThreddedV010ToV011 < Thredded::BaseMigration
3
6
  def up
4
7
  drop_table :thredded_post_notifications
5
8
  add_column :thredded_user_preferences, :auto_follow_topics, :boolean, default: false, null: false
@@ -11,10 +14,10 @@ class UpgradeThreddedV010ToV011 < ActiveRecord::Migration
11
14
  remove_column :thredded_user_preferences, :auto_follow_topics
12
15
  create_table :thredded_post_notifications do |t|
13
16
  t.string :email, limit: 191, null: false
14
- t.references :post, null: false
17
+ t.references :post, null: false, index: false
15
18
  t.timestamps null: false
16
19
  t.string :post_type, limit: 191
17
- t.index [:post_id, :post_type], name: :index_thredded_post_notifications_on_post
20
+ t.index %i[post_id post_type], name: :index_thredded_post_notifications_on_post
18
21
  end
19
22
  end
20
23
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
- class UpgradeThreddedV011ToV012 < ActiveRecord::Migration
2
+
3
+ require 'thredded/base_migration'
4
+
5
+ class UpgradeThreddedV011ToV012 < Thredded::BaseMigration
3
6
  def up
4
7
  FriendlyId::Slug.transaction do
5
8
  FriendlyId::Slug.where(sluggable_type: 'Thredded::Topic').where(
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module Generators
4
5
  class InstallGenerator < Rails::Generators::Base
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Thredded configuration
3
4
 
4
5
  # ==> User Configuration
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  namespace :thredded do
3
4
  namespace :install do
4
5
  desc 'Copy emoji to the Rails `public/emoji` directory'
data/lib/thredded.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Backend
3
4
  require 'pundit'
4
5
  require 'active_record_union'
@@ -181,4 +182,10 @@ module Thredded
181
182
  .includes(:postable)
182
183
  )
183
184
  end
185
+
186
+ # @api private
187
+ def self.rails_gte_51?
188
+ @rails_gte_51 = (Rails.gem_version >= Gem::Version.new('5.1.0')) if @rails_gte_51.nil?
189
+ @rails_gte_51
190
+ end
184
191
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Thredded
4
+ class BaseMigration < (Thredded.rails_gte_51? ? ActiveRecord::Migration[5.1] : ActiveRecord::Migration)
5
+ def user_id_type
6
+ Thredded.user_class.columns.find { |c| c.name == Thredded.user_class.primary_key }.sql_type
7
+ end
8
+
9
+ def column_type(table, column_name)
10
+ column_name = column_name.to_s
11
+ columns(table).find { |c| c.name == column_name }.sql_type
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'action_view/renderer/abstract_renderer'
3
4
  module Thredded
4
5
  class CollectionToStringsWithCacheRenderer < ActionView::AbstractRenderer
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  # Generates HTML from content source.
4
5
  class ContentFormatter
@@ -6,7 +7,7 @@ module Thredded
6
7
  mattr_accessor :whitelist
7
8
 
8
9
  self.whitelist = HTML::Pipeline::SanitizationFilter::WHITELIST.deep_merge(
9
- elements: HTML::Pipeline::SanitizationFilter::WHITELIST[:elements] + %w(abbr iframe span figure figcaption),
10
+ elements: HTML::Pipeline::SanitizationFilter::WHITELIST[:elements] + %w[abbr iframe span figure figcaption],
10
11
  transformers: HTML::Pipeline::SanitizationFilter::WHITELIST[:transformers] + [
11
12
  lambda do |env|
12
13
  next unless env[:node_name] == 'a'
@@ -19,12 +20,12 @@ module Thredded
19
20
  end
20
21
  ],
21
22
  attributes: {
22
- 'a' => %w(href rel),
23
- 'abbr' => %w(title),
24
- 'span' => %w(class),
25
- 'div' => %w(class),
23
+ 'a' => %w[href rel],
24
+ 'abbr' => %w[title],
25
+ 'span' => %w[class],
26
+ 'div' => %w[class],
26
27
  :all => HTML::Pipeline::SanitizationFilter::WHITELIST[:attributes][:all] +
27
- %w(aria-label aria-labelledby aria-hidden),
28
+ %w[aria-label aria-labelledby aria-hidden],
28
29
  }
29
30
  )
30
31
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'factory_girl_rails'
3
4
  require_relative '../../spec/support/features/fake_content'
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module DbTools
4
5
  class << self
@@ -11,10 +12,10 @@ module Thredded
11
12
  def dump(to = dump_file)
12
13
  case adapter
13
14
  when /sqlite/i
14
- system "sqlite3 #{Rails.root.join(database)} .dump > #{to}"
15
+ system ['sqlite3', Rails.root.join(database), '.dump', '>', to].join(' ')
15
16
  when /postgres/i
16
- cmd = "pg_dump --host #{host} --username #{username} --verbose --clean --no-owner --no-acl --format=c " \
17
- "#{database} > #{to}"
17
+ cmd = "pg_dump --dbname=postgresql://#{username}:#{password}@#{host}:5432/#{database}" \
18
+ "--verbose --clean --no-owner --no-acl --format=c > #{to}"
18
19
  system cmd
19
20
  when /mysql/i
20
21
  system("mysqldump --user #{username} -p#{password} #{database} > #{to}")
@@ -25,11 +26,11 @@ module Thredded
25
26
  case adapter
26
27
  when /postgres/i
27
28
  cmd = [
28
- "pg_restore --verbose --host #{host}",
29
- "--username #{username}",
30
- ' --clean --no-owner --no-acl ',
31
- " --dbname #{database} #{from}",
32
- " > #{Rails.root.join('log/restore.log')}"
29
+ 'pg_restore --verbose --clean --no-owner --no-acl',
30
+ "--dbname=postgresql://#{username}:#{password}@#{host}:5432/#{database}",
31
+ from,
32
+ '>',
33
+ Rails.root.join('log', 'restore.log')
33
34
  ].join(' ')
34
35
  system cmd
35
36
  when /mysql/i, /sqlite/i
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'thredded/email_transformer/onebox'
3
4
 
4
5
  module Thredded
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'thredded/email_transformer/base'
3
4
  module Thredded
4
5
  module EmailTransformer
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  class Engine < ::Rails::Engine
4
5
  isolate_namespace Thredded
@@ -17,11 +18,11 @@ module Thredded
17
18
  end
18
19
 
19
20
  initializer 'thredded.setup_assets' do
20
- Thredded::Engine.config.assets.precompile += %w(
21
+ Thredded::Engine.config.assets.precompile += %w[
21
22
  thredded.js
22
23
  thredded.css
23
24
  thredded/*.svg
24
- )
25
+ ]
25
26
  end
26
27
  end
27
28
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  class Error < StandardError
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  # Content for demo-ing formatting functionality
4
5
  module FormattingDemoContent
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module HtmlPipeline
4
5
  class AtMentionFilter < ::HTML::Pipeline::Filter
5
- DEFAULT_IGNORED_ANCESTOR_TAGS = %w(pre code tt a style).freeze
6
+ DEFAULT_IGNORED_ANCESTOR_TAGS = %w[pre code tt a style].freeze
6
7
 
7
8
  # @param context [Hash]
8
9
  # @option context :users_provider [#call(usernames)] given usernames, returns a list of users.
@@ -42,7 +43,7 @@ module Thredded
42
43
 
43
44
  def highlight!(text_node_html)
44
45
  names = mentioned_names(text_node_html)
45
- return unless names.present?
46
+ return if names.blank?
46
47
  @users_provider.call(names).each do |user|
47
48
  name = user.thredded_display_name
48
49
  maybe_quoted_name = name =~ /[., ()]/ ? %("#{name}") : name
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module HtmlPipeline
4
5
  # HTML Filter for auto_linking urls in HTML.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'kramdown'
3
4
  module Thredded
4
5
  module HtmlPipeline
@@ -12,7 +13,7 @@ module Thredded
12
13
  input: 'GFM',
13
14
  gfm_quirks: 'paragraph_end',
14
15
  # Smart quotes conflict with @"at mentions". Disable smart quotes.
15
- smart_quotes: %w(apos apos quot quot),
16
+ smart_quotes: %w[apos apos quot quot],
16
17
  remove_block_html_tags: false,
17
18
  syntax_highlighter: nil
18
19
  }
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'onebox'
3
4
 
4
5
  module Thredded
@@ -7,7 +8,7 @@ module Thredded
7
8
  SANITIZE_CONFIG = Sanitize::Config.merge(
8
9
  Sanitize::Config::ONEBOX,
9
10
  attributes: {
10
- 'a' => Sanitize::Config::ONEBOX[:attributes]['a'] + %w(target),
11
+ 'a' => Sanitize::Config::ONEBOX[:attributes]['a'] + %w[target],
11
12
  },
12
13
  add_attributes: {
13
14
  'iframe' => {
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module HtmlPipeline
4
5
  # Wraps iframes with a <div class="thredded--embed-16-by-9"/>
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
- VERSION = '0.12.1'
4
+ VERSION = '0.12.2'
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module ViewHooks
4
5
  class Config
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Thredded
3
4
  module ViewHooks
4
5
  class Renderer
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.1
4
+ version: 0.12.2
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-05 00:00:00.000000000 Z
12
+ date: 2017-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pundit
@@ -457,14 +457,14 @@ dependencies:
457
457
  requirements:
458
458
  - - '='
459
459
  - !ruby/object:Gem::Version
460
- version: 0.46.0
460
+ version: 0.48.1
461
461
  type: :development
462
462
  prerelease: false
463
463
  version_requirements: !ruby/object:Gem::Requirement
464
464
  requirements:
465
465
  - - '='
466
466
  - !ruby/object:Gem::Version
467
- version: 0.46.0
467
+ version: 0.48.1
468
468
  - !ruby/object:Gem::Dependency
469
469
  name: rails-i18n
470
470
  requirement: !ruby/object:Gem::Requirement
@@ -1002,9 +1002,6 @@ files:
1002
1002
  - config/routes.rb
1003
1003
  - db/migrate/20160329231848_create_thredded.rb
1004
1004
  - db/seeds.rb
1005
- - db/upgrade_migrations/20160410111522_upgrade_v0_2_to_v0_3.rb
1006
- - db/upgrade_migrations/20160429222452_upgrade_v0_3_to_v0_4.rb
1007
- - db/upgrade_migrations/20160501151908_upgrade_v0_4_to_v0_5.rb
1008
1005
  - db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb
1009
1006
  - db/upgrade_migrations/20160723012349_upgrade_v0_6_to_v0_7.rb
1010
1007
  - db/upgrade_migrations/20161019150201_upgrade_v0_7_to_v0_8.rb
@@ -1017,6 +1014,7 @@ files:
1017
1014
  - lib/generators/thredded/install/templates/initializer.rb
1018
1015
  - lib/tasks/thredded_tasks.rake
1019
1016
  - lib/thredded.rb
1017
+ - lib/thredded/base_migration.rb
1020
1018
  - lib/thredded/collection_to_strings_with_cache_renderer.rb
1021
1019
  - lib/thredded/content_formatter.rb
1022
1020
  - lib/thredded/database_seeder.rb