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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b89649352c4f5481a4e2ad05a885e21a2bb9a5d0
|
4
|
+
data.tar.gz: 4b7bf4007f49a57fbf4a00b176750cb700a8a801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e4a2b77cd7495e279b80e910c20a28f236e1103974410ec3572cb0b99c482ec662f3eb5951f4f7cda7b4e88f5a8f6cdf4c430c363bcd63cc78384a58a5fae1
|
7
|
+
data.tar.gz: d36788984d19723bb7607042e2675d3da6a9103b76d2e550a8797e557e53ac4493fc2f6aee8d6496920e0dc24cbbffcd3b6bd9e96357ec3d07eb0dfb0fdc9fb7
|
data/CHANGELOG.mkdn
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# 0.6.0 - 2016-06-12
|
2
|
+
|
3
|
+
**NB:** If updating to this version from 0.5.x, you will need to copy and run [this migration](https://github.com/thredded/thredded/blob/66f64068b9501ff4e8686c95894b6795aae6082f/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb).
|
4
|
+
|
5
|
+
## Added
|
6
|
+
|
7
|
+
* Adds a Users tab to moderation, where individual users can be moderated.
|
8
|
+
* Improves the display of posts in the moderation, showing the topic and
|
9
|
+
whether the post started the topic.
|
10
|
+
* Thredded now provides a way to render a user's recent posts in the main_app.
|
11
|
+
|
12
|
+
## Changed
|
13
|
+
|
14
|
+
* Moderators are now shown all content, including blocked content. A notice is shown on blocked content.
|
15
|
+
|
16
|
+
## Fixed
|
17
|
+
|
18
|
+
* Fixed a bug that prevented user deletion in main_app if they had posted on the forums.
|
19
|
+
|
20
|
+
See the full list of changes here: https://github.com/thredded/thredded/compare/v0.5.1...v0.6.0.
|
21
|
+
|
1
22
|
# 0.5.1
|
2
23
|
|
3
24
|
This is a minor bugfix release.
|
data/README.mkdn
CHANGED
@@ -44,7 +44,7 @@ application and not an engine like Thredded.
|
|
44
44
|
Add the gem to your Gemfile:
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
gem 'thredded', '~> 0.
|
47
|
+
gem 'thredded', '~> 0.6.0'
|
48
48
|
```
|
49
49
|
|
50
50
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
@@ -148,6 +148,22 @@ Include thredded JavaScripts in your `application.js`:
|
|
148
148
|
Thredded views also provide two `content_tag`s available to yield - `:thredded_page_title` and `:thredded_page_id`.
|
149
149
|
The views within Thredded pass those up through to your layout if you would like to use them.
|
150
150
|
|
151
|
+
### User profile page
|
152
|
+
|
153
|
+
Thredded does not provide a user's profile page, but it provides a helper for rendering the user's recent posts
|
154
|
+
in your app's user profile page.
|
155
|
+
|
156
|
+
To use it:
|
157
|
+
1. Include `Thredded::ApplicationHelper` in the app's helpers module.
|
158
|
+
2. Render the partial like this:
|
159
|
+
|
160
|
+
```erb
|
161
|
+
<%= render 'thredded/users/_posts',
|
162
|
+
posts: Thredded.posts_page_view(
|
163
|
+
scope: user.thredded_posts.order_newest_first.limit(5),
|
164
|
+
current_user: current_user) %>
|
165
|
+
```
|
166
|
+
|
151
167
|
### Customizing views
|
152
168
|
|
153
169
|
You can also override any views and assets by placing them in the same path in your application as they are in the gem.
|
@@ -19,3 +19,54 @@
|
|
19
19
|
%thredded--nav-link-current {
|
20
20
|
color: $thredded-nav-current-color;
|
21
21
|
}
|
22
|
+
|
23
|
+
|
24
|
+
%thredded--nav-tabs {
|
25
|
+
@extend %thredded--list-unstyled;
|
26
|
+
@include thredded--clearfix;
|
27
|
+
border-bottom: $thredded-base-border;
|
28
|
+
font-size: $thredded-font-size-small;
|
29
|
+
margin-left: 0;
|
30
|
+
margin-bottom: 1rem;
|
31
|
+
text-align: left;
|
32
|
+
list-style-type: none;
|
33
|
+
|
34
|
+
@include thredded-media-tablet-and-up {
|
35
|
+
margin-bottom: 0;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
%thredded--nav-tabs--item {
|
40
|
+
display: inline-block;
|
41
|
+
margin-right: 1rem;
|
42
|
+
|
43
|
+
a {
|
44
|
+
@extend %thredded--nav-link;
|
45
|
+
display: inline-block;
|
46
|
+
color: $thredded-secondary-nav-color;
|
47
|
+
padding: $thredded-small-spacing 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
&:last-child {
|
51
|
+
margin-right: 0;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
%thredded--nav-tabs--item-current {
|
56
|
+
border-bottom: 1px solid $thredded-action-color;
|
57
|
+
margin-bottom: -1px;
|
58
|
+
|
59
|
+
a {
|
60
|
+
@extend %thredded--nav-link-current;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
%thredded--nav-tabs--item--badge {
|
65
|
+
background: $thredded-badge-active-background;
|
66
|
+
border-radius: 10px;
|
67
|
+
color: $thredded-badge-active-color;
|
68
|
+
font-size: 0.75rem; // 12px
|
69
|
+
line-height: 1;
|
70
|
+
margin-left: 0.4rem;
|
71
|
+
padding: 2px 6px;
|
72
|
+
}
|
@@ -14,6 +14,7 @@ $thredded-heading-line-height: 1.2 !default;
|
|
14
14
|
$thredded-large-spacing: $thredded-base-line-height * 2rem !default;
|
15
15
|
$thredded-base-spacing: $thredded-base-line-height * 1rem !default;
|
16
16
|
$thredded-small-spacing: $thredded-base-spacing / 2 !default;
|
17
|
+
$thredded-inline-spacing: 0.4375em !default;
|
17
18
|
|
18
19
|
// Named colors
|
19
20
|
$thredded-brand: #4a90e2 !default;
|
@@ -10,13 +10,13 @@
|
|
10
10
|
border-radius: 50%;
|
11
11
|
display: inline-block;
|
12
12
|
height: 1.75rem; // 28px
|
13
|
-
margin-right: $thredded-
|
13
|
+
margin-right: $thredded-inline-spacing;
|
14
14
|
position: relative;
|
15
15
|
top: 6px;
|
16
16
|
vertical-align: baseline;
|
17
17
|
width: 1.75rem; // 28px
|
18
18
|
|
19
|
-
@
|
19
|
+
@include thredded-media-avatar-breakout {
|
20
20
|
height: 2.25rem; // 36px
|
21
21
|
left: -3rem;
|
22
22
|
position: absolute;
|
@@ -25,16 +25,29 @@
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
&--post--
|
28
|
+
&--post--topic {
|
29
29
|
@extend %thredded--heading;
|
30
|
-
|
30
|
+
font-size: $thredded-base-font-size * 1.25; // 24px
|
31
|
+
line-height: 1.2;
|
32
|
+
margin-bottom: $thredded-small-spacing / 2;
|
33
|
+
}
|
34
|
+
|
35
|
+
&--post--user,
|
36
|
+
&--post--topic,
|
37
|
+
&--post--user-and-topic {
|
38
|
+
@extend %thredded--heading;
|
39
|
+
display: inline;
|
31
40
|
font-size: 1.125rem; // 18px
|
32
41
|
line-height: 1.2;
|
33
|
-
margin-right: $thredded-
|
34
|
-
margin-bottom: 1.25rem; // 20px
|
42
|
+
margin-right: $thredded-inline-spacing;
|
35
43
|
|
36
44
|
a {
|
37
45
|
@extend %thredded--link;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
&--post--user {
|
50
|
+
a {
|
38
51
|
color: $thredded-text-color;
|
39
52
|
}
|
40
53
|
}
|
@@ -1,12 +1,22 @@
|
|
1
|
-
&--
|
2
|
-
|
1
|
+
&--moderation-navigation {
|
2
|
+
position: relative;
|
3
|
+
&--items {
|
4
|
+
@extend %thredded--nav-tabs;
|
5
|
+
}
|
6
|
+
&--item {
|
7
|
+
@extend %thredded--nav-tabs--item;
|
8
|
+
}
|
3
9
|
}
|
4
10
|
|
5
|
-
&--moderation--
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
.thredded--pending-moderation &--moderation-navigation--pending,
|
12
|
+
.thredded--moderation-history &--moderation-navigation--history,
|
13
|
+
.thredded--moderation-users &--moderation-navigation--users,
|
14
|
+
.thredded--moderation-user &--moderation-navigation--users{
|
15
|
+
@extend %thredded--nav-tabs--item-current;
|
16
|
+
}
|
17
|
+
|
18
|
+
&--post-moderation-actions {
|
19
|
+
@extend %thredded--buttons-list;
|
10
20
|
}
|
11
21
|
|
12
22
|
&--moderated-notice {
|
@@ -15,10 +25,19 @@
|
|
15
25
|
background: $thredded-light-gray;
|
16
26
|
}
|
17
27
|
|
28
|
+
&--post-moderation, &--post-moderation-record {
|
29
|
+
.thredded--post--user a {
|
30
|
+
color: $thredded-action-color;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
18
34
|
&--post-moderation-record {
|
19
35
|
.thredded--post {
|
20
36
|
margin-bottom: 0;
|
21
|
-
margin-left:
|
37
|
+
margin-left: 1rem;
|
38
|
+
@include thredded-media-avatar-breakout {
|
39
|
+
margin-left: 4rem;
|
40
|
+
}
|
22
41
|
}
|
23
42
|
&--moderation-state-notice {
|
24
43
|
margin-bottom: 1rem;
|
@@ -43,3 +62,29 @@
|
|
43
62
|
&--post-moderation-record + &--post-moderation-record {
|
44
63
|
margin-top: $thredded-large-spacing;
|
45
64
|
}
|
65
|
+
|
66
|
+
&--moderation--users-table {
|
67
|
+
width: 100%;
|
68
|
+
a {
|
69
|
+
display: block;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
&--moderation--user--title {
|
74
|
+
margin: 0;
|
75
|
+
}
|
76
|
+
|
77
|
+
&--moderation--user--info {
|
78
|
+
margin-left: 2rem;
|
79
|
+
}
|
80
|
+
|
81
|
+
&--user--moderation-actions {
|
82
|
+
text-align: left;
|
83
|
+
margin-left: 4rem;
|
84
|
+
.button_to {
|
85
|
+
display: inline-block;
|
86
|
+
}
|
87
|
+
.button_to + .button_to {
|
88
|
+
margin-left: $thredded-small-spacing;
|
89
|
+
}
|
90
|
+
}
|
@@ -1,40 +1,9 @@
|
|
1
1
|
&--user-navigation {
|
2
|
-
@extend %thredded--
|
3
|
-
@include thredded--clearfix;
|
4
|
-
border-bottom: $thredded-base-border;
|
5
|
-
margin-bottom: 1rem;
|
6
|
-
text-align: left;
|
7
|
-
|
8
|
-
@include thredded-media-tablet-and-up {
|
9
|
-
font-size: $thredded-font-size-small;
|
10
|
-
margin-bottom: 0;
|
11
|
-
}
|
12
|
-
|
13
|
-
a {
|
14
|
-
@extend %thredded--nav-link;
|
15
|
-
color: $thredded-secondary-nav-color;
|
16
|
-
}
|
17
|
-
|
18
|
-
> ul {
|
19
|
-
@extend %thredded--list-unstyled;
|
20
|
-
}
|
2
|
+
@extend %thredded--nav-tabs;
|
21
3
|
}
|
22
4
|
|
23
5
|
&--user-navigation--item {
|
24
|
-
|
25
|
-
margin-right: 1rem;
|
26
|
-
|
27
|
-
a {
|
28
|
-
padding: $thredded-small-spacing 0;
|
29
|
-
}
|
30
|
-
|
31
|
-
&:last-child {
|
32
|
-
margin-right: 0;
|
33
|
-
}
|
34
|
-
|
35
|
-
@include thredded-media-tablet-and-up {
|
36
|
-
padding: $thredded-small-spacing 0;
|
37
|
-
}
|
6
|
+
@extend %thredded--nav-tabs--item;
|
38
7
|
}
|
39
8
|
|
40
9
|
.thredded--preferences &--user-navigation--settings,
|
@@ -42,22 +11,13 @@
|
|
42
11
|
.thredded--private-topics-index &--user-navigation--private-topics,
|
43
12
|
.thredded--private-topic-show &--user-navigation--private-topics,
|
44
13
|
.thredded--pending-moderation &--user-navigation--moderation,
|
45
|
-
.thredded--moderation-history &--user-navigation--moderation
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
a {
|
50
|
-
@extend %thredded--nav-link-current;
|
51
|
-
}
|
14
|
+
.thredded--moderation-history &--user-navigation--moderation,
|
15
|
+
.thredded--moderation-users &--user-navigation--moderation,
|
16
|
+
.thredded--moderation-user &--user-navigation--moderation {
|
17
|
+
@extend %thredded--nav-tabs--item-current;
|
52
18
|
}
|
53
19
|
|
54
20
|
&--user-navigation--private-topics--unread,
|
55
21
|
&--user-navigation--moderation--pending-count {
|
56
|
-
|
57
|
-
border-radius: 10px;
|
58
|
-
color: $thredded-badge-active-color;
|
59
|
-
font-size: 0.75rem; // 12px
|
60
|
-
line-height: 1;
|
61
|
-
margin-left: 0.4rem;
|
62
|
-
padding: 2px 6px;
|
22
|
+
@extend %thredded--nav-tabs--item--badge;
|
63
23
|
}
|
@@ -15,7 +15,7 @@ module Thredded
|
|
15
15
|
previous_moderation_state: post.moderation_state,
|
16
16
|
moderation_state: moderation_state,
|
17
17
|
)
|
18
|
-
if post.user_detail.pending_moderation?
|
18
|
+
if post.user_id && post.user_detail.pending_moderation?
|
19
19
|
post.user_detail.update!(moderation_state: moderation_state)
|
20
20
|
end
|
21
21
|
if post.postable.first_post == post
|
@@ -8,7 +8,7 @@ module Thredded
|
|
8
8
|
|
9
9
|
def index
|
10
10
|
@groups = policy_scope(Messageboard.all)
|
11
|
-
.preload(:group).group_by(&:group)
|
11
|
+
.preload(:group, last_topic: [:last_user]).group_by(&:group)
|
12
12
|
.map { |(group, messageboards)| MessageboardGroupView.new(group, messageboards) }
|
13
13
|
end
|
14
14
|
|
@@ -12,17 +12,18 @@ module Thredded
|
|
12
12
|
moderatable_posts
|
13
13
|
.pending_moderation
|
14
14
|
.order_oldest_first
|
15
|
-
.
|
15
|
+
.preload(:user, :postable)
|
16
|
+
.page(current_page)
|
16
17
|
)
|
17
18
|
if flash[:last_moderated_record_id]
|
18
|
-
@last_moderated_record =
|
19
|
+
@last_moderated_record = accessible_post_moderation_records.find(flash[:last_moderated_record_id].to_i)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
def history
|
23
|
-
@post_moderation_records =
|
24
|
+
@post_moderation_records = accessible_post_moderation_records
|
24
25
|
.order(created_at: :desc)
|
25
|
-
.page(
|
26
|
+
.page(current_page)
|
26
27
|
end
|
27
28
|
|
28
29
|
def moderate_post
|
@@ -35,13 +36,42 @@ module Thredded
|
|
35
36
|
redirect_back fallback_location: pending_moderation_path
|
36
37
|
end
|
37
38
|
|
39
|
+
def users
|
40
|
+
@users = Thredded.user_class
|
41
|
+
.left_join_thredded_user_details
|
42
|
+
.merge(Thredded::UserDetail.order(moderation_state_changed_at: :desc))
|
43
|
+
@query = params[:q].to_s
|
44
|
+
if @query.present?
|
45
|
+
@users = DbTextSearch::CaseInsensitive.new(@users, Thredded.user_name_column).prefix(@query)
|
46
|
+
end
|
47
|
+
@users = @users.page(current_page)
|
48
|
+
end
|
49
|
+
|
50
|
+
def user
|
51
|
+
@user = Thredded.user_class.find(params[:id])
|
52
|
+
# Do not apply policy_scope here, as we want to show blocked posts as well.
|
53
|
+
posts_scope = @user.thredded_posts
|
54
|
+
.where(messageboard_id: policy_scope(Messageboard.all).pluck(:id))
|
55
|
+
.order_newest_first
|
56
|
+
.includes(:postable)
|
57
|
+
.page(current_page)
|
58
|
+
@posts = PostsPageView.new(current_user, posts_scope)
|
59
|
+
end
|
60
|
+
|
61
|
+
def moderate_user
|
62
|
+
return head(:bad_request) unless Thredded::UserDetail.moderation_states.include?(params[:moderation_state])
|
63
|
+
user = Thredded.user_class.find(params[:id])
|
64
|
+
user.thredded_user_detail.update!(moderation_state: params[:moderation_state])
|
65
|
+
redirect_back fallback_location: user_moderation_path(user.id)
|
66
|
+
end
|
67
|
+
|
38
68
|
private
|
39
69
|
|
40
70
|
def moderatable_posts
|
41
71
|
Thredded::Post.where(messageboard_id: @moderatable_messageboards)
|
42
72
|
end
|
43
73
|
|
44
|
-
def
|
74
|
+
def accessible_post_moderation_records
|
45
75
|
Thredded::PostModerationRecord
|
46
76
|
.where(messageboard_id: @moderatable_messageboards)
|
47
77
|
end
|
@@ -52,5 +82,9 @@ module Thredded
|
|
52
82
|
fail Pundit::NotAuthorizedError, 'You are not authorized to perform this action.'
|
53
83
|
end
|
54
84
|
end
|
85
|
+
|
86
|
+
def current_page
|
87
|
+
(params[:page] || 1).to_i
|
88
|
+
end
|
55
89
|
end
|
56
90
|
end
|