commontator 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -5
  3. data/app/controllers/commontator/comments_controller.rb +6 -6
  4. data/app/controllers/commontator/subscriptions_controller.rb +2 -2
  5. data/app/controllers/commontator/threads_controller.rb +2 -2
  6. data/app/views/commontator/comments/_actions.html.erb +1 -1
  7. data/app/views/commontator/comments/_votes.html.erb +4 -4
  8. data/app/views/commontator/shared/_thread.html.erb +1 -1
  9. data/app/views/commontator/subscriptions/_link.html.erb +1 -1
  10. data/app/views/commontator/threads/_show.html.erb +1 -1
  11. data/config/routes.rb +9 -9
  12. data/lib/commontator/version.rb +1 -1
  13. data/spec/app/controllers/commontator/comments_controller_spec.rb +40 -40
  14. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +12 -12
  15. data/spec/app/controllers/commontator/threads_controller_spec.rb +12 -12
  16. data/spec/dummy/db/test.sqlite3 +0 -0
  17. data/spec/dummy/log/test.log +4176 -0
  18. metadata +4 -91
  19. data/app/controllers/commontator/application_controller.rb~ +0 -27
  20. data/app/controllers/commontator/comments_controller.rb~ +0 -144
  21. data/app/controllers/commontator/subscriptions_controller.rb~ +0 -32
  22. data/app/controllers/commontator/threads_controller.rb~ +0 -42
  23. data/app/mailers/commontator/subscriptions_mailer.rb~ +0 -50
  24. data/app/models/commontator/comment.rb~ +0 -104
  25. data/app/models/commontator/subscription.rb~ +0 -18
  26. data/app/models/commontator/thread.rb~ +0 -124
  27. data/app/models/commontator/tree.rb~ +0 -123
  28. data/app/views/commontator/comments/_actions.html.erb~ +0 -30
  29. data/app/views/commontator/comments/_body.html.erb~ +0 -8
  30. data/app/views/commontator/comments/_form.html.erb~ +0 -38
  31. data/app/views/commontator/comments/_show.html.erb~ +0 -44
  32. data/app/views/commontator/comments/_votes.html.erb~ +0 -57
  33. data/app/views/commontator/comments/delete.js.erb~ +0 -17
  34. data/app/views/commontator/shared/_thread.html.erb~ +0 -20
  35. data/app/views/commontator/subscriptions/_link.html.erb~ +0 -16
  36. data/app/views/commontator/threads/_show.html.erb~ +0 -62
  37. data/config/initializers/commontator.rb~ +0 -171
  38. data/config/routes.rb~ +0 -22
  39. data/db/migrate/0_install.rb~ +0 -50
  40. data/lib/commontator.rb~ +0 -61
  41. data/lib/commontator/acts_as_commontable.rb~ +0 -45
  42. data/lib/commontator/acts_as_commontator.rb~ +0 -31
  43. data/lib/commontator/controller_includes.rb~ +0 -22
  44. data/lib/commontator/security_transgression.rb~ +0 -3
  45. data/lib/commontator/shared_helper.rb~ +0 -42
  46. data/lib/commontator/version.rb~ +0 -3
  47. data/lib/tasks/commontator_tasks.rake~ +0 -42
  48. data/spec/app/controllers/commontator/comments_controller_spec.rb~ +0 -563
  49. data/spec/app/controllers/commontator/subscriptions_controller_spec.rb~ +0 -99
  50. data/spec/app/controllers/commontator/threads_controller_spec.rb~ +0 -121
  51. data/spec/app/helpers/commontator/application_helper_spec.rb~ +0 -9
  52. data/spec/app/helpers/commontator/threads_helper_spec.rb~ +0 -17
  53. data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb~ +0 -30
  54. data/spec/app/models/commontator/comment_observer_spec.rb~ +0 -27
  55. data/spec/app/models/commontator/comment_spec.rb~ +0 -61
  56. data/spec/app/models/commontator/subscription_spec.rb~ +0 -28
  57. data/spec/app/models/commontator/thread_spec.rb~ +0 -130
  58. data/spec/dummy/README.md~ +0 -3
  59. data/spec/dummy/Rakefile~ +0 -7
  60. data/spec/dummy/config.ru~ +0 -4
  61. data/spec/dummy/config/application.rb~ +0 -23
  62. data/spec/dummy/config/environment.rb~ +0 -5
  63. data/spec/dummy/config/environments/development.rb~ +0 -31
  64. data/spec/dummy/config/environments/production.rb~ +0 -67
  65. data/spec/dummy/config/environments/test.rb~ +0 -31
  66. data/spec/dummy/config/initializers/secret_token.rb~ +0 -12
  67. data/spec/lib/commontator/acts_as_commontable_spec.rb~ +0 -26
  68. data/spec/lib/commontator/acts_as_commontator_spec.rb~ +0 -25
  69. data/spec/lib/commontator/commontable_config_spec.rb~ +0 -26
  70. data/spec/lib/commontator/commontator_config_spec.rb~ +0 -26
  71. data/spec/lib/commontator/controller_includes_spec.rb~ +0 -15
  72. data/spec/lib/commontator/shared_helper_spec.rb~ +0 -16
  73. data/spec/lib/commontator_spec.rb~ +0 -23
  74. data/spec/minitest_helper.rb~ +0 -35
  75. data/spec/spec_helper.rb~ +0 -36
  76. data/spec/test_helper.rb~ +0 -37
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commontator
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jquery-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -87,13 +87,9 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - app/controllers/commontator/application_controller.rb~
91
90
  - app/controllers/commontator/threads_controller.rb
92
- - app/controllers/commontator/threads_controller.rb~
93
91
  - app/controllers/commontator/application_controller.rb
94
92
  - app/controllers/commontator/subscriptions_controller.rb
95
- - app/controllers/commontator/comments_controller.rb~
96
- - app/controllers/commontator/subscriptions_controller.rb~
97
93
  - app/controllers/commontator/comments_controller.rb
98
94
  - app/assets/stylesheets/commontator/application.css
99
95
  - app/assets/stylesheets/commontator/comments.css
@@ -102,96 +98,58 @@ files:
102
98
  - app/assets/images/commontator/upvote_hover.png
103
99
  - app/assets/images/commontator/downvote_hover.png
104
100
  - app/assets/images/commontator/upvote.png
105
- - app/models/commontator/thread.rb~
106
101
  - app/models/commontator/subscription.rb
107
- - app/models/commontator/tree.rb~
108
- - app/models/commontator/subscription.rb~
109
102
  - app/models/commontator/thread.rb
110
103
  - app/models/commontator/comment.rb
111
- - app/models/commontator/comment.rb~
112
104
  - app/helpers/commontator/threads_helper.rb
113
105
  - app/helpers/commontator/application_helper.rb
114
- - app/views/commontator/subscriptions/_link.html.erb~
115
106
  - app/views/commontator/subscriptions/subscribe.js.erb
116
107
  - app/views/commontator/subscriptions/_link.html.erb
117
108
  - app/views/commontator/subscriptions_mailer/comment_created.html.erb
118
109
  - app/views/commontator/threads/_show.html.erb
119
110
  - app/views/commontator/threads/show.js.erb
120
- - app/views/commontator/threads/_show.html.erb~
121
- - app/views/commontator/shared/_thread.html.erb~
122
111
  - app/views/commontator/shared/_thread.html.erb
123
112
  - app/views/commontator/comments/_votes.html.erb
124
- - app/views/commontator/comments/_body.html.erb~
125
113
  - app/views/commontator/comments/create.js.erb
126
114
  - app/views/commontator/comments/_show.html.erb
127
115
  - app/views/commontator/comments/_actions.html.erb
128
- - app/views/commontator/comments/_show.html.erb~
129
116
  - app/views/commontator/comments/update.js.erb
130
117
  - app/views/commontator/comments/delete.js.erb
131
118
  - app/views/commontator/comments/new.js.erb
132
119
  - app/views/commontator/comments/_body.html.erb
133
120
  - app/views/commontator/comments/edit.js.erb
134
- - app/views/commontator/comments/_votes.html.erb~
135
121
  - app/views/commontator/comments/vote.js.erb
136
122
  - app/views/commontator/comments/_form.html.erb
137
- - app/views/commontator/comments/_actions.html.erb~
138
- - app/views/commontator/comments/_form.html.erb~
139
- - app/views/commontator/comments/delete.js.erb~
140
123
  - app/mailers/commontator/subscriptions_mailer.rb
141
- - app/mailers/commontator/subscriptions_mailer.rb~
142
124
  - config/routes.rb
143
- - config/initializers/commontator.rb~
144
125
  - config/initializers/commontator.rb
145
- - config/routes.rb~
146
126
  - db/migrate/0_install_commontator.rb
147
- - db/migrate/0_install.rb~
148
- - lib/commontator.rb~
149
- - lib/commontator/version.rb~
150
127
  - lib/commontator/commontable_config.rb
151
128
  - lib/commontator/acts_as_commontator.rb
152
- - lib/commontator/acts_as_commontator.rb~
153
129
  - lib/commontator/commontator_config.rb
154
130
  - lib/commontator/acts_as_commontable.rb
155
- - lib/commontator/shared_helper.rb~
156
131
  - lib/commontator/controller_includes.rb
157
132
  - lib/commontator/engine.rb
158
- - lib/commontator/acts_as_commontable.rb~
159
133
  - lib/commontator/shared_helper.rb
160
134
  - lib/commontator/version.rb
161
- - lib/commontator/security_transgression.rb~
162
- - lib/commontator/controller_includes.rb~
163
135
  - lib/commontator/security_transgression.rb
164
136
  - lib/commontator.rb
165
- - lib/tasks/commontator_tasks.rake~
166
137
  - lib/tasks/commontator_tasks.rake
167
138
  - MIT-LICENSE
168
139
  - Rakefile
169
140
  - README.md
170
- - spec/app/controllers/commontator/comments_controller_spec.rb~
171
- - spec/app/controllers/commontator/threads_controller_spec.rb~
172
141
  - spec/app/controllers/commontator/threads_controller_spec.rb
173
- - spec/app/controllers/commontator/subscriptions_controller_spec.rb~
174
142
  - spec/app/controllers/commontator/comments_controller_spec.rb
175
143
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
176
- - spec/app/models/commontator/comment_observer_spec.rb~
177
- - spec/app/models/commontator/thread_spec.rb~
178
144
  - spec/app/models/commontator/comment_spec.rb
179
145
  - spec/app/models/commontator/subscription_spec.rb
180
146
  - spec/app/models/commontator/thread_spec.rb
181
- - spec/app/models/commontator/comment_spec.rb~
182
- - spec/app/models/commontator/subscription_spec.rb~
183
- - spec/app/helpers/commontator/application_helper_spec.rb~
184
- - spec/app/helpers/commontator/threads_helper_spec.rb~
185
147
  - spec/app/helpers/commontator/threads_helper_spec.rb
186
148
  - spec/app/helpers/commontator/application_helper_spec.rb
187
149
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
188
- - spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
189
150
  - spec/test_helper.rb
190
- - spec/minitest_helper.rb~
191
151
  - spec/dummy/script/rails
192
152
  - spec/dummy/Rakefile
193
- - spec/dummy/Rakefile~
194
- - spec/dummy/config.ru~
195
153
  - spec/dummy/app/controllers/application_controller.rb
196
154
  - spec/dummy/app/controllers/dummy_models_controller.rb
197
155
  - spec/dummy/app/assets/stylesheets/application.css
@@ -212,12 +170,8 @@ files:
212
170
  - spec/dummy/config/environment.rb
213
171
  - spec/dummy/config/routes.rb
214
172
  - spec/dummy/config/environments/production.rb
215
- - spec/dummy/config/environments/production.rb~
216
- - spec/dummy/config/environments/test.rb~
217
- - spec/dummy/config/environments/development.rb~
218
173
  - spec/dummy/config/environments/test.rb
219
174
  - spec/dummy/config/environments/development.rb
220
- - spec/dummy/config/initializers/secret_token.rb~
221
175
  - spec/dummy/config/initializers/wrap_parameters.rb
222
176
  - spec/dummy/config/initializers/secret_token.rb
223
177
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -227,11 +181,8 @@ files:
227
181
  - spec/dummy/config/initializers/backtrace_silencers.rb
228
182
  - spec/dummy/config/initializers/inflections.rb
229
183
  - spec/dummy/config/boot.rb
230
- - spec/dummy/config/environment.rb~
231
184
  - spec/dummy/config/application.rb
232
185
  - spec/dummy/config/database.yml
233
- - spec/dummy/config/application.rb~
234
- - spec/dummy/README.md~
235
186
  - spec/dummy/README.md
236
187
  - spec/dummy/public/500.html
237
188
  - spec/dummy/public/422.html
@@ -246,21 +197,12 @@ files:
246
197
  - spec/dummy/db/migrate/1_create_dummy_models.rb
247
198
  - spec/dummy/db/migrate/3_acts_as_votable_migration.rb
248
199
  - spec/dummy/db/test.sqlite3
249
- - spec/test_helper.rb~
250
- - spec/spec_helper.rb~
251
200
  - spec/lib/commontator_spec.rb
252
- - spec/lib/commontator_spec.rb~
253
- - spec/lib/commontator/commontator_config_spec.rb~
254
- - spec/lib/commontator/acts_as_commontator_spec.rb~
255
- - spec/lib/commontator/commontable_config_spec.rb~
256
201
  - spec/lib/commontator/acts_as_commontator_spec.rb
257
202
  - spec/lib/commontator/controller_includes_spec.rb
258
203
  - spec/lib/commontator/shared_helper_spec.rb
259
- - spec/lib/commontator/controller_includes_spec.rb~
260
204
  - spec/lib/commontator/commontable_config_spec.rb
261
- - spec/lib/commontator/acts_as_commontable_spec.rb~
262
205
  - spec/lib/commontator/commontator_config_spec.rb
263
- - spec/lib/commontator/shared_helper_spec.rb~
264
206
  - spec/lib/commontator/acts_as_commontable_spec.rb
265
207
  homepage: http://github.com/lml/commontator
266
208
  licenses:
@@ -287,31 +229,18 @@ signing_key:
287
229
  specification_version: 4
288
230
  summary: Allows users to comment on any model in your application.
289
231
  test_files:
290
- - spec/app/controllers/commontator/comments_controller_spec.rb~
291
- - spec/app/controllers/commontator/threads_controller_spec.rb~
292
232
  - spec/app/controllers/commontator/threads_controller_spec.rb
293
- - spec/app/controllers/commontator/subscriptions_controller_spec.rb~
294
233
  - spec/app/controllers/commontator/comments_controller_spec.rb
295
234
  - spec/app/controllers/commontator/subscriptions_controller_spec.rb
296
- - spec/app/models/commontator/comment_observer_spec.rb~
297
- - spec/app/models/commontator/thread_spec.rb~
298
235
  - spec/app/models/commontator/comment_spec.rb
299
236
  - spec/app/models/commontator/subscription_spec.rb
300
237
  - spec/app/models/commontator/thread_spec.rb
301
- - spec/app/models/commontator/comment_spec.rb~
302
- - spec/app/models/commontator/subscription_spec.rb~
303
- - spec/app/helpers/commontator/application_helper_spec.rb~
304
- - spec/app/helpers/commontator/threads_helper_spec.rb~
305
238
  - spec/app/helpers/commontator/threads_helper_spec.rb
306
239
  - spec/app/helpers/commontator/application_helper_spec.rb
307
240
  - spec/app/mailers/commontator/subscriptions_mailer_spec.rb
308
- - spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
309
241
  - spec/test_helper.rb
310
- - spec/minitest_helper.rb~
311
242
  - spec/dummy/script/rails
312
243
  - spec/dummy/Rakefile
313
- - spec/dummy/Rakefile~
314
- - spec/dummy/config.ru~
315
244
  - spec/dummy/app/controllers/application_controller.rb
316
245
  - spec/dummy/app/controllers/dummy_models_controller.rb
317
246
  - spec/dummy/app/assets/stylesheets/application.css
@@ -332,12 +261,8 @@ test_files:
332
261
  - spec/dummy/config/environment.rb
333
262
  - spec/dummy/config/routes.rb
334
263
  - spec/dummy/config/environments/production.rb
335
- - spec/dummy/config/environments/production.rb~
336
- - spec/dummy/config/environments/test.rb~
337
- - spec/dummy/config/environments/development.rb~
338
264
  - spec/dummy/config/environments/test.rb
339
265
  - spec/dummy/config/environments/development.rb
340
- - spec/dummy/config/initializers/secret_token.rb~
341
266
  - spec/dummy/config/initializers/wrap_parameters.rb
342
267
  - spec/dummy/config/initializers/secret_token.rb
343
268
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -347,11 +272,8 @@ test_files:
347
272
  - spec/dummy/config/initializers/backtrace_silencers.rb
348
273
  - spec/dummy/config/initializers/inflections.rb
349
274
  - spec/dummy/config/boot.rb
350
- - spec/dummy/config/environment.rb~
351
275
  - spec/dummy/config/application.rb
352
276
  - spec/dummy/config/database.yml
353
- - spec/dummy/config/application.rb~
354
- - spec/dummy/README.md~
355
277
  - spec/dummy/README.md
356
278
  - spec/dummy/public/500.html
357
279
  - spec/dummy/public/422.html
@@ -366,19 +288,10 @@ test_files:
366
288
  - spec/dummy/db/migrate/1_create_dummy_models.rb
367
289
  - spec/dummy/db/migrate/3_acts_as_votable_migration.rb
368
290
  - spec/dummy/db/test.sqlite3
369
- - spec/test_helper.rb~
370
- - spec/spec_helper.rb~
371
291
  - spec/lib/commontator_spec.rb
372
- - spec/lib/commontator_spec.rb~
373
- - spec/lib/commontator/commontator_config_spec.rb~
374
- - spec/lib/commontator/acts_as_commontator_spec.rb~
375
- - spec/lib/commontator/commontable_config_spec.rb~
376
292
  - spec/lib/commontator/acts_as_commontator_spec.rb
377
293
  - spec/lib/commontator/controller_includes_spec.rb
378
294
  - spec/lib/commontator/shared_helper_spec.rb
379
- - spec/lib/commontator/controller_includes_spec.rb~
380
295
  - spec/lib/commontator/commontable_config_spec.rb
381
- - spec/lib/commontator/acts_as_commontable_spec.rb~
382
296
  - spec/lib/commontator/commontator_config_spec.rb
383
- - spec/lib/commontator/shared_helper_spec.rb~
384
297
  - spec/lib/commontator/acts_as_commontable_spec.rb
@@ -1,27 +0,0 @@
1
- module Commontator
2
- class CommontatorController < ActionController::Base
3
- before_filter :get_user
4
-
5
- cattr_accessor :commontable_url
6
-
7
- rescue_from SecurityTransgression, :with => lambda { head(:forbidden) }
8
-
9
- protected
10
-
11
- def get_user
12
- @user = self.send Commontator.current_user_method
13
- raise SecurityTransgression unless (@user.nil? || @user.is_commontator)
14
- end
15
-
16
- def get_thread
17
- @thread = params[:thread_id].blank? ? \
18
- Commontator::Thread.find(params[:id]) : \
19
- Commontator::Thread.find(params[:thread_id])
20
- raise SecurityTransgression if @thread.commontable.nil?
21
- end
22
-
23
- def set_commontable_url
24
- self.commontable_url = @thread.config.commontable_url_proc.call(main_app, @thread.commontable)
25
- end
26
- end
27
- end
@@ -1,144 +0,0 @@
1
- module Commontator
2
- class CommentsController < Commontator::ApplicationController
3
- before_filter :get_thread, :only => [:new, :create]
4
- before_filter :get_comment_and_thread, :except => [:new, :create]
5
- before_filter :set_commontable_url, :only => :create
6
-
7
- # GET /threads/1/comments/new
8
- def new
9
- @comment = Comment.new
10
- @comment.thread = @thread
11
- @comment.creator = @user
12
-
13
- raise SecurityTransgression unless @comment.can_be_created_by?(@user)
14
-
15
- respond_to do |format|
16
- format.html { redirect_to @thread }
17
- format.js
18
- end
19
-
20
- end
21
-
22
- # POST /threads/1/comments
23
- def create
24
- @comment = Comment.new
25
- @comment.body = params[:comment][:body] unless params[:comment].nil?
26
- @comment.thread = @thread
27
- @comment.creator = @user
28
-
29
- raise SecurityTransgression unless @comment.can_be_created_by?(@user)
30
-
31
- respond_to do |format|
32
- if @comment.save
33
- @thread.subscribe(@user) if @thread.config.auto_subscribe_on_comment
34
- @thread.add_unread_except_for(@user)
35
- recipients = @thread.active_subscribers.reject{|s| s == @user}
36
- SubscriptionsMailer.comment_created(@comment, recipients).deliver \
37
- unless recipients.empty?
38
-
39
- format.html { redirect_to @thread }
40
- format.js
41
- else
42
- format.html { redirect_to @thread }
43
- format.js { render :new }
44
- end
45
- end
46
- end
47
-
48
- # GET /comments/1/edit
49
- def edit
50
- raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
51
-
52
- respond_to do |format|
53
- format.html { redirect_to @thread }
54
- format.js
55
- end
56
- end
57
-
58
- # PATCH /comments/1
59
- def update
60
- raise SecurityTransgression unless @comment.can_be_edited_by?(@user)
61
- @comment.body = params[:comment][:body] unless params[:comment].nil?
62
- @comment.editor = @user
63
-
64
- respond_to do |format|
65
- if @comment.save
66
- format.html { redirect_to @thread }
67
- format.js
68
- else
69
- format.html { redirect_to @thread }
70
- format.js { render :edit }
71
- end
72
- end
73
- end
74
-
75
- # PATCH /comments/1/delete
76
- def delete
77
- raise SecurityTransgression unless @comment.can_be_deleted_by?(@user)
78
-
79
- @comment.errors.add(:base, 'This comment has already been deleted.') \
80
- unless @comment.delete_by(@user)
81
-
82
- respond_to do |format|
83
- format.html { redirect_to @thread }
84
- format.js { render :delete }
85
- end
86
- end
87
-
88
- # PATCH /comments/1/undelete
89
- def undelete
90
- raise SecurityTransgression unless @comment.can_be_deleted_by?(@user)
91
-
92
- @comment.errors.add(:base, 'This comment is not deleted.') \
93
- unless @comment.undelete_by(@user)
94
-
95
- respond_to do |format|
96
- format.html { redirect_to @thread }
97
- format.js { render :delete }
98
- end
99
- end
100
-
101
- # PATCH /comments/1/upvote
102
- def upvote
103
- raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
104
-
105
- @comment.upvote_from @user
106
-
107
- respond_to do |format|
108
- format.html { redirect_to @thread }
109
- format.js { render :vote }
110
- end
111
- end
112
-
113
- # PATCH /comments/1/downvote
114
- def downvote
115
- raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
116
-
117
- @comment.downvote_from @user
118
-
119
- respond_to do |format|
120
- format.html { redirect_to @thread }
121
- format.js { render :vote }
122
- end
123
- end
124
-
125
- # PATCH /comments/1/unvote
126
- def unvote
127
- raise SecurityTransgression unless @comment.can_be_voted_on_by?(@user)
128
-
129
- @comment.unvote :voter => @user
130
-
131
- respond_to do |format|
132
- format.html { redirect_to @thread }
133
- format.js { render :vote }
134
- end
135
- end
136
-
137
- protected
138
-
139
- def get_comment_and_thread
140
- @comment = Comment.find(params[:id])
141
- @thread = @comment.thread
142
- end
143
- end
144
- end
@@ -1,32 +0,0 @@
1
- module Commontator
2
- class SubscriptionsController < Commontator::ApplicationController
3
- before_filter :get_thread
4
-
5
- # PATCH threads/1/subscribe
6
- def subscribe
7
- raise SecurityTransgression unless @thread.can_subscribe?(@user)
8
-
9
- @thread.errors.add(:subscription, "You are already subscribed to this thread") \
10
- unless @thread.subscribe(@user)
11
-
12
- respond_to do |format|
13
- format.html { redirect_to @thread }
14
- format.js { render :subscribe }
15
- end
16
-
17
- end
18
-
19
- # PATCH threads/1/unsubscribe
20
- def unsubscribe
21
- raise SecurityTransgression unless @thread.can_subscribe?(@user)
22
-
23
- @thread.errors.add(:subscription, "You are not subscribed to this thread") \
24
- unless @thread.unsubscribe(@user)
25
-
26
- respond_to do |format|
27
- format.html { redirect_to @thread }
28
- format.js { render :subscribe }
29
- end
30
- end
31
- end
32
- end