thredded 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60b13044b8367c62cbb93c5b2e0850cf50f4b82c
4
- data.tar.gz: 3b812b35dd815b992506a58f2ae56830404007df
3
+ metadata.gz: 63f6eebe937c5b969d191a5650bb160b07b5976a
4
+ data.tar.gz: 73b1e243259935e0f8e80a653ffe4c922e581e28
5
5
  SHA512:
6
- metadata.gz: 1f1e4ad80c877af569f022c34594cd20fbb1051257810f4a1ff9ad5b4e821d4260a511c1cbc279b0af3c605bf5523c4a7f8b204efe986bfbbd907aa38a92f88d
7
- data.tar.gz: a0949c2867031642dfaf58ed480883e4ed9fec0844b194bc3d01ffdb5ae27434aa3ca5b46c3adc18fa1111bb6e9d5349e4fcf8ed50d7e429781769279e7a89e3
6
+ metadata.gz: f38401e4c39f48e55dd2def77978ab913d662a13012de3e013fd0f67d4fd62bf7df03bc259cb5e933442ca6234aed36537e2a45ddfa04e3a03b97dc4d2793825
7
+ data.tar.gz: 718c48c5501ecb3712ae25c7113bdcf457de3eb6cc1a72fce282a825c9dd5644a548ecd5d1da3667cec8b41c5cb1219a2b1aa791cf83566c960a758620517198
@@ -4,14 +4,14 @@ module Thredded
4
4
  if cannot? :read, messageboard
5
5
  error = 'You are not authorized access to this messageboard.'
6
6
  redirect_to default_home, flash: { error: error }
7
- else
8
- @private_topics = private_topics
9
7
  end
8
+
9
+ @private_topics = private_topics
10
10
  end
11
11
 
12
12
  def new
13
13
  @private_topic = messageboard.private_topics.build
14
- @private_topic.posts.build(filter: current_user.try(:post_filter))
14
+ @private_topic.posts.build
15
15
 
16
16
  unless can? :create, @private_topic
17
17
  error = 'Sorry, you are not authorized to post on this messageboard.'
@@ -21,9 +21,8 @@ module Thredded
21
21
  end
22
22
 
23
23
  def create
24
- params[:topic][:user_id] << current_user.id
25
- merge_default_topics_params
26
- @private_topic = PrivateTopic.create(params[:topic])
24
+ @private_topic = messageboard.private_topics.create(private_topics_params)
25
+
27
26
  redirect_to messageboard_topics_url(messageboard)
28
27
  end
29
28
 
@@ -35,5 +34,25 @@ module Thredded
35
34
  .order_by_stuck_and_updated_time
36
35
  .on_page(params[:page])
37
36
  end
37
+
38
+ private
39
+
40
+ def private_topics_params
41
+ params[:topic][:user_id] << current_user.id
42
+
43
+ params
44
+ .require(:topic)
45
+ .permit!
46
+ .deep_merge!({
47
+ user: current_user,
48
+ last_user: current_user,
49
+ posts_attributes: {
50
+ '0' => {
51
+ messageboard: messageboard,
52
+ user: current_user,
53
+ }
54
+ }
55
+ })
56
+ end
38
57
  end
39
58
  end
@@ -24,9 +24,7 @@ module Thredded
24
24
 
25
25
  def new
26
26
  @topic = messageboard.topics.build
27
- @topic
28
- .posts
29
- .build
27
+ @topic.posts.build
30
28
 
31
29
  unless can? :create, @topic
32
30
  error = 'Sorry, you are not authorized to post on this messageboard.'
@@ -11,6 +11,7 @@
11
11
 
12
12
  <div class="topics forms">
13
13
  <%= nested_form_for([messageboard, @private_topic],
14
+ url: messageboard_private_topics_path(messageboard, @private_topic),
14
15
  html: { multipart: true, class: :topic_form }) do |form| %>
15
16
 
16
17
  <ul>
@@ -1,3 +1,3 @@
1
1
  module Thredded
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
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.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Oliveira