thredded 0.6.2 → 0.6.3

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +1 -1
  4. data/app/assets/stylesheets/thredded/base/_buttons.scss +17 -0
  5. data/app/assets/stylesheets/thredded/base/_variables.scss +8 -1
  6. data/app/commands/thredded/mark_all_read.rb +21 -0
  7. data/app/controllers/thredded/messageboard_groups_controller.rb +1 -1
  8. data/app/controllers/thredded/moderation_controller.rb +1 -1
  9. data/app/controllers/thredded/read_states_controller.rb +12 -0
  10. data/app/forms/thredded/topic_form.rb +0 -1
  11. data/app/helpers/thredded/urls_helper.rb +1 -1
  12. data/app/models/concerns/thredded/post_common.rb +14 -2
  13. data/app/models/concerns/thredded/topic_common.rb +9 -1
  14. data/app/models/thredded/messageboard.rb +7 -0
  15. data/app/models/thredded/post.rb +11 -18
  16. data/app/models/thredded/private_post.rb +1 -5
  17. data/app/models/thredded/private_topic.rb +0 -4
  18. data/app/models/thredded/topic.rb +26 -12
  19. data/app/view_models/thredded/topic_view.rb +1 -0
  20. data/app/view_models/thredded/topics_page_view.rb +3 -2
  21. data/app/views/thredded/preferences/_form.html.erb +1 -1
  22. data/app/views/thredded/private_topic_mailer/message_notification.html.erb +1 -1
  23. data/app/views/thredded/private_topic_mailer/message_notification.text.erb +1 -1
  24. data/app/views/thredded/private_topics/index.html.erb +14 -6
  25. data/config/locales/en.yml +2 -1
  26. data/config/locales/pt-BR.yml +9 -10
  27. data/config/routes.rb +2 -1
  28. data/db/seeds.rb +1 -118
  29. data/heroku.gemfile +1 -2
  30. data/heroku.gemfile.lock +60 -64
  31. data/lib/thredded/database_seeder.rb +269 -0
  32. data/lib/thredded/main_app_route_delegator.rb +1 -1
  33. data/lib/thredded/version.rb +1 -1
  34. data/thredded.gemspec +3 -3
  35. metadata +12 -9
@@ -3,18 +3,26 @@
3
3
  <% content_for :thredded_breadcrumbs, render('thredded/private_topics/breadcrumbs') %>
4
4
 
5
5
  <%= thredded_page do %>
6
- <%= content_tag :section, class: 'thredded--main-section thredded--private-topics',
7
- 'data-thredded-topics' => true do %>
6
+ <%= content_tag :section,
7
+ class: 'thredded--main-section thredded--private-topics',
8
+ 'data-thredded-topics' => true do %>
9
+
8
10
  <% if @private_topics.empty? -%>
9
11
  <%= render 'thredded/private_topics/no_private_topics' %>
10
12
  <% else -%>
11
13
  <%= render 'thredded/private_topics/form',
12
- messageboard: messageboard,
13
- private_topic: @new_private_topic,
14
- css_class: 'thredded--is-compact',
15
- placeholder: t('thredded.private_topics.form.title_placeholder_start') %>
14
+ messageboard: messageboard,
15
+ private_topic: @new_private_topic,
16
+ css_class: 'thredded--is-compact',
17
+ placeholder: t('thredded.private_topics.form.title_placeholder_start') %>
18
+
16
19
  <%= render @private_topics %>
17
20
  <% end -%>
21
+
22
+ <%= link_to t('thredded.nav.mark_all_read'),
23
+ mark_all_private_topics_read_path,
24
+ class: 'thredded--button thredded--button-light thredded--button-wide',
25
+ method: :put -%>
18
26
  <% end %>
19
27
 
20
28
  <footer>
@@ -24,6 +24,7 @@ en:
24
24
  updated_notice: Messageboard has been updated
25
25
  messageboard_group:
26
26
  create: Create a New Messageboard Group
27
+ created_notice: Messageboard group has been created
27
28
  moderation:
28
29
  approve_btn: Approve
29
30
  block_btn: Block
@@ -48,6 +49,7 @@ en:
48
49
  edit_post: Edit Post
49
50
  edit_private_topic: :thredded.nav.edit_topic
50
51
  edit_topic: Edit
52
+ mark_all_read: Mark All As Read
51
53
  moderation: Moderation
52
54
  moderation_history: History
53
55
  moderation_pending: Pending
@@ -153,4 +155,3 @@ en:
153
155
  posts_count:
154
156
  one: "Posted once"
155
157
  other: "Posted %{count} times"
156
-
@@ -23,6 +23,7 @@ pt-BR:
23
23
  updated_notice: Fórum de mensagem foi atualizado
24
24
  messageboard_group:
25
25
  create: Criar um novo grupo de mensagens
26
+ created_notice: Grupo de mensagens foi criado
26
27
  moderation:
27
28
  approve_btn: Aprovar
28
29
  block_btn: Quadra
@@ -33,9 +34,8 @@ pt-BR:
33
34
  post_approved_html: Pós aprovado por %{moderator} %{time_ago}.
34
35
  post_blocked_html: Pós bloqueado por %{moderator} %{time_ago}.
35
36
  post_deleted_notice: Este post foi apagado.
36
- posts_content_changed_since_moderation_html: >-
37
- O <a href="%{post_url}">de pós</a> alteração de conteúdo, uma vez que foi moderado. Abaixo está o conteúdo
38
- no momento em que foi moderado.
37
+ posts_content_changed_since_moderation_html: O <a href="%{post_url}">de pós</a> alteração de conteúdo, uma
38
+ vez que foi moderado. Abaixo está o conteúdo no momento em que foi moderado.
39
39
  search_users:
40
40
  form_label: Buscar usuários
41
41
  form_placeholder: :thredded.moderation.search_users.form_label
@@ -47,6 +47,7 @@ pt-BR:
47
47
  edit_post: Editar Post
48
48
  edit_private_topic: :thredded.nav.edit_topic
49
49
  edit_topic: Editar
50
+ mark_all_read: Marcar Como Lido
50
51
  moderation: Moderação
51
52
  moderation_activity: Atividade
52
53
  moderation_history: História
@@ -71,15 +72,13 @@ pt-BR:
71
72
  form:
72
73
  global_preferences_label: Configurações Globais
73
74
  messageboard_notify_on_mention:
74
- hint: >-
75
- Quando alguém mencionar você através do seu usuário (ex.: @sam) neste fórum de mensagens, você irá receber
76
- um e-mail com o conteúdo deste post.
75
+ hint: 'Quando alguém mencionar você através do seu usuário (ex.: @sam) neste fórum de mensagens, você
76
+ irá receber um e-mail com o conteúdo deste post.'
77
77
  label: :thredded.preferences.form.notify_on_mention.label
78
78
  messageboard_preferences_label_html: Configurações de Notificação para <em>%{messageboard}</em>
79
79
  notify_on_mention:
80
- hint: >-
81
- Quando alguém mencionar você através do seu usuário (ex.: @sam) você irá receber um e-mail com o conteúdo
82
- deste post.
80
+ hint: 'Quando alguém mencionar você através do seu usuário (ex.: @sam) você irá receber um e-mail com
81
+ o conteúdo deste post.'
83
82
  label: "@ Notificações"
84
83
  notify_on_message:
85
84
  hint: Quando você for adicionado a uma conversa privada, você receberá um e-mail com o conteúdo desta
@@ -141,7 +140,7 @@ pt-BR:
141
140
  unfollowed_notice: Você não está mais acompanhando este tópico
142
141
  updated_notice: Tópico atualizado
143
142
  users:
144
- last_active_html: Última %{time_ago} ativa
143
+ last_active_html: "Última %{time_ago} ativa"
145
144
  posted_in_topic_html: Postou em %{topic_link}
146
145
  posts_count:
147
146
  one: Postado uma vez
@@ -6,6 +6,7 @@ Thredded::Engine.routes.draw do
6
6
  page_constraint = { page: positive_int }
7
7
 
8
8
  scope path: 'private-topics' do
9
+ resource :read_state, only: [:update], as: :mark_all_private_topics_read
9
10
  resource :private_topic, only: [:new], path: ''
10
11
  resources :private_topics, except: [:new, :show], path: '' do
11
12
  member do
@@ -42,7 +43,7 @@ Thredded::Engine.routes.draw do
42
43
  end
43
44
  end
44
45
 
45
- resource :preferences, only: [:edit, :update]
46
+ resource :preferences, only: [:edit, :update], as: :global_preferences
46
47
  resource :messageboard, path: 'messageboards', only: [:new]
47
48
  resources :messageboards, only: [:edit, :update]
48
49
  resources :messageboards, only: [:index, :create], path: '' do
@@ -1,120 +1,3 @@
1
1
  # frozen_string_literal: true
2
- require 'factory_girl_rails'
3
2
 
4
- # rubocop:disable HandleExceptions
5
- begin
6
- if FactoryGirl.factories.instance_variable_get(:@items).none?
7
- require_relative '../spec/factories'
8
- end
9
- rescue NameError
10
- end
11
- # rubocop:enable HandleExceptions
12
-
13
- module Thredded
14
- class SeedDatabase
15
- attr_reader :user, :users, :messageboard, :topics, :private_topics, :posts
16
-
17
- SKIP_CALLBACKS = [
18
- [Thredded::Post, :commit, :after, :auto_follow_and_notify],
19
- [Thredded::PrivatePost, :commit, :after, :notify_users],
20
- ].freeze
21
-
22
- def self.run(users: 200, topics: 55, posts: (1..60))
23
- STDERR.puts 'Seeding the database...'
24
- # Disable callbacks to avoid creating notifications and performing unnecessary updates
25
- SKIP_CALLBACKS.each { |(klass, *args)| klass.skip_callback(*args) }
26
- s = new
27
- Messageboard.transaction do
28
- s.create_first_user
29
- s.create_users(count: users)
30
- s.create_messageboard
31
- s.create_topics(count: topics)
32
- s.create_posts(count: posts)
33
- s.create_private_posts(count: posts)
34
- s.create_additional_messageboards
35
- s.log 'Running after_commit callbacks'
36
- end
37
- ensure
38
- # Re-enable callbacks
39
- SKIP_CALLBACKS.each { |(klass, *args)| klass.set_callback(*args) }
40
- end
41
-
42
- def log(message)
43
- STDERR.puts "- #{message}"
44
- end
45
-
46
- def create_first_user
47
- @user ||= ::User.first || FactoryGirl.create(:user, :approved, :admin, name: 'Joe', email: 'joe@example.com')
48
- end
49
-
50
- def create_users(count:)
51
- log "Creating #{count} users..."
52
- approved_users_count = (count * 0.97).round
53
- @users = [user] +
54
- FactoryGirl.create_list(:user, approved_users_count, :approved) +
55
- FactoryGirl.create_list(:user, count - approved_users_count)
56
- end
57
-
58
- def create_messageboard
59
- log 'Creating a messageboard...'
60
- @messageboard = FactoryGirl.create(
61
- :messageboard,
62
- name: 'Main Board',
63
- slug: 'main-board',
64
- description: 'A board is not a board without some posts'
65
- )
66
- end
67
-
68
- def create_additional_messageboards
69
- meta_group_id = MessageboardGroup.create!(name: 'Meta').id
70
- additional_messageboards = [
71
- ['Off-Topic', "Talk about whatever here, it's all good."],
72
- ['Help, Bugs, and Suggestions',
73
- 'Need help using the forum? Want to report a bug or make a suggestion? This is the place.', meta_group_id],
74
- ['Praise', 'Want to tell us how great we are? This is the place.', meta_group_id]
75
- ]
76
- log "Creating #{additional_messageboards.length} additional messageboards..."
77
- additional_messageboards.each do |(name, description, group_id)|
78
- messageboard = Messageboard.create!(name: name, description: description, messageboard_group_id: group_id)
79
- FactoryGirl.create_list(:topic, 1 + rand(3), messageboard: messageboard, with_posts: 1)
80
- end
81
- end
82
-
83
- def create_topics(count: 26, messageboard: self.messageboard)
84
- log "Creating #{count} topics in #{messageboard.name}..."
85
- @topics = FactoryGirl.create_list(
86
- :topic, count,
87
- messageboard: messageboard,
88
- user: users.sample,
89
- last_user: users.sample
90
- )
91
-
92
- @private_topics = FactoryGirl.create_list(
93
- :private_topic, count,
94
- user: users.sample,
95
- last_user: users.sample,
96
- users: [user]
97
- )
98
- end
99
-
100
- def create_posts(count: (1..30))
101
- log "Creating #{count} additional posts in each topic..."
102
- @posts = topics.flat_map do |topic|
103
- (count.min + rand(count.max + 1)).times do
104
- FactoryGirl.create(:post, postable: topic, messageboard: messageboard, user: users.sample)
105
- end
106
- end
107
- end
108
-
109
- def create_private_posts(count: (1..30))
110
- log "Creating #{count} additional posts in each private topic..."
111
- @private_posts = private_topics.flat_map do |topic|
112
- (count.min + rand(count.max + 1)).times do
113
- FactoryGirl.create(:private_post, postable: topic, user: users.sample)
114
- end
115
- end
116
- end
117
- end
118
- end
119
-
120
- Thredded::SeedDatabase.run
3
+ Thredded::DatabaseSeeder.run
@@ -5,8 +5,7 @@ ruby '2.3.1'
5
5
  gem 'thredded', path: File.dirname(__FILE__)
6
6
 
7
7
  # Rails 5
8
- gem 'rails', '~> 5.0.0.rc2'
9
- gem 'active_record_union', '>= 1.2.0'
8
+ gem 'rails', '~> 5.0.0'
10
9
 
11
10
  # Make these gems available in production
12
11
  gem 'puma'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thredded (0.6.2)
4
+ thredded (0.6.3)
5
5
  active_record_union (>= 1.2.0)
6
6
  autoprefixer-rails
7
7
  autosize-rails
@@ -30,48 +30,48 @@ PATH
30
30
  GEM
31
31
  remote: https://rubygems.org/
32
32
  specs:
33
- actioncable (5.0.0.rc2)
34
- actionpack (= 5.0.0.rc2)
33
+ actioncable (5.0.0.1)
34
+ actionpack (= 5.0.0.1)
35
35
  nio4r (~> 1.2)
36
36
  websocket-driver (~> 0.6.1)
37
- actionmailer (5.0.0.rc2)
38
- actionpack (= 5.0.0.rc2)
39
- actionview (= 5.0.0.rc2)
40
- activejob (= 5.0.0.rc2)
37
+ actionmailer (5.0.0.1)
38
+ actionpack (= 5.0.0.1)
39
+ actionview (= 5.0.0.1)
40
+ activejob (= 5.0.0.1)
41
41
  mail (~> 2.5, >= 2.5.4)
42
- rails-dom-testing (~> 1.0, >= 1.0.5)
43
- actionpack (5.0.0.rc2)
44
- actionview (= 5.0.0.rc2)
45
- activesupport (= 5.0.0.rc2)
46
- rack (~> 2.x)
42
+ rails-dom-testing (~> 2.0)
43
+ actionpack (5.0.0.1)
44
+ actionview (= 5.0.0.1)
45
+ activesupport (= 5.0.0.1)
46
+ rack (~> 2.0)
47
47
  rack-test (~> 0.6.3)
48
- rails-dom-testing (~> 1.0, >= 1.0.5)
48
+ rails-dom-testing (~> 2.0)
49
49
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
50
- actionview (5.0.0.rc2)
51
- activesupport (= 5.0.0.rc2)
50
+ actionview (5.0.0.1)
51
+ activesupport (= 5.0.0.1)
52
52
  builder (~> 3.1)
53
53
  erubis (~> 2.7.0)
54
- rails-dom-testing (~> 1.0, >= 1.0.5)
54
+ rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
56
56
  active_record_union (1.2.0)
57
57
  activerecord (>= 4.0)
58
- activejob (5.0.0.rc2)
59
- activesupport (= 5.0.0.rc2)
58
+ activejob (5.0.0.1)
59
+ activesupport (= 5.0.0.1)
60
60
  globalid (>= 0.3.6)
61
- activemodel (5.0.0.rc2)
62
- activesupport (= 5.0.0.rc2)
63
- activerecord (5.0.0.rc2)
64
- activemodel (= 5.0.0.rc2)
65
- activesupport (= 5.0.0.rc2)
61
+ activemodel (5.0.0.1)
62
+ activesupport (= 5.0.0.1)
63
+ activerecord (5.0.0.1)
64
+ activemodel (= 5.0.0.1)
65
+ activesupport (= 5.0.0.1)
66
66
  arel (~> 7.0)
67
- activesupport (5.0.0.rc2)
67
+ activesupport (5.0.0.1)
68
68
  concurrent-ruby (~> 1.0, >= 1.0.2)
69
69
  i18n (~> 0.7)
70
70
  minitest (~> 5.1)
71
71
  tzinfo (~> 1.1)
72
72
  addressable (2.4.0)
73
- arel (7.0.0)
74
- autoprefixer-rails (6.3.6.2)
73
+ arel (7.1.1)
74
+ autoprefixer-rails (6.4.0.3)
75
75
  execjs
76
76
  autosize-rails (1.18.17)
77
77
  rails (>= 3.1)
@@ -100,16 +100,16 @@ GEM
100
100
  factory_girl_rails (4.7.0)
101
101
  factory_girl (~> 4.7.0)
102
102
  railties (>= 3.0.0)
103
- faker (1.6.3)
103
+ faker (1.6.6)
104
104
  i18n (~> 0.5)
105
105
  friendly_id (5.1.0)
106
106
  activerecord (>= 4.0.0)
107
107
  gemoji (2.1.0)
108
108
  github-markdown (0.6.9)
109
- globalid (0.3.6)
109
+ globalid (0.3.7)
110
110
  activesupport (>= 4.1.0)
111
- html-pipeline (2.4.1)
112
- activesupport (>= 2, < 5)
111
+ html-pipeline (2.4.2)
112
+ activesupport (>= 2)
113
113
  nokogiri (>= 1.4)
114
114
  html-pipeline-vimeo (0.1.1)
115
115
  html-pipeline (~> 2.0)
@@ -118,11 +118,11 @@ GEM
118
118
  htmlentities (4.3.4)
119
119
  http_accept_language (2.0.5)
120
120
  i18n (0.7.0)
121
- inline_svg (0.9.0)
122
- activesupport (>= 4.0.4)
121
+ inline_svg (0.10.0)
122
+ activesupport (>= 4.0)
123
123
  loofah (>= 2.0)
124
124
  nokogiri (~> 1.6)
125
- jquery-rails (4.1.1)
125
+ jquery-rails (4.2.1)
126
126
  rails-dom-testing (>= 1, < 3)
127
127
  railties (>= 4.2.0)
128
128
  thor (>= 0.14, < 2.0)
@@ -144,16 +144,16 @@ GEM
144
144
  mini_portile2 (2.1.0)
145
145
  minitest (5.9.0)
146
146
  multi_json (1.12.1)
147
- newrelic_rpm (3.16.0.318)
147
+ newrelic_rpm (3.16.2.321)
148
148
  nio4r (1.2.1)
149
149
  nokogiri (1.6.8)
150
150
  mini_portile2 (~> 2.1.0)
151
151
  pkg-config (~> 1.1.7)
152
- nokogumbo (1.4.7)
152
+ nokogumbo (1.4.9)
153
153
  nokogiri
154
154
  pg (0.18.4)
155
155
  pkg-config (1.1.7)
156
- puma (3.4.0)
156
+ puma (3.6.0)
157
157
  pundit (1.1.0)
158
158
  activesupport (>= 3.0.0)
159
159
  rack (2.0.1)
@@ -162,29 +162,26 @@ GEM
162
162
  rack (>= 1.0.0, < 3)
163
163
  rack-test (0.6.3)
164
164
  rack (>= 1.0)
165
- rails (5.0.0.rc2)
166
- actioncable (= 5.0.0.rc2)
167
- actionmailer (= 5.0.0.rc2)
168
- actionpack (= 5.0.0.rc2)
169
- actionview (= 5.0.0.rc2)
170
- activejob (= 5.0.0.rc2)
171
- activemodel (= 5.0.0.rc2)
172
- activerecord (= 5.0.0.rc2)
173
- activesupport (= 5.0.0.rc2)
165
+ rails (5.0.0.1)
166
+ actioncable (= 5.0.0.1)
167
+ actionmailer (= 5.0.0.1)
168
+ actionpack (= 5.0.0.1)
169
+ actionview (= 5.0.0.1)
170
+ activejob (= 5.0.0.1)
171
+ activemodel (= 5.0.0.1)
172
+ activerecord (= 5.0.0.1)
173
+ activesupport (= 5.0.0.1)
174
174
  bundler (>= 1.3.0, < 2.0)
175
- railties (= 5.0.0.rc2)
175
+ railties (= 5.0.0.1)
176
176
  sprockets-rails (>= 2.0.0)
177
- rails-deprecated_sanitizer (1.0.3)
178
- activesupport (>= 4.2.0.alpha)
179
- rails-dom-testing (1.0.7)
180
- activesupport (>= 4.2.0.beta, < 5.0)
177
+ rails-dom-testing (2.0.1)
178
+ activesupport (>= 4.2.0, < 6.0)
181
179
  nokogiri (~> 1.6.0)
182
- rails-deprecated_sanitizer (>= 1.0.1)
183
180
  rails-html-sanitizer (1.0.3)
184
181
  loofah (~> 2.0)
185
- rails-i18n (4.0.2)
186
- i18n (~> 0.6)
187
- rails (>= 4.0)
182
+ rails-i18n (5.0.0)
183
+ i18n (~> 0.7)
184
+ railties (~> 5.0)
188
185
  rails-timeago (2.14.0)
189
186
  actionpack (>= 3.1)
190
187
  activesupport (>= 3.1)
@@ -193,9 +190,9 @@ GEM
193
190
  request_store
194
191
  sass-rails
195
192
  turbolinks
196
- railties (5.0.0.rc2)
197
- actionpack (= 5.0.0.rc2)
198
- activesupport (= 5.0.0.rc2)
193
+ railties (5.0.0.1)
194
+ actionpack (= 5.0.0.1)
195
+ activesupport (= 5.0.0.1)
199
196
  method_source
200
197
  rake (>= 0.8.7)
201
198
  thor (>= 0.18.1, < 2.0)
@@ -205,23 +202,23 @@ GEM
205
202
  request_store (1.3.1)
206
203
  rollbar (2.12.0)
207
204
  multi_json
208
- sanitize (4.0.1)
205
+ sanitize (4.2.0)
209
206
  crass (~> 1.0.2)
210
207
  nokogiri (>= 1.4.4)
211
208
  nokogumbo (~> 1.4.1)
212
209
  sass (3.4.22)
213
- sass-rails (5.0.4)
214
- railties (>= 4.0.0, < 5.0)
210
+ sass-rails (5.0.6)
211
+ railties (>= 4.0.0, < 6)
215
212
  sass (~> 3.1)
216
213
  sprockets (>= 2.8, < 4.0)
217
214
  sprockets-rails (>= 2.0, < 4.0)
218
215
  tilt (>= 1.1, < 3)
219
216
  select2-rails (3.5.10)
220
217
  thor (~> 0.14)
221
- sprockets (3.6.2)
218
+ sprockets (3.7.0)
222
219
  concurrent-ruby (~> 1.0)
223
220
  rack (> 1, < 3)
224
- sprockets-es6 (0.9.0)
221
+ sprockets-es6 (0.9.1)
225
222
  babel-source (>= 5.8.11)
226
223
  babel-transpiler
227
224
  sprockets (>= 3.0.0)
@@ -247,7 +244,6 @@ PLATFORMS
247
244
  ruby
248
245
 
249
246
  DEPENDENCIES
250
- active_record_union (>= 1.2.0)
251
247
  dalli
252
248
  factory_girl_rails
253
249
  faker (>= 1.6.2)
@@ -257,7 +253,7 @@ DEPENDENCIES
257
253
  pg
258
254
  puma
259
255
  rack-canonical-host
260
- rails (~> 5.0.0.rc2)
256
+ rails (~> 5.0.0)
261
257
  rails-i18n
262
258
  rails_email_preview (>= 1.0.3)
263
259
  rollbar