thredded 0.6.3 → 0.7.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.
- checksums.yaml +4 -4
- data/README.md +12 -12
- data/app/assets/images/thredded/follow.svg +1 -0
- data/app/assets/images/thredded/unfollow.svg +1 -0
- data/app/assets/stylesheets/thredded/_thredded.scss +27 -28
- data/app/assets/stylesheets/thredded/components/_alerts.scss +5 -5
- data/app/assets/stylesheets/thredded/components/_base.scss +5 -5
- data/app/assets/stylesheets/thredded/components/_currently-online.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_empty.scss +2 -2
- data/app/assets/stylesheets/thredded/components/_flash-message.scss +5 -5
- data/app/assets/stylesheets/thredded/components/_following.scss +17 -0
- data/app/assets/stylesheets/thredded/components/_form-list.scss +3 -3
- data/app/assets/stylesheets/thredded/components/_icons.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_main-section.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_messageboard.scss +6 -6
- data/app/assets/stylesheets/thredded/components/_pagination.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_post-form.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_post.scss +12 -11
- data/app/assets/stylesheets/thredded/components/_preferences.scss +1 -1
- data/app/assets/stylesheets/thredded/components/_select2.scss +4 -4
- data/app/assets/stylesheets/thredded/components/_topic-delete.scss +4 -8
- data/app/assets/stylesheets/thredded/components/_topic-header.scss +25 -11
- data/app/assets/stylesheets/thredded/components/_topics.scss +37 -15
- data/app/assets/stylesheets/thredded/layout/_main-container.scss +1 -1
- data/app/assets/stylesheets/thredded/layout/_main-navigation.scss +2 -2
- data/app/assets/stylesheets/thredded/layout/_moderation.scss +16 -15
- data/app/assets/stylesheets/thredded/layout/_navigation.scss +6 -6
- data/app/assets/stylesheets/thredded/layout/_search-navigation.scss +1 -1
- data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +13 -13
- data/app/assets/stylesheets/thredded/layout/_user.scss +1 -1
- data/app/assets/stylesheets/thredded/utilities/_is-compact.scss +1 -1
- data/app/assets/stylesheets/thredded/utilities/_is-expanded.scss +1 -1
- data/app/commands/thredded/notify_following_users.rb +1 -1
- data/app/controllers/thredded/messageboard_groups_controller.rb +3 -1
- data/app/controllers/thredded/messageboards_controller.rb +1 -3
- data/app/controllers/thredded/private_topics_controller.rb +1 -1
- data/app/controllers/thredded/topics_controller.rb +16 -9
- data/app/helpers/thredded/application_helper.rb +36 -0
- data/app/models/concerns/thredded/topic_common.rb +2 -2
- data/app/models/concerns/thredded/user_topic_read_state_common.rb +1 -1
- data/app/models/thredded/messageboard.rb +34 -7
- data/app/models/thredded/messageboard_group.rb +8 -1
- data/app/models/thredded/null_user.rb +4 -0
- data/app/models/thredded/post_moderation_record.rb +1 -1
- data/app/models/thredded/private_post.rb +5 -1
- data/app/models/thredded/stats.rb +1 -1
- data/app/models/thredded/topic.rb +5 -3
- data/app/models/thredded/user_detail.rb +2 -0
- data/app/models/thredded/user_extender.rb +4 -2
- data/app/models/thredded/user_topic_follow.rb +12 -1
- data/app/view_models/thredded/base_topic_view.rb +1 -1
- data/app/view_models/thredded/messageboard_group_view.rb +11 -0
- data/app/view_models/thredded/topic_view.rb +15 -2
- data/app/views/thredded/messageboards/_messageboard.html.erb +2 -2
- data/app/views/thredded/moderation/_post.html.erb +1 -1
- data/app/views/thredded/moderation/_post_moderation_record.html.erb +1 -1
- data/app/views/thredded/moderation/user.html.erb +1 -1
- data/app/views/thredded/moderation/users.html.erb +1 -1
- data/app/views/thredded/private_topic_mailer/message_notification.html.erb +1 -1
- data/app/views/thredded/private_topic_mailer/message_notification.text.erb +1 -1
- data/app/views/thredded/private_topics/_private_topic.html.erb +1 -1
- data/app/views/thredded/shared/_currently_online.html.erb +1 -1
- data/app/views/thredded/shared/_nav.html.erb +1 -1
- data/app/views/thredded/shared/_page.html.erb +2 -2
- data/app/views/thredded/topics/_followers.html.erb +12 -0
- data/app/views/thredded/topics/_header.html.erb +10 -9
- data/app/views/thredded/topics/_topic.html.erb +13 -2
- data/app/views/thredded/topics/index.html.erb +5 -0
- data/app/views/thredded/users/_link.html.erb +2 -2
- data/config/locales/en.yml +20 -18
- data/config/locales/pt-BR.yml +14 -9
- data/db/migrate/20160329231848_create_thredded.rb +4 -0
- data/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb +1 -1
- data/db/upgrade_migrations/20160723012349_upgrade_v0_6_to_v0_7.rb +43 -0
- data/lib/generators/thredded/install/templates/initializer.rb +15 -0
- data/lib/html/pipeline/at_mention_filter.rb +1 -1
- data/lib/thredded.rb +24 -0
- data/lib/thredded/database_seeder.rb +15 -5
- data/lib/thredded/version.rb +1 -1
- metadata +8 -9
- data/CHANGELOG.md +0 -399
- data/Procfile +0 -1
- data/config.ru +0 -3
- data/heroku.gemfile +0 -28
- data/heroku.gemfile.lock +0 -268
- data/thredded.gemspec +0 -78
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
<%= content_tag(:div, id: "thredded--container", class: thredded_container_classes, data: thredded_container_data) do %>
|
|
2
2
|
<%= render 'thredded/shared/header' %>
|
|
3
3
|
<%= render 'thredded/shared/flash_messages' %>
|
|
4
4
|
<%= yield :thredded_page_content %>
|
|
5
5
|
<%= render 'thredded/shared/currently_online' %>
|
|
6
|
-
|
|
6
|
+
<%- end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<% if Thredded.show_topic_followers %>
|
|
2
|
+
<div class="thredded--topic-followers">
|
|
3
|
+
<% if topic.followers.present? %>
|
|
4
|
+
<%= t('thredded.topics.followed_by')%>
|
|
5
|
+
<% topic.followers.each do |user| %>
|
|
6
|
+
<%= user_mention(user) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= t('thredded.topics.followed_by_noone')%>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
<%= link_to t('thredded.topics.edit'), topic.edit_path,
|
|
10
10
|
class: 'thredded--topic-header--edit-topic' %>
|
|
11
11
|
<% end %>
|
|
12
|
-
<% if
|
|
13
|
-
<% if
|
|
14
|
-
<div class="thredded--topic-follow-info
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<%=
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
<% if thredded_current_user %>
|
|
13
|
+
<% if topic.followed? %>
|
|
14
|
+
<div class="thredded--topic-header--follow-info">
|
|
15
|
+
<%= inline_svg 'thredded/follow.svg', class: 'thredded--topic-header--follow-icon' %>
|
|
16
|
+
<div>
|
|
17
|
+
<%= topic_follow_reason_text topic.follow_reason %>
|
|
18
|
+
<%= button_to 'Stop following', topic.unfollow_path %>
|
|
19
|
+
</div>
|
|
20
20
|
</div>
|
|
21
21
|
<% else %>
|
|
22
|
-
<div class="thredded--topic-follow-info
|
|
22
|
+
<div class="thredded--topic-header--follow-info">
|
|
23
23
|
<%= button_to 'Follow this topic', topic.follow_path %>
|
|
24
24
|
</div>
|
|
25
25
|
<% end %>
|
|
26
26
|
<% end %>
|
|
27
|
+
<%= render partial: 'thredded/topics/followers', locals: {topic: topic} %>
|
|
27
28
|
</header>
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
<%= content_tag :article,
|
|
2
2
|
id: dom_id(topic),
|
|
3
|
-
class: ['thredded--topics--topic', topic_css_classes(topic)]
|
|
3
|
+
class: ['thredded--topics--topic', topic_css_classes(topic)],
|
|
4
|
+
data: {topic: topic.id, messageboard: topic.messageboard_id} do %>
|
|
4
5
|
<div class="thredded--topics--posts-count"><%= topic.posts_count %></div>
|
|
5
6
|
|
|
7
|
+
<div class="thredded--topics--follow-info" title="<%= topic_follow_reason_text topic.follow_reason %>">
|
|
8
|
+
<svg class="thredded--topics--follow-icon" viewBox="0 0 116 121" role="img">
|
|
9
|
+
<% if topic.followed? %>
|
|
10
|
+
<use xlink:href="#thredded-follow-icon"/>
|
|
11
|
+
<% else %>
|
|
12
|
+
<use xlink:href="#thredded-unfollow-icon"/>
|
|
13
|
+
<% end %>
|
|
14
|
+
</svg>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
6
17
|
<h1 class="thredded--topics--title">
|
|
7
18
|
<%= link_to topic.title, topic.path %>
|
|
8
19
|
</h1>
|
|
@@ -14,7 +25,7 @@
|
|
|
14
25
|
<% end %>
|
|
15
26
|
|
|
16
27
|
<cite class="thredded--topics--updated-by">
|
|
17
|
-
<%= time_ago topic.
|
|
28
|
+
<%= time_ago topic.last_post_at %>
|
|
18
29
|
<%= user_link topic.last_user %>
|
|
19
30
|
</cite>
|
|
20
31
|
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
<% content_for :thredded_breadcrumbs, render('thredded/shared/breadcrumbs') %>
|
|
4
4
|
|
|
5
5
|
<%= thredded_page do %>
|
|
6
|
+
<div class="thredded--svg-definitions ">
|
|
7
|
+
<%= inline_svg 'thredded/follow.svg', id: 'thredded-follow-icon', title: nil %>
|
|
8
|
+
<%= inline_svg 'thredded/unfollow.svg', id: 'thredded-unfollow-icon' %>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
6
11
|
<%= content_tag :section, class: 'thredded--main-section thredded--topics', 'data-thredded-topics' => true do %>
|
|
7
12
|
<%= render 'thredded/topics/form',
|
|
8
13
|
messageboard: messageboard,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<% if user %>
|
|
2
2
|
<% if !user.thredded_anonymous? %>
|
|
3
|
-
<a href="<%= user_path(user) %>"><%= user.
|
|
3
|
+
<a href="<%= user_path(user) %>"><%= user.thredded_display_name %></a>
|
|
4
4
|
<% else %>
|
|
5
|
-
<%= user.
|
|
5
|
+
<%= user.thredded_display_name %>
|
|
6
6
|
<% end %>
|
|
7
7
|
<% else %>
|
|
8
8
|
<em><%= t 'thredded.null_user_name' %></em>
|
data/config/locales/en.yml
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
en:
|
|
3
3
|
thredded:
|
|
4
|
-
|
|
4
|
+
content_moderation_states:
|
|
5
|
+
content_blocked_notice: Blocked
|
|
6
|
+
content_blocked_notice_with_record_html: Blocked by %{moderator} %{time_ago}
|
|
5
7
|
errors:
|
|
6
8
|
login_required: Please sign in first.
|
|
7
9
|
not_authorized: You are not authorized to access this page.
|
|
@@ -9,9 +11,6 @@ en:
|
|
|
9
11
|
private_topic_not_found: This private topic does not exist.
|
|
10
12
|
form:
|
|
11
13
|
update: Update
|
|
12
|
-
content_moderation_states:
|
|
13
|
-
content_blocked_notice: Blocked
|
|
14
|
-
content_blocked_notice_with_record_html: Blocked by %{moderator} %{time_ago}
|
|
15
14
|
messageboard:
|
|
16
15
|
create: Create a New Messageboard
|
|
17
16
|
form:
|
|
@@ -24,7 +23,7 @@ en:
|
|
|
24
23
|
updated_notice: Messageboard has been updated
|
|
25
24
|
messageboard_group:
|
|
26
25
|
create: Create a New Messageboard Group
|
|
27
|
-
|
|
26
|
+
saved: Messageboard Group %{name} created
|
|
28
27
|
moderation:
|
|
29
28
|
approve_btn: Approve
|
|
30
29
|
block_btn: Block
|
|
@@ -41,8 +40,8 @@ en:
|
|
|
41
40
|
search_users:
|
|
42
41
|
form_label: Search users
|
|
43
42
|
form_placeholder: :thredded.moderation.search_users.form_label
|
|
44
|
-
results_message: Users with names starting with %{query}
|
|
45
43
|
no_results_message: No users with name starting with %{query}
|
|
44
|
+
results_message: Users with names starting with %{query}
|
|
46
45
|
nav:
|
|
47
46
|
all_messageboards: All Messageboards
|
|
48
47
|
edit_messageboard: Edit Messageboard
|
|
@@ -51,10 +50,10 @@ en:
|
|
|
51
50
|
edit_topic: Edit
|
|
52
51
|
mark_all_read: Mark All As Read
|
|
53
52
|
moderation: Moderation
|
|
53
|
+
moderation_activity: Activity
|
|
54
54
|
moderation_history: History
|
|
55
55
|
moderation_pending: Pending
|
|
56
56
|
moderation_users: Users
|
|
57
|
-
moderation_activity: Activity
|
|
58
57
|
private_topics: Private Messages
|
|
59
58
|
settings: Notification Settings
|
|
60
59
|
null_user_name: Deleted user
|
|
@@ -111,6 +110,7 @@ en:
|
|
|
111
110
|
create_btn: Start your first private conversation
|
|
112
111
|
title: You have no private messages.
|
|
113
112
|
updated_notice: Title updated
|
|
113
|
+
recent_activity: Recent activity
|
|
114
114
|
search:
|
|
115
115
|
form:
|
|
116
116
|
btn_submit: :thredded.search.form.label
|
|
@@ -121,12 +121,13 @@ en:
|
|
|
121
121
|
delete_topic: Delete Topic
|
|
122
122
|
deleted_notice: Topic deleted
|
|
123
123
|
edit: Edit Topic
|
|
124
|
+
followed_by: 'Followed by:'
|
|
125
|
+
followed_by_noone: No one is following this topic
|
|
124
126
|
followed_notice: You are now following this topic
|
|
125
127
|
following:
|
|
126
128
|
manual: You are following this topic.
|
|
127
129
|
mentioned: You are following this topic because you were mentioned on it.
|
|
128
130
|
posted: You are following this topic because you posted to it.
|
|
129
|
-
following_will_receive_emails: You will receive email updates.
|
|
130
131
|
form:
|
|
131
132
|
categories_placeholder: Categories
|
|
132
133
|
content_label: :thredded.posts.form.content_label
|
|
@@ -134,6 +135,7 @@ en:
|
|
|
134
135
|
title_placeholder: :thredded.topics.form.title_label
|
|
135
136
|
title_placeholder_start: Start a New Topic
|
|
136
137
|
update_btn: Update Topic
|
|
138
|
+
not_following: You are not following this topic.
|
|
137
139
|
search:
|
|
138
140
|
no_results_message: There are no results for your search - %{query}
|
|
139
141
|
page_title: Topics Search Results
|
|
@@ -142,16 +144,16 @@ en:
|
|
|
142
144
|
unfollowed_notice: You are no longer following this topic
|
|
143
145
|
updated_notice: Topic updated
|
|
144
146
|
users:
|
|
145
|
-
last_active_html:
|
|
146
|
-
posted_in_topic_html:
|
|
147
|
+
last_active_html: Last active %{time_ago}
|
|
148
|
+
posted_in_topic_html: Posted in %{topic_link}
|
|
149
|
+
posts_count:
|
|
150
|
+
one: Posted once
|
|
151
|
+
other: Posted %{count} times
|
|
147
152
|
recent_activity: :thredded.recent_activity
|
|
148
|
-
started_topic_html:
|
|
153
|
+
started_topic_html: Started %{topic_link}
|
|
154
|
+
started_topics_count:
|
|
155
|
+
one: Started one topic
|
|
156
|
+
other: Started %{count} topics
|
|
149
157
|
user_posted_in_topic_html: "%{user_link} posted in %{topic_link}"
|
|
150
|
-
user_since_html:
|
|
158
|
+
user_since_html: User since %{time_ago}
|
|
151
159
|
user_started_topic_html: "%{user_link} started %{topic_link}"
|
|
152
|
-
started_topics_count:
|
|
153
|
-
one: "Started one topic"
|
|
154
|
-
other: "Started %{count} topics"
|
|
155
|
-
posts_count:
|
|
156
|
-
one: "Posted once"
|
|
157
|
-
other: "Posted %{count} times"
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -23,7 +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
|
-
|
|
26
|
+
saved: Groupo de mensagens %{name} salvou
|
|
27
27
|
moderation:
|
|
28
28
|
approve_btn: Aprovar
|
|
29
29
|
block_btn: Quadra
|
|
@@ -34,8 +34,9 @@ pt-BR:
|
|
|
34
34
|
post_approved_html: Pós aprovado por %{moderator} %{time_ago}.
|
|
35
35
|
post_blocked_html: Pós bloqueado por %{moderator} %{time_ago}.
|
|
36
36
|
post_deleted_notice: Este post foi apagado.
|
|
37
|
-
posts_content_changed_since_moderation_html:
|
|
38
|
-
vez que foi moderado. Abaixo está o conteúdo
|
|
37
|
+
posts_content_changed_since_moderation_html: >-
|
|
38
|
+
O <a href="%{post_url}">de pós</a> alteração de conteúdo, uma vez que foi moderado. Abaixo está o conteúdo
|
|
39
|
+
no momento em que foi moderado.
|
|
39
40
|
search_users:
|
|
40
41
|
form_label: Buscar usuários
|
|
41
42
|
form_placeholder: :thredded.moderation.search_users.form_label
|
|
@@ -72,13 +73,15 @@ pt-BR:
|
|
|
72
73
|
form:
|
|
73
74
|
global_preferences_label: Configurações Globais
|
|
74
75
|
messageboard_notify_on_mention:
|
|
75
|
-
hint:
|
|
76
|
-
|
|
76
|
+
hint: >-
|
|
77
|
+
Quando alguém mencionar você através do seu usuário (ex.: @sam) neste fórum de mensagens, você irá receber
|
|
78
|
+
um e-mail com o conteúdo deste post.
|
|
77
79
|
label: :thredded.preferences.form.notify_on_mention.label
|
|
78
80
|
messageboard_preferences_label_html: Configurações de Notificação para <em>%{messageboard}</em>
|
|
79
81
|
notify_on_mention:
|
|
80
|
-
hint:
|
|
81
|
-
o conteúdo
|
|
82
|
+
hint: >-
|
|
83
|
+
Quando alguém mencionar você através do seu usuário (ex.: @sam) você irá receber um e-mail com o conteúdo
|
|
84
|
+
deste post.
|
|
82
85
|
label: "@ Notificações"
|
|
83
86
|
notify_on_message:
|
|
84
87
|
hint: Quando você for adicionado a uma conversa privada, você receberá um e-mail com o conteúdo desta
|
|
@@ -119,12 +122,13 @@ pt-BR:
|
|
|
119
122
|
delete_topic: Remover Tópico
|
|
120
123
|
deleted_notice: Tópico removido
|
|
121
124
|
edit: Editar Tópico
|
|
125
|
+
followed_by: 'Seguido por:'
|
|
126
|
+
followed_by_noone: Ninguém está seguindo este tópico
|
|
122
127
|
followed_notice: Você agora está acompanhando este tópico
|
|
123
128
|
following:
|
|
124
129
|
manual: Você está acompanhando este tópico.
|
|
125
130
|
mentioned: Você está acompanhando este tópico porque você foi mencionado nele.
|
|
126
131
|
posted: Você está acompanhando este tópico porque foi você que o publicou.
|
|
127
|
-
following_will_receive_emails: Você irá receber e-mail com atualizações.
|
|
128
132
|
form:
|
|
129
133
|
categories_placeholder: Categorias
|
|
130
134
|
content_label: :thredded.posts.form.content_label
|
|
@@ -132,6 +136,7 @@ pt-BR:
|
|
|
132
136
|
title_placeholder: :thredded.topics.form.title_label
|
|
133
137
|
title_placeholder_start: Iniciar um novo tópico
|
|
134
138
|
update_btn: Atualizar Tópico
|
|
139
|
+
not_following: Você não está seguindo este tema.
|
|
135
140
|
search:
|
|
136
141
|
no_results_message: Nenhum resultado encontrado para sua busca - %{query}
|
|
137
142
|
page_title: Tópicos dos Resultados da Busca
|
|
@@ -140,7 +145,7 @@ pt-BR:
|
|
|
140
145
|
unfollowed_notice: Você não está mais acompanhando este tópico
|
|
141
146
|
updated_notice: Tópico atualizado
|
|
142
147
|
users:
|
|
143
|
-
last_active_html:
|
|
148
|
+
last_active_html: Última %{time_ago} ativa
|
|
144
149
|
posted_in_topic_html: Postou em %{topic_link}
|
|
145
150
|
posts_count:
|
|
146
151
|
one: Postado uma vez
|
|
@@ -37,6 +37,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
|
37
37
|
t.text :description
|
|
38
38
|
t.integer :topics_count, default: 0
|
|
39
39
|
t.integer :posts_count, default: 0
|
|
40
|
+
t.integer :position, null: false
|
|
40
41
|
t.boolean :closed, default: false, null: false
|
|
41
42
|
t.references :last_topic
|
|
42
43
|
t.references :messageboard_group
|
|
@@ -88,6 +89,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
|
88
89
|
t.string :slug, limit: 191, null: false
|
|
89
90
|
t.integer :posts_count, default: 0
|
|
90
91
|
t.string :hash_id, limit: 191, null: false
|
|
92
|
+
t.datetime :last_post_at
|
|
91
93
|
t.timestamps null: false
|
|
92
94
|
t.index [:hash_id], name: :index_thredded_private_topics_on_hash_id
|
|
93
95
|
t.index [:slug], name: :index_thredded_private_topics_on_slug
|
|
@@ -120,6 +122,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
|
120
122
|
t.string :hash_id, limit: 191, null: false
|
|
121
123
|
t.string :type, limit: 191
|
|
122
124
|
t.integer :moderation_state, null: false
|
|
125
|
+
t.datetime :last_post_at
|
|
123
126
|
t.timestamps null: false
|
|
124
127
|
t.index %i(moderation_state sticky updated_at),
|
|
125
128
|
order: { sticky: :desc, updated_at: :desc },
|
|
@@ -188,6 +191,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
|
188
191
|
|
|
189
192
|
create_table :thredded_messageboard_groups do |t|
|
|
190
193
|
t.string :name
|
|
194
|
+
t.integer :position, null: false
|
|
191
195
|
t.timestamps null: false
|
|
192
196
|
end
|
|
193
197
|
|
|
@@ -4,7 +4,7 @@ class UpgradeV05ToV06 < ActiveRecord::Migration
|
|
|
4
4
|
add_column :thredded_messageboards, :last_topic_id, :integer
|
|
5
5
|
Thredded::Messageboard.reset_column_information
|
|
6
6
|
Thredded::Messageboard.all.each do |messageboard|
|
|
7
|
-
messageboard.update!(last_topic_id: messageboard.topics.
|
|
7
|
+
messageboard.update!(last_topic_id: messageboard.topics.order(updated_at: :desc, id: :desc).first.try(:id))
|
|
8
8
|
end
|
|
9
9
|
change_column_null :thredded_posts, :postable_id, false
|
|
10
10
|
# Allow null on user_id and last_user_id because users can get deleted.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
class UpgradeV06ToV07 < ActiveRecord::Migration
|
|
3
|
+
def up
|
|
4
|
+
Thredded::MessageboardGroup.transaction do
|
|
5
|
+
Thredded::MessageboardGroup.where(
|
|
6
|
+
name: Thredded::MessageboardGroup.group(:name).having('count(id) > 1').select(:name)
|
|
7
|
+
).group_by(&:name).each_value do |messageboard_groups|
|
|
8
|
+
messageboard_groups.from(1).each_with_index do |messageboard_group, i|
|
|
9
|
+
messageboard_group.update!(name: "#{messageboard_group.name}-#{i + 1}")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
add_index :thredded_messageboard_groups,
|
|
15
|
+
:name,
|
|
16
|
+
unique: true,
|
|
17
|
+
name: :index_thredded_messageboard_group_on_name
|
|
18
|
+
|
|
19
|
+
add_column :thredded_topics, :last_post_at, :datetime
|
|
20
|
+
add_column :thredded_private_topics, :last_post_at, :datetime
|
|
21
|
+
# update existing values to pretty accurate match
|
|
22
|
+
Thredded::Topic.update_all('last_post_at = updated_at')
|
|
23
|
+
Thredded::PrivateTopic.update_all('last_post_at = updated_at')
|
|
24
|
+
|
|
25
|
+
add_column :thredded_messageboards, :position, :integer
|
|
26
|
+
Thredded::Messageboard.reset_column_information
|
|
27
|
+
Thredded::Messageboard.all.each { |m| m.update_column(:position, m.created_at.to_i) }
|
|
28
|
+
change_column :thredded_messageboards, :position, :integer, null: false
|
|
29
|
+
|
|
30
|
+
add_column :thredded_messageboard_groups, :position, :integer
|
|
31
|
+
Thredded::MessageboardGroup.reset_column_information
|
|
32
|
+
Thredded::MessageboardGroup.all.each { |mg| mg.update_column(:position, mg.created_at.to_i) }
|
|
33
|
+
change_column :thredded_messageboard_groups, :position, :integer, null: false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def down
|
|
37
|
+
remove_index :thredded_messageboard_groups, name: :index_thredded_messageboard_group_on_name
|
|
38
|
+
remove_column :thredded_topics, :last_post_at
|
|
39
|
+
remove_column :thredded_private_topics, :last_post_at
|
|
40
|
+
remove_column :thredded_messageboards, :position
|
|
41
|
+
remove_column :thredded_messageboard_groups, :position
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -11,6 +11,10 @@ Thredded.user_class = 'User'
|
|
|
11
11
|
# This is the column used to search for users' names if/when someone is @ mentioned.
|
|
12
12
|
Thredded.user_name_column = :name
|
|
13
13
|
|
|
14
|
+
# User display name method, by default thredded uses the user_name_column defined above
|
|
15
|
+
# You may want to use :to_s or some more elaborate method
|
|
16
|
+
# Thredded.user_display_name_method = :to_s
|
|
17
|
+
|
|
14
18
|
# The path (or URL) you will use to link to your users' profiles.
|
|
15
19
|
# When linking to a user, Thredded will use this lambda to spit out
|
|
16
20
|
# the path or url to your user. This lambda is evaluated in the view context.
|
|
@@ -37,9 +41,20 @@ Thredded.admin_column = :admin
|
|
|
37
41
|
# Whether posts and topics pending moderation are visible to regular users.
|
|
38
42
|
Thredded.content_visible_while_pending_moderation = true
|
|
39
43
|
|
|
44
|
+
# Whether users that are following a topic are listed on topic page.
|
|
45
|
+
Thredded.show_topic_followers = false
|
|
46
|
+
|
|
40
47
|
# This model can be customized further by overriding a handful of methods on the User model.
|
|
41
48
|
# For more information, see app/models/thredded/user_extender.rb.
|
|
42
49
|
|
|
50
|
+
# ==> Ordering configuration
|
|
51
|
+
|
|
52
|
+
# How to calculate the position of messageboards in a list:
|
|
53
|
+
# :position (default) set the position manually (new messageboards go to the bottom, by creation timestamp)
|
|
54
|
+
# :last_post_at_desc most recent post first
|
|
55
|
+
# :topics_count_desc most topics first
|
|
56
|
+
Thredded.messageboards_order = :position
|
|
57
|
+
|
|
43
58
|
# ==> Email Configuration
|
|
44
59
|
# Email "From:" field will use the following
|
|
45
60
|
# Thredded.email_from = 'no-reply@example.com'
|
|
@@ -44,7 +44,7 @@ module HTML
|
|
|
44
44
|
names = mentioned_names(text_node_html)
|
|
45
45
|
return unless names.present?
|
|
46
46
|
@users_provider.call(names).each do |user|
|
|
47
|
-
name = user.
|
|
47
|
+
name = user.thredded_display_name
|
|
48
48
|
maybe_quoted_name = name.include?(' ') ? %("#{name}") : name
|
|
49
49
|
url = Thredded.user_path(@view_context, user)
|
|
50
50
|
text_node_html.gsub!(
|
data/lib/thredded.rb
CHANGED
|
@@ -33,7 +33,9 @@ module Thredded
|
|
|
33
33
|
:email_outgoing_prefix,
|
|
34
34
|
:email_reply_to,
|
|
35
35
|
:layout,
|
|
36
|
+
:messageboards_order,
|
|
36
37
|
:user_class,
|
|
38
|
+
:user_display_name_method,
|
|
37
39
|
:user_name_column,
|
|
38
40
|
:user_path
|
|
39
41
|
|
|
@@ -49,6 +51,12 @@ module Thredded
|
|
|
49
51
|
# @return [Boolean] Whether posts that are pending moderation are visible to regular users.
|
|
50
52
|
mattr_accessor :content_visible_while_pending_moderation
|
|
51
53
|
|
|
54
|
+
# @return [Boolean] Whether users that are following a topic are listed on topic page.
|
|
55
|
+
mattr_accessor :show_topic_followers
|
|
56
|
+
|
|
57
|
+
# @return [Symbol] The name of the method used by Thredded to display users
|
|
58
|
+
mattr_accessor :user_display_name_method
|
|
59
|
+
|
|
52
60
|
self.active_user_threshold = 5.minutes
|
|
53
61
|
self.admin_column = :admin
|
|
54
62
|
self.avatar_url = ->(user) { Gravatar.src(user.email, 128, 'mm') }
|
|
@@ -57,6 +65,22 @@ module Thredded
|
|
|
57
65
|
self.moderator_column = :admin
|
|
58
66
|
self.user_name_column = :name
|
|
59
67
|
self.content_visible_while_pending_moderation = true
|
|
68
|
+
self.show_topic_followers = false
|
|
69
|
+
self.messageboards_order = :position
|
|
70
|
+
|
|
71
|
+
def self.user_display_name_method
|
|
72
|
+
@@user_display_name_method || user_name_column
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @param value [:position, :topics_count_desc, :last_post_at_desc]
|
|
76
|
+
def self.messageboards_order=(value)
|
|
77
|
+
case value
|
|
78
|
+
when :position, :topics_count_desc, :last_post_at_desc
|
|
79
|
+
@@messageboards_order = value # rubocop:disable Style/ClassVars
|
|
80
|
+
else
|
|
81
|
+
fail ArgumentError, "Unexpected value for Thredded.messageboards_order: #{value}"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
60
84
|
|
|
61
85
|
# @return [Class<Thredded::UserExtender>] the user class from the host application.
|
|
62
86
|
def self.user_class
|