thredded 0.15.3 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/thredded/components/submit_hotkey.es6 +18 -0
  4. data/app/assets/stylesheets/thredded/components/_pagination.scss +1 -1
  5. data/app/assets/stylesheets/thredded/components/_post-form.scss +0 -1
  6. data/app/assets/stylesheets/thredded/components/_topics.scss +2 -28
  7. data/app/controllers/thredded/application_controller.rb +2 -0
  8. data/app/controllers/thredded/post_permalinks_controller.rb +1 -1
  9. data/app/controllers/thredded/post_previews_controller.rb +1 -1
  10. data/app/controllers/thredded/posts_controller.rb +2 -3
  11. data/app/controllers/thredded/private_post_permalinks_controller.rb +1 -1
  12. data/app/controllers/thredded/private_post_previews_controller.rb +1 -1
  13. data/app/controllers/thredded/private_posts_controller.rb +2 -3
  14. data/app/helpers/thredded/urls_helper.rb +28 -1
  15. data/app/models/concerns/thredded/content_moderation_state.rb +2 -2
  16. data/app/models/concerns/thredded/post_common.rb +1 -1
  17. data/app/models/concerns/thredded/topic_common.rb +1 -1
  18. data/app/models/thredded/messageboard.rb +0 -3
  19. data/app/models/thredded/post.rb +8 -0
  20. data/app/models/thredded/post_moderation_record.rb +2 -0
  21. data/app/models/thredded/private_post.rb +8 -0
  22. data/app/models/thredded/private_topic.rb +14 -0
  23. data/app/models/thredded/topic.rb +2 -2
  24. data/app/models/thredded/user_extender.rb +2 -2
  25. data/app/views/thredded/posts_common/_form.html.erb +1 -0
  26. data/app/views/thredded/posts_common/form/_content_field.html.erb +1 -1
  27. data/app/views/thredded/private_topics/_form.html.erb +2 -0
  28. data/app/views/thredded/private_topics/_private_topic.html.erb +0 -5
  29. data/app/views/thredded/topics/_form.html.erb +1 -0
  30. data/app/views/thredded/topics/_topic.html.erb +6 -4
  31. data/app/views/thredded/topics/unread.html.erb +4 -1
  32. data/config/i18n-tasks.yml +1 -0
  33. data/config/locales/de.yml +5 -0
  34. data/config/locales/en.yml +5 -0
  35. data/config/locales/es.yml +5 -0
  36. data/config/locales/fr.yml +5 -0
  37. data/config/locales/it.yml +5 -0
  38. data/config/locales/pl.yml +5 -0
  39. data/config/locales/pt-BR.yml +5 -0
  40. data/config/locales/ru.yml +6 -1
  41. data/config/locales/zh-CN.yml +5 -0
  42. data/lib/generators/thredded/install/templates/initializer.rb +17 -11
  43. data/lib/thredded.rb +111 -48
  44. data/lib/thredded/content_formatter.rb +2 -2
  45. data/lib/thredded/database_seeder.rb +6 -6
  46. data/lib/thredded/db_tools.rb +2 -2
  47. data/lib/thredded/errors.rb +13 -1
  48. data/lib/thredded/html_pipeline/onebox_filter.rb +2 -2
  49. data/lib/thredded/version.rb +1 -1
  50. data/vendor/assets/javascripts/autosize.min.js +2 -6
  51. data/vendor/assets/javascripts/textcomplete.min.js +2 -2
  52. metadata +4 -3
@@ -29,10 +29,12 @@
29
29
  <%= user_link topic.last_user %>
30
30
  </cite>
31
31
 
32
- <cite class="thredded--topics--started-by">
33
- <%= time_ago topic.created_at %>
34
- <%= user_link topic.user %>
35
- </cite>
32
+ <% if local_assigns[:show_messageboard] %>
33
+ <span class="thredded--topics--messageboard">
34
+ <%= t 'thredded.topics.in_messageboard_html',
35
+ messageboard_link: link_to(topic.messageboard_name, topic.messageboard_path) %>
36
+ </span>
37
+ <% end %>
36
38
 
37
39
  <% if topic.blocked? && topic.can_moderate? %>
38
40
  <span class="thredded--topics--moderation-state thredded--alert thredded--alert-danger">
@@ -18,7 +18,10 @@
18
18
  placeholder: t('thredded.topics.form.title_placeholder_start') if @new_topic %>
19
19
  <%= render partial: 'thredded/topics/topic',
20
20
  collection: @topics,
21
- locals: { topics: @topics } %>
21
+ locals: {
22
+ topics: @topics,
23
+ show_messageboard: !messageboard_or_nil
24
+ } %>
22
25
  <% end %>
23
26
  <footer class="thredded--pagination-bottom">
24
27
  <%= paginate @topics %>
@@ -10,6 +10,7 @@ search:
10
10
  paths:
11
11
  - app/
12
12
  - lib/
13
+ - spec/dummy/app/
13
14
  data:
14
15
  yaml:
15
16
  write:
@@ -44,8 +44,11 @@ de:
44
44
  errors:
45
45
  login_required: Bitte zuerst anmelden
46
46
  not_authorized: Du hast keinen Zugriff auf diese Seite
47
+ post_not_found: Dieser Beitrag existiert nicht.
48
+ private_post_not_found: Diese private Nachricht existiert nicht.
47
49
  private_topic_create_denied: Du bist nicht autorisiert, private Unterhaltungen zu erstellen
48
50
  private_topic_not_found: Diese private Unterhaltung existiert nicht
51
+ topic_not_found: Dieses Thema existiert nicht.
49
52
  form:
50
53
  create_btn_submitting: Erstellen...
51
54
  preview: Vorschau
@@ -224,6 +227,7 @@ de:
224
227
  title_placeholder: :thredded.topics.form.title_label
225
228
  title_placeholder_start: Starte eine neue Diskussion
226
229
  update_btn: Beitrag bearbeiten
230
+ in_messageboard_html: in %{messageboard_link}
227
231
  locked:
228
232
  label: Gesperrt
229
233
  message: Der Beitrag wurde von einem Moderator gesperrt
@@ -257,6 +261,7 @@ de:
257
261
  one: Einmalig hochgeladen
258
262
  other: "%{count} -mal hochgeladen"
259
263
  recent_activity: :thredded.recent_activity
264
+ send_private_message: Private Nachricht senden
260
265
  started_topic_html: "%{topic_link} gestartet"
261
266
  started_topics_count:
262
267
  one: Eine Diskussion gestartet
@@ -43,8 +43,11 @@ en:
43
43
  errors:
44
44
  login_required: Please sign in first.
45
45
  not_authorized: You are not authorized to access this page.
46
+ post_not_found: This post does not exist.
47
+ private_post_not_found: This private message does not exist.
46
48
  private_topic_create_denied: You are not authorized to create private topics.
47
49
  private_topic_not_found: This private topic does not exist.
50
+ topic_not_found: This topic does not exist.
48
51
  form:
49
52
  create_btn_submitting: Creating...
50
53
  preview: Preview
@@ -221,6 +224,7 @@ en:
221
224
  title_placeholder: :thredded.topics.form.title_label
222
225
  title_placeholder_start: Start a New Topic
223
226
  update_btn: Update Topic
227
+ in_messageboard_html: in %{messageboard_link}
224
228
  locked:
225
229
  label: Locked
226
230
  message: This topic has been locked by a moderator.
@@ -253,6 +257,7 @@ en:
253
257
  one: Posted once
254
258
  other: Posted %{count} times
255
259
  recent_activity: :thredded.recent_activity
260
+ send_private_message: Send private message
256
261
  started_topic_html: Started %{topic_link}
257
262
  started_topics_count:
258
263
  one: Started one topic
@@ -45,8 +45,11 @@ es:
45
45
  errors:
46
46
  login_required: Por favor, inicia sesión.
47
47
  not_authorized: No estás autorizado para ver esta página.
48
+ post_not_found: Esta publicación no existe.
49
+ private_post_not_found: Este mensaje privado no existe.
48
50
  private_topic_create_denied: No estás autorizado para crear temas privados.
49
51
  private_topic_not_found: Este tema privado no existe.
52
+ topic_not_found: Este tema no existe.
50
53
  form:
51
54
  create_btn_submitting: Creando...
52
55
  preview: Vista previa
@@ -225,6 +228,7 @@ es:
225
228
  title_placeholder: :thredded.topics.form.title_label
226
229
  title_placeholder_start: Crear un Nuevo Tema
227
230
  update_btn: Actualizar Tema
231
+ in_messageboard_html: en %{messageboard_link}
228
232
  locked:
229
233
  label: Bloqueado
230
234
  message: Este tema ha sido bloqueado por un moderador.
@@ -257,6 +261,7 @@ es:
257
261
  one: Ha escrito una vez
258
262
  other: Ha escrito %{count} veces
259
263
  recent_activity: :thredded.recent_activity
264
+ send_private_message: Enviar mensaje privado
260
265
  started_topic_html: Empezó %{topic_link}
261
266
  started_topics_count:
262
267
  one: Ha empezado un tema
@@ -43,8 +43,11 @@ fr:
43
43
  errors:
44
44
  login_required: Veuillez vous connecter
45
45
  not_authorized: Vous n'êtes pas autorisé à accéder à cette page.
46
+ post_not_found: Ce post n'existe pas.
47
+ private_post_not_found: Ce message privé n'existe pas.
46
48
  private_topic_create_denied: Vous n'êtes pas autorisé à créer des sujets.
47
49
  private_topic_not_found: Ce sujet privé n'existe pas.
50
+ topic_not_found: Ce sujet n'existe pas.
48
51
  form:
49
52
  create_btn_submitting: Création en cours...
50
53
  preview: Aperçu
@@ -222,6 +225,7 @@ fr:
222
225
  title_placeholder: :thredded.topics.form.title_label
223
226
  title_placeholder_start: Commencer un nouveau sujet
224
227
  update_btn: Mettre à jour le sujet
228
+ in_messageboard_html: dans %{messageboard_link}
225
229
  locked:
226
230
  label: Verrouillé
227
231
  message: Ce sujet a été verrouillé par un modérateur.
@@ -255,6 +259,7 @@ fr:
255
259
  one: Commenté une seule fois
256
260
  other: Commenté %{count} fois
257
261
  recent_activity: :thredded.recent_activity
262
+ send_private_message: Envoyer un message privé
258
263
  started_topic_html: Démarré %{topic_link}
259
264
  started_topics_count:
260
265
  one: Démarré un sujet
@@ -43,8 +43,11 @@ it:
43
43
  errors:
44
44
  login_required: Per visualizzare questa pagina bisogna accedere tramite login.
45
45
  not_authorized: Non sei autorizzato a vedere questa pagina.
46
+ post_not_found: Questo post non esiste.
47
+ private_post_not_found: Questo messaggio privato non esiste.
46
48
  private_topic_create_denied: Non sei autorizzato a creare discussioni private.
47
49
  private_topic_not_found: Questa discussione privata non esiste.
50
+ topic_not_found: Questo argomento non esiste.
48
51
  form:
49
52
  create_btn_submitting: Creazione in corso...
50
53
  preview: Anteprima
@@ -225,6 +228,7 @@ it:
225
228
  title_placeholder: :thredded.topics.form.title_label
226
229
  title_placeholder_start: Inizia una Nuova Discussione
227
230
  update_btn: Aggiorna Discussione
231
+ in_messageboard_html: in %{messageboard_link}
228
232
  locked:
229
233
  label: Bloccata
230
234
  message: Questa discussione è stata bloccata da un moderatore.
@@ -257,6 +261,7 @@ it:
257
261
  one: Ha commentato una volta
258
262
  other: Ha commentato %{count} volte
259
263
  recent_activity: :thredded.recent_activity
264
+ send_private_message: Invia un messaggio privato
260
265
  started_topic_html: Ha iniziato %{topic_link}
261
266
  started_topics_count:
262
267
  one: Ha iniziato una discussione
@@ -43,8 +43,11 @@ pl:
43
43
  errors:
44
44
  login_required: Proszę się najpierw zalogować.
45
45
  not_authorized: Nie masz uprawnień aby zobaczyć tę stronę.
46
+ post_not_found: Ten wpis nie istnieje.
47
+ private_post_not_found: Ta prywatna wiadomość nie istnieje.
46
48
  private_topic_create_denied: Nie masz uprawnień do tworzenia prywatnych tematów.
47
49
  private_topic_not_found: Ten prywatny temat nie istnieje.
50
+ topic_not_found: Ten temat nie istnieje.
48
51
  form:
49
52
  create_btn_submitting: Tworzenie...
50
53
  preview: Zapowiedź
@@ -221,6 +224,7 @@ pl:
221
224
  title_placeholder: :thredded.topics.form.title_label
222
225
  title_placeholder_start: Rozpocznij nowy temat
223
226
  update_btn: Zaktualizuj temat
227
+ in_messageboard_html: w %{messageboard_link}
224
228
  locked:
225
229
  label: Zablokowany
226
230
  message: Ten temat został zablokowany przez moderatora.
@@ -255,6 +259,7 @@ pl:
255
259
  one: Napisał 1 post
256
260
  other: Napisał %{count} postów
257
261
  recent_activity: :thredded.recent_activity
262
+ send_private_message: Wyślij Wiadomość Prywatną
258
263
  started_topic_html: Rozpoczął %{topic_link}
259
264
  started_topics_count:
260
265
  few: Rozpoczął %{count} tematy
@@ -44,8 +44,11 @@ pt-BR:
44
44
  errors:
45
45
  login_required: Por favor, autentique-se primeiro.
46
46
  not_authorized: Você não está autorizado a acessar esta página.
47
+ post_not_found: Este post não existe.
48
+ private_post_not_found: Esta mensagem privada não existe.
47
49
  private_topic_create_denied: Você não está autorizado a criar tópicos privados.
48
50
  private_topic_not_found: Este tópico privado não existe.
51
+ topic_not_found: Este tópico não existe.
49
52
  form:
50
53
  create_btn_submitting: Criando...
51
54
  preview: Pré-visualização
@@ -226,6 +229,7 @@ pt-BR:
226
229
  title_placeholder: :thredded.topics.form.title_label
227
230
  title_placeholder_start: Iniciar um novo tópico
228
231
  update_btn: Atualizar Tópico
232
+ in_messageboard_html: em %{messageboard_link}
229
233
  locked:
230
234
  label: Trancado
231
235
  message: Este tópico foi bloqueado por um moderador.
@@ -258,6 +262,7 @@ pt-BR:
258
262
  one: Postado uma vez
259
263
  other: vezes %{count} Publicado
260
264
  recent_activity: :thredded.recent_activity
265
+ send_private_message: Enviar mensagem privada
261
266
  started_topic_html: Começou %{topic_link}
262
267
  started_topics_count:
263
268
  one: Começou um tópico
@@ -42,8 +42,11 @@ ru:
42
42
  errors:
43
43
  login_required: Необходимо зайти на форум.
44
44
  not_authorized: Вы не авторизованы.
45
+ post_not_found: Это сообщение не существует.
46
+ private_post_not_found: Это личное сообщение не существует.
45
47
  private_topic_create_denied: Вы не авторизованы для создания личных сообщений.
46
48
  private_topic_not_found: Личное сообщение не найдено.
49
+ topic_not_found: Эта тема не существует.
47
50
  form:
48
51
  create_btn_submitting: Создаю...
49
52
  preview: Обзор
@@ -219,6 +222,7 @@ ru:
219
222
  title_placeholder: :thredded.topics.form.title_label
220
223
  title_placeholder_start: Начать новую тему
221
224
  update_btn: Обновление темы
225
+ in_messageboard_html: в %{messageboard_link}
222
226
  locked:
223
227
  label: Заблокировать тему
224
228
  message: Эта тема закрыта модератором.
@@ -253,12 +257,13 @@ ru:
253
257
  one: Сделан %{count} пост
254
258
  other: Сделано %{count} постов
255
259
  recent_activity: :thredded.recent_activity
260
+ send_private_message: Отправить личное сообщение
256
261
  started_topic_html: Начато %{topic_link}
257
262
  started_topics_count:
258
263
  few: Начато %{count} темы
259
264
  many: Начато %{count} тем
260
265
  one: Начата %{count} тема
261
266
  other: Начато %{count} тем
262
- user_posted_in_topic_html: "%{user_link} сделал запись в %{topic_link}"
267
+ user_posted_in_topic_html: "%{user_link} написал в %{topic_link}"
263
268
  user_since_html: Пользователь был %{time_ago}
264
269
  user_started_topic_html: "%{user_link} начал %{topic_link}"
@@ -40,8 +40,11 @@ zh-CN:
40
40
  errors:
41
41
  login_required: 请先登录
42
42
  not_authorized: 你没有权限访问该页面
43
+ post_not_found: 这篇文章不存在。
44
+ private_post_not_found: 此私人消息不存在。
43
45
  private_topic_create_denied: 你没有权限创建私人对话
44
46
  private_topic_not_found: 该私人对话不存在
47
+ topic_not_found: 此主题不存在。
45
48
  form:
46
49
  create_btn_submitting: 创建中...
47
50
  preview: 预览
@@ -214,6 +217,7 @@ zh-CN:
214
217
  title_placeholder: :thredded.topics.form.title_label
215
218
  title_placeholder_start: 发布新帖子
216
219
  update_btn: 更新帖子
220
+ in_messageboard_html: 在%{messageboard_link}
217
221
  locked:
218
222
  label: 锁定
219
223
  message: 该帖子被某个审核者锁定
@@ -246,6 +250,7 @@ zh-CN:
246
250
  one: 一个回复
247
251
  other: "%{count} 个回复"
248
252
  recent_activity: :thredded.recent_activity
253
+ send_private_message: 发送私人讯息
249
254
  started_topic_html: 发布帖子 %{topic_link}
250
255
  started_topics_count:
251
256
  one: 发布一个帖子
@@ -21,10 +21,10 @@ Thredded.user_name_column = :name
21
21
  # the path or url to your user. This lambda is evaluated in the view context.
22
22
  # If the lambda returns nil, a span element is returned instead of a link; so
23
23
  # setting this to always return nil effectively disables all user links.
24
- Thredded.user_path = lambda do |user|
24
+ Thredded.user_path = ->(user) {
25
25
  user_path = :"#{Thredded.user_class_name.demodulize.underscore}_path"
26
26
  main_app.respond_to?(user_path) ? main_app.send(user_path, user) : "/users/#{user.to_param}"
27
- end
27
+ }
28
28
 
29
29
  # This method is used by Thredded controllers and views to fetch the currently signed-in user
30
30
  Thredded.current_user_method = :"current_#{Thredded.user_class_name.demodulize.underscore}"
@@ -32,13 +32,6 @@ Thredded.current_user_method = :"current_#{Thredded.user_class_name.demodulize.u
32
32
  # User avatar URL. rb-gravatar gem is used by default:
33
33
  Thredded.avatar_url = ->(user) { Gravatar.src(user.email, 156, 'mm') }
34
34
 
35
- # ==> Database Configuration
36
- # By default, thredded uses integers for record ID route constraints.
37
- # For integer based IDs (default):
38
- # Thredded.routes_id_constraint = /[1-9]\d*/
39
- # For UUID based IDs (example):
40
- # Thredded.routes_id_constraint = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
41
-
42
35
  # ==> Permissions Configuration
43
36
  # By default, thredded uses a simple permission model, where all the users can post to all message boards,
44
37
  # and admins and moderators are determined by a flag on the users table.
@@ -71,6 +64,12 @@ Thredded.currently_online_enabled = true
71
64
  # Whether private messaging functionality is enabled.
72
65
  Thredded.private_messaging_enabled = true
73
66
 
67
+ # The number of topics to display per page.
68
+ # Thredded.topics_per_page = 50
69
+
70
+ # The number of posts to display per page in a topic.
71
+ # Thredded.posts_per_page = 25
72
+
74
73
  # The layout for rendering Thredded views.
75
74
  Thredded.layout = 'thredded/application'
76
75
 
@@ -88,8 +87,8 @@ Thredded.layout = 'thredded/application'
88
87
  # The range of valid topic title lengths. Default:
89
88
  # Thredded.topic_title_length_range = (1..200)
90
89
 
91
- # ==> URLs
92
- # How Thredded generates URL slugs from text.
90
+ # ==> Routes and URLs
91
+ # How Thredded generates URL slugs from text:
93
92
 
94
93
  # Default:
95
94
  # Thredded.slugifier = ->(input) { input.parameterize }
@@ -97,6 +96,13 @@ Thredded.layout = 'thredded/application'
97
96
  # If your forum is in a language other than English, you might want to use the babosa gem instead
98
97
  # Thredded.slugifier = ->(input) { Babosa::Identifier.new(input).normalize.transliterate(:russian).to_s }
99
98
 
99
+ # By default, thredded uses integers for record ID route constraints.
100
+ # For integer based IDs (default):
101
+ # Thredded.routes_id_constraint = /[1-9]\d*/
102
+ #
103
+ # For UUID based IDs (example):
104
+ # Thredded.routes_id_constraint = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
105
+
100
106
  # ==> Post Content Formatting
101
107
  # Customize the way Thredded handles post formatting.
102
108
 
@@ -46,43 +46,85 @@ require 'thredded/collection_to_strings_with_cache_renderer'
46
46
 
47
47
  module Thredded
48
48
  class << self
49
- attr_accessor \
50
- :autocomplete_min_length,
51
- :active_user_threshold,
52
- :avatar_url,
53
- :email_from,
54
- :email_outgoing_prefix,
55
- :layout,
56
- :messageboards_order,
57
- :routes_id_constraint,
58
- :user_name_column
59
-
60
- # A lambda that generates a URL path to the user page for the given user.
61
- attr_writer :user_path
49
+ #== User
50
+
51
+ # @return [String] The name of the user class
52
+ attr_reader :user_class_name
62
53
 
63
54
  # @return [Symbol] The name of the method used by Thredded controllers and views to get the currently signed-in user
64
55
  attr_accessor :current_user_method
65
56
 
66
- # @return [Symbol] The name of the moderator flag column on the users table for the default permissions model
67
- attr_accessor :moderator_column
57
+ # @return [Symbol] The user table column that contains the username. Must be unique.
58
+ attr_accessor :user_name_column
59
+
60
+ # @return [Symbol] The name of the method used by Thredded to display users
61
+ attr_writer :user_display_name_method
62
+
63
+ # @return [Proc] A lambda that returns the avatar URL for the given user.
64
+ attr_accessor :avatar_url
65
+
66
+ # @return [Proc] A lambda that generates a URL path to the user page for the given user.
67
+ attr_writer :user_path
68
68
 
69
69
  # @return [Symbol] The name of the admin flag column on the users table for the default permissions model
70
70
  attr_accessor :admin_column
71
71
 
72
+ #== Moderation
73
+
72
74
  # @return [Boolean] Whether posts that are pending moderation are visible to regular users.
73
75
  attr_accessor :content_visible_while_pending_moderation
74
76
 
77
+ # @return [Symbol] The name of the moderator flag column on the users table for the default permissions model
78
+ attr_accessor :moderator_column
79
+
80
+ #== UI
81
+
82
+ # @return [String] The layout to use for rendering Thredded views.
83
+ attr_accessor :layout
84
+
85
+ #=== Topic page
86
+
87
+ # @return [Number] The number of posts to display per page in a topic.
88
+ attr_accessor :posts_per_page
89
+
75
90
  # @return [Boolean] Whether users that are following a topic are listed on the topic page.
76
91
  attr_accessor :show_topic_followers
77
92
 
78
- # @return [Symbol] The name of the method used by Thredded to display users
79
- attr_writer :user_display_name_method
93
+ #=== Private messages
80
94
 
81
- # @return [String] The name of the parent mailer class for Thredded mailers.
82
- attr_accessor :parent_mailer
95
+ # @return [Boolean] Whether the private messaging functionality is enabled.
96
+ attr_accessor :private_messaging_enabled
83
97
 
84
- # @return [Proc] The proc that Thredded uses to generate URL slugs from text.
85
- attr_accessor :slugifier
98
+ #=== Currently online
99
+
100
+ # @return [Boolean] Whether the list of users who are currently online is displayed.
101
+ attr_accessor :currently_online_enabled
102
+
103
+ # @return [ActiveSupport::Duration] How long the users are considered online after their last action.
104
+ attr_accessor :active_user_threshold
105
+
106
+ #=== Other
107
+
108
+ # How to calculate the position of messageboards in a list:
109
+ # :position set the position manually (new messageboards go to the bottom, by creation timestamp)
110
+ # :last_post_at_desc most recent post first
111
+ # :topics_count_desc most topics first
112
+ # @return [:position, :last_post_at_desc, :topics_count_desc]
113
+ attr_accessor :messageboards_order
114
+
115
+ # @return [Number] The number of topics to display per page.
116
+ attr_accessor :topics_per_page
117
+
118
+ # @return [Number] Minimum length to trigger username auto-completion for @-mentions and private message recipients.
119
+ attr_accessor :autocomplete_min_length
120
+
121
+ # @return [Thredded::AllViewHooks] View hooks configuration.
122
+ def view_hooks
123
+ Thredded::AllViewHooks.instance ||
124
+ fail('`Thredded.view_hooks` must be configured in a `Rails.application.config.to_prepare` block!')
125
+ end
126
+
127
+ #== Topic following and notifications
86
128
 
87
129
  # @return [Boolean] Whether the user should get subscribed to a new topic they've created.
88
130
  attr_accessor :auto_follow_when_creating_topic
@@ -90,26 +132,33 @@ module Thredded
90
132
  # @return [Boolean] Whether the user should get subscribed to a topic after posting in it.
91
133
  attr_accessor :auto_follow_when_posting_in_topic
92
134
 
93
- # @return [String] The name of the user class
94
- attr_reader :user_class_name
135
+ #== Emails
95
136
 
96
- # @return [Range<Integer>] The range of valid topic title lengths.
97
- attr_accessor :topic_title_length_range
137
+ # @return [String] The name of the parent mailer class for Thredded mailers.
138
+ attr_accessor :parent_mailer
98
139
 
99
- # @return [Boolean] Whether the list of users who are currently online is displayed.
100
- attr_accessor :currently_online_enabled
140
+ # @return [String] Sender email for Thredded notification emails.
141
+ attr_accessor :email_from
101
142
 
102
- # @return [Boolean] Whether the private messaging functionality is enabled.
103
- attr_accessor :private_messaging_enabled
143
+ # @return [String] Email subject prefix.
144
+ attr_accessor :email_outgoing_prefix
104
145
 
105
- # @return [Thredded::AllViewHooks] View hooks configuration.
106
- def view_hooks
107
- instance = Thredded::AllViewHooks.instance
108
- unless instance
109
- fail '`Thredded.view_hooks` must be configured in a `Rails.application.config.to_prepare` block!'
110
- end
111
- instance
112
- end
146
+ #== Routes
147
+
148
+ # @return [Proc] The proc that Thredded uses to generate URL slugs from text.
149
+ attr_accessor :slugifier
150
+
151
+ # By default, thredded uses integers for record ID route constraints.
152
+ # For integer based IDs (default):
153
+ # Thredded.routes_id_constraint = /[1-9]\d*/
154
+ # For UUID based IDs (example):
155
+ # Thredded.routes_id_constraint = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
156
+ attr_accessor :routes_id_constraint
157
+
158
+ #== Misc
159
+
160
+ # @return [Range<Integer>] The range of valid topic title lengths.
161
+ attr_accessor :topic_title_length_range
113
162
 
114
163
  # @return [Array] The notifiers, by default just the EmailNotifier
115
164
  def notifiers
@@ -164,6 +213,8 @@ module Thredded
164
213
  layout.is_a?(String) && layout.start_with?('thredded/')
165
214
  end
166
215
 
216
+ #== Helper methods for use by main app.
217
+
167
218
  # Returns a view for the given posts' scope, applying read permission filters to the scope.
168
219
  # Can be used in main_app, e.g. for showing the recent user posts on the profile page.
169
220
  #
@@ -187,22 +238,34 @@ module Thredded
187
238
  end
188
239
  end
189
240
 
190
- self.active_user_threshold = 5.minutes
191
- self.admin_column = :admin
192
- self.auto_follow_when_creating_topic = true
193
- self.auto_follow_when_posting_in_topic = true
194
- self.autocomplete_min_length = 2
241
+ self.user_name_column = :name
195
242
  self.avatar_url = ->(user) { Gravatar.src(user.email, 156, 'mm') }
243
+ self.admin_column = :admin
244
+
196
245
  self.content_visible_while_pending_moderation = true
246
+ self.moderator_column = :admin
247
+
197
248
  self.layout = 'thredded/application'
249
+
250
+ self.posts_per_page = 25
251
+ self.show_topic_followers = false
252
+
253
+ self.private_messaging_enabled = true
254
+
255
+ self.currently_online_enabled = true
256
+ self.active_user_threshold = 5.minutes
257
+
198
258
  self.messageboards_order = :position
199
- self.moderator_column = :admin
259
+ self.topics_per_page = 50
260
+ self.autocomplete_min_length = 2
261
+
262
+ self.auto_follow_when_creating_topic = true
263
+ self.auto_follow_when_posting_in_topic = true
264
+
200
265
  self.parent_mailer = 'ActionMailer::Base'
201
- self.routes_id_constraint = /[1-9]\d*/
202
- self.show_topic_followers = false
266
+
203
267
  self.slugifier = ->(input) { input.parameterize }
268
+ self.routes_id_constraint = /[1-9]\d*/
269
+
204
270
  self.topic_title_length_range = (1..200)
205
- self.user_name_column = :name
206
- self.private_messaging_enabled = true
207
- self.currently_online_enabled = true
208
271
  end