thredded 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +23 -1
- data/app/assets/javascripts/thredded/components/user_textcomplete.es6 +6 -3
- data/app/assets/stylesheets/thredded/components/_mention-autocomplete.scss +9 -0
- data/app/controllers/thredded/autocomplete_users_controller.rb +12 -5
- data/app/models/thredded/messageboard.rb +1 -1
- data/app/view_models/thredded/messageboard_group_view.rb +2 -1
- data/db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb +4 -2
- data/lib/thredded/db_tools.rb +20 -0
- data/lib/thredded/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7479689d3c4544cbb07114f0b5d0913b9e95d129a698843547268931af3248ba
|
4
|
+
data.tar.gz: 4f89703ac0b690feb520ab9b2eb757e09bd4e0bd1e81733ce937e2edbde7b29a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeed2175ca8e77c44b53f7c35538e8282981212a0d889343c071ab481599cd3c17082daf07a27ae29697c46d54203649bac2e77e79e973bc63106fe08fe268d2
|
7
|
+
data.tar.gz: 40fa290e20a92388903b6e557a7a45b8fd1e7c862684a5ba253613820727646f3be39080bbb9c4f05616b511ab064c6af8d42a7a7debfadd7858eab568285d0f
|
data/README.md
CHANGED
@@ -98,7 +98,7 @@ Then, see the rest of this Readme for more information about using and customizi
|
|
98
98
|
Add the gem to your Gemfile:
|
99
99
|
|
100
100
|
```ruby
|
101
|
-
gem 'thredded', '~> 0.14.
|
101
|
+
gem 'thredded', '~> 0.14.2'
|
102
102
|
```
|
103
103
|
|
104
104
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
@@ -558,6 +558,28 @@ To disable moderation, e.g. if you run internal forums that do not need moderati
|
|
558
558
|
change_column_default :thredded_user_details, :moderation_state, 1 # approved
|
559
559
|
```
|
560
560
|
|
561
|
+
### Requiring authentication to access Thredded
|
562
|
+
|
563
|
+
To require users to be authenticated to access any part of Thredded, add the following to your initializer:
|
564
|
+
|
565
|
+
```ruby
|
566
|
+
# config/initializers/thredded.rb
|
567
|
+
Rails.application.config.to_prepare do
|
568
|
+
Thredded::ApplicationController.module_eval do
|
569
|
+
# Require authentication to access the forums:
|
570
|
+
before_action :thredded_require_login!
|
571
|
+
|
572
|
+
# You may also want to render a login form after the
|
573
|
+
# "Please sign in first" message:
|
574
|
+
rescue_from Thredded::Errors::LoginRequired do |exception|
|
575
|
+
# Place the code for rendering the login form here, for example:
|
576
|
+
@message = exception.message
|
577
|
+
render template: 'sessions/new', status: :forbidden
|
578
|
+
end
|
579
|
+
end
|
580
|
+
end
|
581
|
+
```
|
582
|
+
|
561
583
|
## Plugins
|
562
584
|
|
563
585
|
The following official plugins are available for Thredded:
|
@@ -7,10 +7,13 @@
|
|
7
7
|
Thredded.UserTextcomplete = {
|
8
8
|
DROPDOWN_CLASS_NAME: 'thredded--textcomplete-dropdown',
|
9
9
|
|
10
|
-
formatUser({avatar_url, name}) {
|
10
|
+
formatUser({avatar_url, name, display_name}) {
|
11
11
|
return "<div class='thredded--textcomplete-user-result'>" +
|
12
12
|
`<img class='thredded--textcomplete-user-result__avatar' src='${Thredded.escapeHtml(avatar_url)}' >` +
|
13
13
|
`<span class='thredded--textcomplete-user-result__name'>${Thredded.escapeHtml(name)}</span>` +
|
14
|
+
(name !== display_name && display_name ?
|
15
|
+
`<span class='thredded--textcomplete-user-result__display_name'>${Thredded.escapeHtml(display_name)}</span>` :
|
16
|
+
'') +
|
14
17
|
'</div>';
|
15
18
|
},
|
16
19
|
|
@@ -29,8 +32,8 @@
|
|
29
32
|
callback([]);
|
30
33
|
return;
|
31
34
|
}
|
32
|
-
callback(JSON.parse(request.responseText).results.map(({avatar_url, id, name}) => {
|
33
|
-
return {avatar_url, id, name, match};
|
35
|
+
callback(JSON.parse(request.responseText).results.map(({avatar_url, id, display_name, name}) => {
|
36
|
+
return {avatar_url, id, name, display_name, match};
|
34
37
|
}));
|
35
38
|
};
|
36
39
|
request.send();
|
@@ -45,4 +45,13 @@ ul.thredded--textcomplete-dropdown {
|
|
45
45
|
display: inline-block;
|
46
46
|
margin-left: 0.6rem
|
47
47
|
}
|
48
|
+
&__display_name {
|
49
|
+
display: inline-block;
|
50
|
+
margin-left: 0.4rem;
|
51
|
+
|
52
|
+
color: $thredded-secondary-text-color;
|
53
|
+
.textcomplete-item.active & {
|
54
|
+
color: invert($thredded-secondary-text-color);
|
55
|
+
}
|
56
|
+
}
|
48
57
|
}
|
@@ -8,11 +8,18 @@ module Thredded
|
|
8
8
|
authorize_creating Thredded::PrivateTopicForm.new(user: thredded_current_user).private_topic
|
9
9
|
users = params.key?(:q) ? users_by_prefix : users_by_ids
|
10
10
|
render json: {
|
11
|
-
results: users.map
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
results: users.map { |user| user_to_autocomplete_result(user) }
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def user_to_autocomplete_result(user)
|
18
|
+
{
|
19
|
+
id: user.id,
|
20
|
+
name: user.send(Thredded.user_name_column),
|
21
|
+
display_name: user.send(Thredded.user_display_name_method),
|
22
|
+
avatar_url: Thredded.avatar_url.call(user)
|
16
23
|
}
|
17
24
|
end
|
18
25
|
|
@@ -77,7 +77,7 @@ module Thredded
|
|
77
77
|
scope :ordered_by_created_at_asc, ->() { order(created_at: :asc) }
|
78
78
|
scope :ordered_by_last_post_at_desc, ->() {
|
79
79
|
joins('LEFT JOIN thredded_topics AS last_topics ON thredded_messageboards.last_topic_id = last_topics.id')
|
80
|
-
.order('COALESCE(last_topics.last_post_at, thredded_messageboards.created_at) DESC')
|
80
|
+
.order(Arel.sql('COALESCE(last_topics.last_post_at, thredded_messageboards.created_at) DESC'))
|
81
81
|
}
|
82
82
|
scope :ordered_by_topics_count_desc, ->() {
|
83
83
|
order(topics_count: :desc)
|
@@ -11,7 +11,8 @@ module Thredded
|
|
11
11
|
def self.grouped(messageboard_scope)
|
12
12
|
messageboard_scope.preload(last_topic: [:last_user])
|
13
13
|
.eager_load(:group)
|
14
|
-
.order('
|
14
|
+
.order(Arel.sql('COALESCE(thredded_messageboard_groups.position, 0) ASC, thredded_messageboard_groups.id ASC'))
|
15
|
+
.ordered
|
15
16
|
.group_by(&:group)
|
16
17
|
.map { |(group, messageboards)| MessageboardGroupView.new(group, messageboards) }
|
17
18
|
end
|
@@ -5,9 +5,11 @@ require 'thredded/base_migration'
|
|
5
5
|
class UpgradeV09ToV010 < Thredded::BaseMigration
|
6
6
|
def up
|
7
7
|
remove_foreign_key :thredded_messageboard_users, :thredded_messageboards
|
8
|
-
add_foreign_key :thredded_messageboard_users, :thredded_messageboards,
|
8
|
+
add_foreign_key :thredded_messageboard_users, :thredded_messageboards,
|
9
|
+
column: :thredded_messageboard_id, on_delete: :cascade
|
9
10
|
remove_foreign_key :thredded_messageboard_users, :thredded_user_details
|
10
|
-
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
|
11
|
+
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
|
12
|
+
column: :thredded_user_detail_id, on_delete: :cascade
|
11
13
|
|
12
14
|
create_table :thredded_user_post_notifications do |t|
|
13
15
|
t.references :user, null: false, index: false, type: user_id_type
|
data/lib/thredded/db_tools.rb
CHANGED
@@ -5,6 +5,26 @@ module Thredded
|
|
5
5
|
class << self
|
6
6
|
MIGRATION_SPEC_SOURCE_VERSION = 'v0.8'
|
7
7
|
|
8
|
+
# Runs the migrations in the given paths.
|
9
|
+
def migrate(paths:, quiet:, &filter)
|
10
|
+
verbose_was = ActiveRecord::Migration.verbose
|
11
|
+
ActiveRecord::Migration.verbose = !quiet
|
12
|
+
migrate = lambda do
|
13
|
+
if Rails::VERSION::STRING >= '5.2'
|
14
|
+
ActiveRecord::MigrationContext.new(paths).migrate(nil, &filter)
|
15
|
+
else
|
16
|
+
ActiveRecord::Migrator.migrate(paths, &filter)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
if quiet
|
20
|
+
silence_active_record(&migrate)
|
21
|
+
else
|
22
|
+
migrate.call
|
23
|
+
end
|
24
|
+
ensure
|
25
|
+
ActiveRecord::Migration.verbose = verbose_was
|
26
|
+
end
|
27
|
+
|
8
28
|
def dump_file
|
9
29
|
File.expand_path("../../../spec/migration/#{MIGRATION_SPEC_SOURCE_VERSION}.#{adapter}.dump", __FILE__)
|
10
30
|
end
|
data/lib/thredded/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thredded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Oliveira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pundit
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.3.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: 1.3.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: db_text_search
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -497,16 +497,16 @@ dependencies:
|
|
497
497
|
name: pg
|
498
498
|
requirement: !ruby/object:Gem::Requirement
|
499
499
|
requirements:
|
500
|
-
- - "
|
500
|
+
- - ">="
|
501
501
|
- !ruby/object:Gem::Version
|
502
|
-
version: '0
|
502
|
+
version: '0'
|
503
503
|
type: :development
|
504
504
|
prerelease: false
|
505
505
|
version_requirements: !ruby/object:Gem::Requirement
|
506
506
|
requirements:
|
507
|
-
- - "
|
507
|
+
- - ">="
|
508
508
|
- !ruby/object:Gem::Version
|
509
|
-
version: '0
|
509
|
+
version: '0'
|
510
510
|
- !ruby/object:Gem::Dependency
|
511
511
|
name: sqlite3
|
512
512
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1040,7 +1040,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1040
1040
|
version: '0'
|
1041
1041
|
requirements: []
|
1042
1042
|
rubyforge_project:
|
1043
|
-
rubygems_version: 2.
|
1043
|
+
rubygems_version: 2.7.3
|
1044
1044
|
signing_key:
|
1045
1045
|
specification_version: 4
|
1046
1046
|
summary: The best Rails forums engine ever.
|