thredded 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.mkdn +21 -0
- data/README.mkdn +17 -1
- data/app/assets/stylesheets/thredded/_thredded.scss +1 -0
- data/app/assets/stylesheets/thredded/base/_grid.scss +6 -0
- data/app/assets/stylesheets/thredded/base/_nav.scss +51 -0
- data/app/assets/stylesheets/thredded/base/_variables.scss +1 -0
- data/app/assets/stylesheets/thredded/components/_base.scss +4 -0
- data/app/assets/stylesheets/thredded/components/_post.scss +19 -6
- data/app/assets/stylesheets/thredded/components/_topics.scss +6 -0
- data/app/assets/stylesheets/thredded/layout/_moderation.scss +53 -8
- data/app/assets/stylesheets/thredded/layout/_navigation.scss +1 -1
- data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +7 -47
- data/app/assets/stylesheets/thredded/layout/_user.scss +10 -0
- data/app/commands/thredded/moderate_post.rb +1 -1
- data/app/controllers/thredded/messageboards_controller.rb +1 -1
- data/app/controllers/thredded/moderation_controller.rb +39 -5
- data/app/helpers/thredded/application_helper.rb +4 -2
- data/app/models/concerns/thredded/content_moderation_state.rb +15 -8
- data/app/models/concerns/thredded/post_common.rb +1 -0
- data/app/models/concerns/thredded/topic_common.rb +0 -1
- data/app/models/thredded/messageboard.rb +4 -4
- data/app/models/thredded/post.rb +2 -0
- data/app/models/thredded/post_moderation_record.rb +3 -1
- data/app/models/thredded/topic.rb +17 -0
- data/app/models/thredded/user_extender.rb +7 -0
- data/app/policies/thredded/post_policy.rb +2 -0
- data/app/policies/thredded/topic_policy.rb +6 -6
- data/app/view_models/thredded/post_view.rb +19 -1
- data/app/view_models/thredded/posts_page_view.rb +1 -0
- data/app/view_models/thredded/topic_view.rb +5 -1
- data/app/views/thredded/messageboards/_messageboard.html.erb +3 -3
- data/app/views/thredded/moderation/_nav.html.erb +16 -0
- data/app/views/thredded/moderation/_post.html.erb +9 -2
- data/app/views/thredded/moderation/_post_moderation_record.html.erb +22 -19
- data/app/views/thredded/moderation/_user_moderation_state.html.erb +3 -0
- data/app/views/thredded/moderation/_user_post.html.erb +7 -0
- data/app/views/thredded/moderation/_users_search_form.html.erb +10 -0
- data/app/views/thredded/moderation/history.html.erb +2 -8
- data/app/views/thredded/moderation/pending.html.erb +3 -10
- data/app/views/thredded/moderation/user.html.erb +42 -0
- data/app/views/thredded/moderation/users.html.erb +38 -0
- data/app/views/thredded/posts/_post.html.erb +4 -0
- data/app/views/thredded/posts_common/_header.html.erb +1 -0
- data/app/views/thredded/posts_common/_header_with_topic.html.erb +15 -0
- data/app/views/thredded/posts_common/_header_with_user_and_topic.html.erb +18 -0
- data/app/views/thredded/search/_form.html.erb +3 -1
- data/app/views/thredded/shared/_content_moderation_blocked_state.html.erb +8 -0
- data/app/views/thredded/shared/_nav.html.erb +8 -4
- data/app/views/thredded/topics/_topic.html.erb +6 -0
- data/app/views/thredded/users/_post.html.erb +6 -0
- data/app/views/thredded/users/_posts.html.erb +7 -0
- data/config/locales/en.yml +29 -3
- data/config/locales/pt-BR.yml +34 -9
- data/config/routes.rb +7 -2
- data/db/migrate/20160329231848_create_thredded.rb +22 -21
- data/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb +25 -0
- data/heroku.gemfile.lock +2 -2
- data/lib/thredded.rb +17 -5
- data/lib/thredded/version.rb +1 -1
- metadata +15 -2
@@ -1,16 +1,9 @@
|
|
1
1
|
<% content_for :thredded_page_title, t('thredded.nav.moderation') %>
|
2
2
|
<% content_for :thredded_page_id, 'thredded--pending-moderation' %>
|
3
|
-
|
4
|
-
<ul class="thredded--navigation-breadcrumbs">
|
5
|
-
<li><%= link_to t('thredded.nav.all_messageboards'), messageboards_path %></li>
|
6
|
-
<li><%= link_to t('thredded.nav.moderation'), pending_moderation_path %></li>
|
7
|
-
</ul>
|
8
|
-
<% end %>
|
3
|
+
<%= render 'nav' %>
|
9
4
|
|
10
5
|
<%= thredded_page do %>
|
11
6
|
<%= content_tag :section, class: 'thredded--main-section' do %>
|
12
|
-
<%= link_to t('thredded.nav.moderation_history'), moderation_history_path,
|
13
|
-
class: 'thredded--link thredded--moderation--history-link' %>
|
14
7
|
<% if @last_moderated_record %>
|
15
8
|
<div class="thredded--moderated-notice">
|
16
9
|
<%= render 'post_moderation_record', post_moderation_record: @last_moderated_record %>
|
@@ -21,8 +14,8 @@
|
|
21
14
|
<%= paginate @posts %>
|
22
15
|
<% else %>
|
23
16
|
<div class="thredded--empty">
|
24
|
-
<h3 class="thredded--empty--title"><%= t 'thredded.moderation.
|
25
|
-
<p><%= t 'thredded.moderation.
|
17
|
+
<h3 class="thredded--empty--title"><%= t 'thredded.moderation.pending.empty.title' %></h3>
|
18
|
+
<p><%= t 'thredded.moderation.pending.empty.content' %></p>
|
26
19
|
</div>
|
27
20
|
<% end %>
|
28
21
|
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%
|
2
|
+
user = @user
|
3
|
+
user_detail = user.thredded_user_detail
|
4
|
+
%>
|
5
|
+
<% content_for :thredded_page_title, t('thredded.nav.moderation') %>
|
6
|
+
<% content_for :thredded_page_id, 'thredded--moderation-user' %>
|
7
|
+
<%= render 'nav' %>
|
8
|
+
<%= thredded_page do %>
|
9
|
+
<h1 class="thredded--moderation--user--title">
|
10
|
+
<%= image_tag Thredded.avatar_url.call(user), class: 'thredded--user--avatar' %><%= user %>
|
11
|
+
</h1>
|
12
|
+
<ul class="thredded--moderation--user--info">
|
13
|
+
<li><%= t 'thredded.users.user_since_html', time_ago: time_ago(user.created_at) %></li>
|
14
|
+
<% if user_detail.last_seen_at %>
|
15
|
+
<li><%= t 'thredded.users.last_active_html', time_ago: time_ago(user_detail.last_seen_at) %></li>
|
16
|
+
<% end %>
|
17
|
+
<% if user_detail.topics_count > 0 %>
|
18
|
+
<li><%= t 'thredded.users.started_topics_count', count: user_detail.topics_count %></li>
|
19
|
+
<% end %>
|
20
|
+
<% if user_detail.posts_count > 0 %>
|
21
|
+
<li><%= t 'thredded.users.posts_count', count: user_detail.posts_count %></li>
|
22
|
+
<% end %>
|
23
|
+
<li><%= render 'user_moderation_state', user: @user %></li>
|
24
|
+
</ul>
|
25
|
+
<div class="thredded--user--moderation-actions">
|
26
|
+
<% unless user_detail.approved? %>
|
27
|
+
<%= button_to t('thredded.moderation.approve_btn'), moderate_user_path,
|
28
|
+
class: 'thredded--button',
|
29
|
+
params: { id: user.to_model.id, moderation_state: 'approved' } %>
|
30
|
+
<% end %>
|
31
|
+
<% unless user_detail.blocked? %>
|
32
|
+
<%= button_to t('thredded.moderation.block_btn'), moderate_user_path,
|
33
|
+
class: 'thredded--button',
|
34
|
+
params: { id: user.to_model.id, moderation_state: 'blocked' } %>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
<% if @posts.present? %>
|
38
|
+
<h2><%= t 'thredded.users.recent_activity' %></h2>
|
39
|
+
<%= render partial: 'user_post', collection: @posts, as: :post %>
|
40
|
+
<%= paginate @posts %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<% content_for :thredded_page_title, t('thredded.nav.moderation') %>
|
2
|
+
<% content_for :thredded_page_id, 'thredded--moderation-users' %>
|
3
|
+
<%= render 'nav' %>
|
4
|
+
|
5
|
+
<%= thredded_page do %>
|
6
|
+
<% if @users.present? %>
|
7
|
+
<% if @query.present? %>
|
8
|
+
<p class="thredded--alert thredded--alert-success">
|
9
|
+
<%= t 'thredded.moderation.search_users.results_message', query: "'#{@query}'" %>
|
10
|
+
</p>
|
11
|
+
<% end %>
|
12
|
+
<table class="thredded--moderation--users-table thredded--table">
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<th>User</th>
|
16
|
+
<th>Moderation state</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @users.each do |user| %>
|
21
|
+
<tr>
|
22
|
+
<td>
|
23
|
+
<%= link_to user, user_moderation_path(user.id), class: 'thredded--link' %>
|
24
|
+
</td>
|
25
|
+
<td>
|
26
|
+
<%= render 'user_moderation_state', user: user %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
<%= paginate @users %>
|
33
|
+
<% else %>
|
34
|
+
<p class="thredded--alert thredded--alert-danger">
|
35
|
+
<%= t 'thredded.moderation.search_users.no_results_message', query: "'#{@query}'" %>
|
36
|
+
</p>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
@@ -5,6 +5,10 @@
|
|
5
5
|
<%= render 'thredded/posts_common/actions', post: post %>
|
6
6
|
<% if post.pending_moderation? && !Thredded.content_visible_while_pending_moderation %>
|
7
7
|
<p class="thredded--alert thredded--alert-warning"><%= t 'thredded.posts.pending_moderation_notice' %></p>
|
8
|
+
<% elsif post.blocked? && post.can_moderate? %>
|
9
|
+
<p class="thredded--alert thredded--alert-danger">
|
10
|
+
<%= render 'thredded/shared/content_moderation_blocked_state', moderation_record: post.last_moderation_record %>
|
11
|
+
</p>
|
8
12
|
<% end %>
|
9
13
|
<% end %>
|
10
14
|
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%# @param post [Thredded::PostView] %>
|
2
|
+
<% topic = post.to_model.postable %>
|
3
|
+
<header>
|
4
|
+
<h2 class="thredded--post--topic">
|
5
|
+
<%=
|
6
|
+
topic_link = link_to(topic.title, post.permalink_path)
|
7
|
+
if topic.first_post == post.to_model
|
8
|
+
t 'thredded.users.started_topic_html', topic_link: topic_link
|
9
|
+
else
|
10
|
+
t 'thredded.users.posted_in_topic_html', topic_link: topic_link
|
11
|
+
end
|
12
|
+
%>
|
13
|
+
</h2>
|
14
|
+
<p class="thredded--post--created-at"><%= time_ago post.created_at %></p>
|
15
|
+
</header>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%# @param post [Thredded::PostView] %>
|
2
|
+
<%# @param post_user_link [String] optional %>
|
3
|
+
<% topic = post.to_model.postable %>
|
4
|
+
<% post_user_link ||= user_link(post.user) %>
|
5
|
+
<header>
|
6
|
+
<%= image_tag post.avatar_url, class: 'thredded--post--avatar' if post.user %>
|
7
|
+
<h2 class="thredded--post--user-and-topic">
|
8
|
+
<%=
|
9
|
+
topic_link = link_to(topic.title, post.permalink_path)
|
10
|
+
if topic.first_post == post.to_model
|
11
|
+
t 'thredded.users.user_started_topic_html', user_link: post_user_link, topic_link: topic_link
|
12
|
+
else
|
13
|
+
t 'thredded.users.user_posted_in_topic_html', user_link: post_user_link, topic_link: topic_link
|
14
|
+
end
|
15
|
+
%>
|
16
|
+
</h2>
|
17
|
+
<p class="thredded--post--created-at"><%= time_ago post.created_at %></p>
|
18
|
+
</header>
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<%= form_tag search_path(messageboard),
|
1
|
+
<%= form_tag search_path(messageboard),
|
2
|
+
method: 'get',
|
3
|
+
class: 'thredded--form thredded--navigation--search thredded--navigation--search-topics' do %>
|
2
4
|
<%= label_tag :q, t('thredded.search.form.label') %>
|
3
5
|
<%= text_field_tag :q, @query,
|
4
6
|
type: 'search',
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% # @param moderation_record [Thredded::PostModerationRecord, nil] %>
|
2
|
+
<% if moderation_record %>
|
3
|
+
<%= t 'thredded.content_moderation_states.content_blocked_notice_with_record_html',
|
4
|
+
moderator: user_link(moderation_record.moderator),
|
5
|
+
time_ago: time_ago(moderation_record.created_at) %>
|
6
|
+
<% else %>
|
7
|
+
<%= t 'thredded.content_moderation_states.content_blocked_notice' %>
|
8
|
+
<% end %>
|
@@ -14,8 +14,12 @@
|
|
14
14
|
<%= render 'thredded/shared/nav/standalone' %>
|
15
15
|
<% end %>
|
16
16
|
</ul>
|
17
|
-
|
18
|
-
<%= yield :
|
19
|
-
|
20
|
-
|
17
|
+
<% if content_for? :thredded_main_navigation %>
|
18
|
+
<%= yield :thredded_main_navigation %>
|
19
|
+
<% else %>
|
20
|
+
<div class="thredded--main-navigation">
|
21
|
+
<%= yield :thredded_breadcrumbs %>
|
22
|
+
<%= render 'thredded/search/form', messageboard: messageboard_or_nil %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
21
25
|
</nav>
|
@@ -22,4 +22,10 @@
|
|
22
22
|
<%= time_ago topic.created_at %>
|
23
23
|
<%= user_link topic.user %>
|
24
24
|
</cite>
|
25
|
+
|
26
|
+
<% if topic.blocked? && topic.can_moderate? %>
|
27
|
+
<span class="thredded--topics--moderation-state thredded--alert thredded--alert-danger">
|
28
|
+
<%= render 'thredded/shared/content_moderation_blocked_state', moderation_record: topic.last_moderation_record %>
|
29
|
+
</span>
|
30
|
+
<% end %>
|
25
31
|
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%# @param post [Thredded::PostView] %>
|
2
|
+
<%= content_tag :article, id: dom_id(post), class: 'thredded--post' do %>
|
3
|
+
<%= render 'thredded/posts_common/header_with_topic', post: post %>
|
4
|
+
<%= render 'thredded/posts_common/content', post: post %>
|
5
|
+
<%= render 'thredded/posts_common/actions', post: post %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%#
|
2
|
+
This partial can be called from the parent app to render the user's posts.
|
3
|
+
The parent view context that renders this partial must include Thredded::ApplicationHelper.
|
4
|
+
TODO: Use a Cell instead. https://github.com/apotonick/cells
|
5
|
+
%>
|
6
|
+
<%# @param posts [Thredded::PostsPageView] %>
|
7
|
+
<%= render partial: 'thredded/users/post', collection: posts %>
|
data/config/locales/en.yml
CHANGED
@@ -8,6 +8,9 @@ en:
|
|
8
8
|
private_topic_not_found: This private topic does not exist.
|
9
9
|
form:
|
10
10
|
update: Update
|
11
|
+
content_moderation_states:
|
12
|
+
content_blocked_notice: Blocked by a moderator
|
13
|
+
content_blocked_notice_with_record_html: Blocked by %{moderator} %{time_ago}
|
11
14
|
messageboard:
|
12
15
|
create: Create a New Messageboard
|
13
16
|
form:
|
@@ -23,15 +26,21 @@ en:
|
|
23
26
|
moderation:
|
24
27
|
approve_btn: Approve
|
25
28
|
block_btn: Block
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
pending:
|
30
|
+
empty:
|
31
|
+
content: All posts have been moderated.
|
32
|
+
title: Good job!
|
29
33
|
post_approved_html: Post approved by %{moderator} %{time_ago}.
|
30
34
|
post_blocked_html: Post blocked by %{moderator} %{time_ago}.
|
31
35
|
post_deleted_notice: This post has been deleted.
|
32
36
|
posts_content_changed_since_moderation_html: >-
|
33
37
|
The <a href="%{post_url}">post's</a> content change since it was moderated. Below is the content at the
|
34
38
|
time it was moderated.
|
39
|
+
search_users:
|
40
|
+
form_label: Search users
|
41
|
+
form_placeholder: :thredded.moderation.search_users.form_label
|
42
|
+
results_message: Users with names starting with %{query}
|
43
|
+
no_results_message: No users with name starting with %{query}
|
35
44
|
nav:
|
36
45
|
all_messageboards: All Messageboards
|
37
46
|
edit_messageboard: Edit Messageboard
|
@@ -40,6 +49,8 @@ en:
|
|
40
49
|
edit_topic: Edit
|
41
50
|
moderation: Moderation
|
42
51
|
moderation_history: History
|
52
|
+
moderation_pending: Pending
|
53
|
+
moderation_users: Users
|
43
54
|
private_topics: Private Messages
|
44
55
|
settings: Notification Settings
|
45
56
|
null_user_name: Deleted user
|
@@ -126,3 +137,18 @@ en:
|
|
126
137
|
started_by_html: Started %{time_ago} by %{user}
|
127
138
|
unfollowed_notice: You are no longer following this topic
|
128
139
|
updated_notice: Topic updated
|
140
|
+
users:
|
141
|
+
last_active_html: "Last active %{time_ago}"
|
142
|
+
posted_in_topic_html: "Posted in %{topic_link}"
|
143
|
+
recent_activity: Recent activity
|
144
|
+
started_topic_html: "Started %{topic_link}"
|
145
|
+
user_posted_in_topic_html: "%{user_link} posted in %{topic_link}"
|
146
|
+
user_since_html: "User since %{time_ago}"
|
147
|
+
user_started_topic_html: "%{user_link} started %{topic_link}"
|
148
|
+
started_topics_count:
|
149
|
+
one: "Started one topic"
|
150
|
+
other: "Started %{count} topics"
|
151
|
+
posts_count:
|
152
|
+
one: "Posted once"
|
153
|
+
other: "Posted %{count} times"
|
154
|
+
|
data/config/locales/pt-BR.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
---
|
2
2
|
pt-BR:
|
3
3
|
thredded:
|
4
|
+
content_moderation_states:
|
5
|
+
content_blocked_notice: Bloqueado por um moderador
|
6
|
+
content_blocked_notice_with_record_html: Bloqueados por %{moderator} %{time_ago}
|
4
7
|
errors:
|
5
8
|
login_required: Por favor, autentique-se primeiro.
|
6
9
|
not_authorized: Você não está autorizado a acessar esta página.
|
@@ -23,15 +26,21 @@ pt-BR:
|
|
23
26
|
moderation:
|
24
27
|
approve_btn: Aprovar
|
25
28
|
block_btn: Quadra
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
pending:
|
30
|
+
empty:
|
31
|
+
content: Todas as mensagens têm sido moderadas.
|
32
|
+
title: Bom trabalho!
|
29
33
|
post_approved_html: Pós aprovado por %{moderator} %{time_ago}.
|
30
34
|
post_blocked_html: Pós bloqueado por %{moderator} %{time_ago}.
|
31
35
|
post_deleted_notice: Este post foi apagado.
|
32
36
|
posts_content_changed_since_moderation_html: >-
|
33
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
|
34
38
|
no momento em que foi moderado.
|
39
|
+
search_users:
|
40
|
+
form_label: Buscar usuários
|
41
|
+
form_placeholder: :thredded.moderation.search_users.form_label
|
42
|
+
no_results_message: Nenhum usuário com o nome começando com %{query}
|
43
|
+
results_message: Os usuários com nomes começando com %{query}
|
35
44
|
nav:
|
36
45
|
all_messageboards: Todos os Fóruns de Mensagens
|
37
46
|
edit_messageboard: Editar Fórum de Mensagem
|
@@ -40,6 +49,8 @@ pt-BR:
|
|
40
49
|
edit_topic: Editar
|
41
50
|
moderation: Moderação
|
42
51
|
moderation_history: História
|
52
|
+
moderation_pending: Pendente
|
53
|
+
moderation_users: Usuários
|
43
54
|
private_topics: Mensagens Privadas
|
44
55
|
settings: Configurações de Notificação
|
45
56
|
null_user_name: Usuário deletado
|
@@ -107,12 +118,12 @@ pt-BR:
|
|
107
118
|
delete_topic: Remover Tópico
|
108
119
|
deleted_notice: Tópico removido
|
109
120
|
edit: Editar Tópico
|
110
|
-
followed_notice:
|
121
|
+
followed_notice: Você agora está acompanhando este tópico
|
111
122
|
following:
|
112
|
-
manual:
|
113
|
-
mentioned:
|
114
|
-
posted:
|
115
|
-
following_will_receive_emails:
|
123
|
+
manual: Você está acompanhando este tópico.
|
124
|
+
mentioned: Você está acompanhando este tópico porque você foi mencionado nele.
|
125
|
+
posted: Você está acompanhando este tópico porque foi você que o publicou.
|
126
|
+
following_will_receive_emails: Você irá receber e-mail com atualizações.
|
116
127
|
form:
|
117
128
|
categories_placeholder: Categorias
|
118
129
|
content_label: :thredded.posts.form.content_label
|
@@ -125,5 +136,19 @@ pt-BR:
|
|
125
136
|
page_title: Tópicos dos Resultados da Busca
|
126
137
|
results_message: Resultados de Busca para %{query}
|
127
138
|
started_by_html: Iniciado %{time_ago} por %{user}
|
128
|
-
unfollowed_notice:
|
139
|
+
unfollowed_notice: Você não está mais acompanhando este tópico
|
129
140
|
updated_notice: Tópico atualizado
|
141
|
+
users:
|
142
|
+
last_active_html: Última %{time_ago} ativa
|
143
|
+
posted_in_topic_html: Postou em %{topic_link}
|
144
|
+
posts_count:
|
145
|
+
one: Postado uma vez
|
146
|
+
other: vezes %{count} Publicado
|
147
|
+
recent_activity: Atividade recente
|
148
|
+
started_topic_html: Começou %{topic_link}
|
149
|
+
started_topics_count:
|
150
|
+
one: Começou um tópico
|
151
|
+
other: tópicos iniciados %{count}
|
152
|
+
user_posted_in_topic_html: "%{user_link} postou em %{topic_link}"
|
153
|
+
user_since_html: Utilizador desde %{time_ago}
|
154
|
+
user_started_topic_html: "%{user_link} começou %{topic_link}"
|
data/config/routes.rb
CHANGED
@@ -30,9 +30,14 @@ Thredded::Engine.routes.draw do
|
|
30
30
|
scope path: 'admin' do
|
31
31
|
resources :messageboard_groups, only: [:new, :create]
|
32
32
|
scope controller: :moderation, path: 'moderation' do
|
33
|
-
|
33
|
+
scope constraints: page_constraint do
|
34
|
+
get '(/page-:page)', action: :pending, as: :pending_moderation
|
35
|
+
get '/history(/page-:page)', action: :history, as: :moderation_history
|
36
|
+
get '/users(/page-:page)', action: :users, as: :users_moderation
|
37
|
+
get '/users/:id(/page-:page)', action: :user, as: :user_moderation
|
38
|
+
end
|
34
39
|
post '', action: :moderate_post, as: :moderate_post
|
35
|
-
|
40
|
+
post '/user/:id', action: :moderate_user, as: :moderate_user
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
@@ -21,7 +21,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
21
21
|
end
|
22
22
|
|
23
23
|
create_table :thredded_categories do |t|
|
24
|
-
t.
|
24
|
+
t.references :messageboard, null: false
|
25
25
|
t.string :name, limit: 191, null: false
|
26
26
|
t.string :description, limit: 255
|
27
27
|
t.timestamps null: false
|
@@ -38,6 +38,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
38
38
|
t.integer :topics_count, default: 0
|
39
39
|
t.integer :posts_count, default: 0
|
40
40
|
t.boolean :closed, default: false, null: false
|
41
|
+
t.references :last_topic
|
41
42
|
t.references :messageboard_group
|
42
43
|
t.timestamps null: false
|
43
44
|
t.index [:messageboard_group_id], name: :index_thredded_messageboards_on_messageboard_group_id
|
@@ -47,7 +48,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
47
48
|
|
48
49
|
create_table :thredded_post_notifications do |t|
|
49
50
|
t.string :email, limit: 191, null: false
|
50
|
-
t.
|
51
|
+
t.references :post, null: false
|
51
52
|
t.timestamps null: false
|
52
53
|
t.string :post_type, limit: 191
|
53
54
|
t.index [:post_id, :post_type], name: :index_thredded_post_notifications_on_post
|
@@ -58,8 +59,8 @@ class CreateThredded < ActiveRecord::Migration
|
|
58
59
|
t.text :content, limit: 65_535
|
59
60
|
t.string :ip, limit: 255
|
60
61
|
t.string :source, limit: 255, default: 'web'
|
61
|
-
t.
|
62
|
-
t.
|
62
|
+
t.references :postable, null: false
|
63
|
+
t.references :messageboard, null: false
|
63
64
|
t.integer :moderation_state, null: false
|
64
65
|
t.timestamps null: false
|
65
66
|
t.index [:moderation_state, :updated_at],
|
@@ -73,16 +74,16 @@ class CreateThredded < ActiveRecord::Migration
|
|
73
74
|
DbTextSearch::FullText.add_index connection, :thredded_posts, :content, name: :thredded_posts_content_fts
|
74
75
|
|
75
76
|
create_table :thredded_private_posts do |t|
|
76
|
-
t.
|
77
|
+
t.references :user
|
77
78
|
t.text :content, limit: 65_535
|
79
|
+
t.references :postable, null: false
|
78
80
|
t.string :ip, limit: 255
|
79
|
-
t.integer :postable_id, null: false
|
80
81
|
t.timestamps null: false
|
81
82
|
end
|
82
83
|
|
83
84
|
create_table :thredded_private_topics do |t|
|
84
|
-
t.
|
85
|
-
t.
|
85
|
+
t.references :user
|
86
|
+
t.references :last_user
|
86
87
|
t.string :title, limit: 255, null: false
|
87
88
|
t.string :slug, limit: 191, null: false
|
88
89
|
t.integer :posts_count, default: 0
|
@@ -93,26 +94,26 @@ class CreateThredded < ActiveRecord::Migration
|
|
93
94
|
end
|
94
95
|
|
95
96
|
create_table :thredded_private_users do |t|
|
96
|
-
t.
|
97
|
-
t.
|
97
|
+
t.references :private_topic, limit: 4
|
98
|
+
t.references :user, limit: 4
|
98
99
|
t.timestamps null: false
|
99
100
|
t.index [:private_topic_id], name: :index_thredded_private_users_on_private_topic_id
|
100
101
|
t.index [:user_id], name: :index_thredded_private_users_on_user_id
|
101
102
|
end
|
102
103
|
|
103
104
|
create_table :thredded_topic_categories do |t|
|
104
|
-
t.
|
105
|
-
t.
|
105
|
+
t.references :topic, null: false
|
106
|
+
t.references :category, null: false
|
106
107
|
t.index [:category_id], name: :index_thredded_topic_categories_on_category_id
|
107
108
|
t.index [:topic_id], name: :index_thredded_topic_categories_on_topic_id
|
108
109
|
end
|
109
110
|
|
110
111
|
create_table :thredded_topics do |t|
|
111
|
-
t.
|
112
|
-
t.
|
112
|
+
t.references :user
|
113
|
+
t.references :last_user
|
113
114
|
t.string :title, limit: 255, null: false
|
114
115
|
t.string :slug, limit: 191, null: false
|
115
|
-
t.
|
116
|
+
t.references :messageboard, null: false
|
116
117
|
t.integer :posts_count, default: 0, null: false
|
117
118
|
t.boolean :sticky, default: false, null: false
|
118
119
|
t.boolean :locked, default: false, null: false
|
@@ -131,7 +132,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
131
132
|
DbTextSearch::FullText.add_index connection, :thredded_topics, :title, name: :thredded_topics_title_fts
|
132
133
|
|
133
134
|
create_table :thredded_user_details do |t|
|
134
|
-
t.
|
135
|
+
t.references :user, null: false
|
135
136
|
t.datetime :latest_activity_at
|
136
137
|
t.integer :posts_count, default: 0
|
137
138
|
t.integer :topics_count, default: 0
|
@@ -157,7 +158,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
157
158
|
end
|
158
159
|
|
159
160
|
create_table :thredded_user_preferences do |t|
|
160
|
-
t.
|
161
|
+
t.references :user, null: false
|
161
162
|
t.boolean :notify_on_mention, default: true, null: false
|
162
163
|
t.boolean :notify_on_message, default: true, null: false
|
163
164
|
t.timestamps null: false
|
@@ -165,8 +166,8 @@ class CreateThredded < ActiveRecord::Migration
|
|
165
166
|
end
|
166
167
|
|
167
168
|
create_table :thredded_user_messageboard_preferences do |t|
|
168
|
-
t.
|
169
|
-
t.
|
169
|
+
t.references :user, null: false
|
170
|
+
t.references :messageboard, null: false
|
170
171
|
t.boolean :notify_on_mention, default: true, null: false
|
171
172
|
t.timestamps null: false
|
172
173
|
t.index [:user_id, :messageboard_id],
|
@@ -177,7 +178,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
177
178
|
%i(topic private_topic).each do |topics_table|
|
178
179
|
table_name = :"thredded_user_#{topics_table}_read_states"
|
179
180
|
create_table table_name do |t|
|
180
|
-
t.
|
181
|
+
t.references :user, null: false
|
181
182
|
t.integer :postable_id, null: false
|
182
183
|
t.integer :page, default: 1, null: false
|
183
184
|
t.timestamp :read_at, null: false
|
@@ -191,7 +192,7 @@ class CreateThredded < ActiveRecord::Migration
|
|
191
192
|
end
|
192
193
|
|
193
194
|
create_table :thredded_user_topic_follows do |t|
|
194
|
-
t.
|
195
|
+
t.references :user, null: false
|
195
196
|
t.integer :topic_id, null: false
|
196
197
|
t.datetime :created_at, null: false
|
197
198
|
t.integer :reason, limit: 1
|