thredded 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. metadata +7 -114
  3. data/MIT-LICENSE +0 -20
  4. data/README.mkdn +0 -72
  5. data/Rakefile +0 -31
  6. data/app/assets/javascripts/thredded/application.js +0 -15
  7. data/app/assets/stylesheets/thredded/application.css +0 -13
  8. data/app/controllers/thredded/application_controller.rb +0 -60
  9. data/app/controllers/thredded/emails_controller.rb +0 -4
  10. data/app/controllers/thredded/messageboards_controller.rb +0 -7
  11. data/app/controllers/thredded/posts_controller.rb +0 -85
  12. data/app/controllers/thredded/preferences_controller.rb +0 -28
  13. data/app/controllers/thredded/private_topics_controller.rb +0 -58
  14. data/app/controllers/thredded/setups_controller.rb +0 -44
  15. data/app/controllers/thredded/topics_controller.rb +0 -99
  16. data/app/decorators/thredded/messageboard_decorator.rb +0 -74
  17. data/app/decorators/thredded/post_decorator.rb +0 -61
  18. data/app/decorators/thredded/topic_decorator.rb +0 -94
  19. data/app/decorators/thredded/user_topic_decorator.rb +0 -88
  20. data/app/helpers/thredded/application_helper.rb +0 -4
  21. data/app/helpers/thredded/posts_helper.rb +0 -7
  22. data/app/helpers/thredded/topics_helper.rb +0 -4
  23. data/app/mailers/thredded/post_mailer.rb +0 -28
  24. data/app/mailers/thredded/topic_mailer.rb +0 -29
  25. data/app/models/thredded/ability.rb +0 -66
  26. data/app/models/thredded/attachment.rb +0 -23
  27. data/app/models/thredded/category.rb +0 -9
  28. data/app/models/thredded/image.rb +0 -26
  29. data/app/models/thredded/messageboard.rb +0 -117
  30. data/app/models/thredded/messageboard_preference.rb +0 -14
  31. data/app/models/thredded/null_preference.rb +0 -11
  32. data/app/models/thredded/null_topic.rb +0 -16
  33. data/app/models/thredded/null_topic_read.rb +0 -19
  34. data/app/models/thredded/null_user.rb +0 -35
  35. data/app/models/thredded/post.rb +0 -120
  36. data/app/models/thredded/post_notification.rb +0 -5
  37. data/app/models/thredded/private_topic.rb +0 -42
  38. data/app/models/thredded/private_user.rb +0 -6
  39. data/app/models/thredded/role.rb +0 -16
  40. data/app/models/thredded/topic.rb +0 -154
  41. data/app/models/thredded/topic_category.rb +0 -6
  42. data/app/models/thredded/user_detail.rb +0 -6
  43. data/app/models/thredded/user_extender.rb +0 -21
  44. data/app/models/thredded/user_preference.rb +0 -6
  45. data/app/models/thredded/user_topic_read.rb +0 -9
  46. data/app/uploaders/thredded/attachment_uploader.rb +0 -30
  47. data/app/uploaders/thredded/image_uploader.rb +0 -16
  48. data/app/views/thredded/attachments/_attachment.html.erb +0 -7
  49. data/app/views/thredded/messageboards/_messageboard.html.erb +0 -20
  50. data/app/views/thredded/messageboards/index.html.erb +0 -18
  51. data/app/views/thredded/post_mailer/at_notification.html.erb +0 -17
  52. data/app/views/thredded/post_mailer/at_notification.text.erb +0 -13
  53. data/app/views/thredded/posts/_form.html.erb +0 -17
  54. data/app/views/thredded/posts/_null_user.html.erb +0 -0
  55. data/app/views/thredded/posts/_post.html.erb +0 -29
  56. data/app/views/thredded/posts/_user.html.erb +0 -7
  57. data/app/views/thredded/posts/edit.html.erb +0 -31
  58. data/app/views/thredded/posts/index.html.erb +0 -64
  59. data/app/views/thredded/preferences/edit.html.erb +0 -22
  60. data/app/views/thredded/private_topics/_form.html.erb +0 -15
  61. data/app/views/thredded/private_topics/index.html.erb +0 -34
  62. data/app/views/thredded/private_topics/new.html.erb +0 -28
  63. data/app/views/thredded/search/_form.html.erb +0 -9
  64. data/app/views/thredded/setups/_form.html.erb +0 -35
  65. data/app/views/thredded/setups/new.html.erb +0 -6
  66. data/app/views/thredded/shared/_currently_online.html.erb +0 -10
  67. data/app/views/thredded/shared/_error_msgs.html.erb +0 -7
  68. data/app/views/thredded/shared/_google_analytics.html.erb +0 -10
  69. data/app/views/thredded/shared/_topic_nav.html.erb +0 -21
  70. data/app/views/thredded/topic_mailer/message_notification.html.erb +0 -17
  71. data/app/views/thredded/topic_mailer/message_notification.text.erb +0 -13
  72. data/app/views/thredded/topics/_form.html.erb +0 -6
  73. data/app/views/thredded/topics/_recent_topics_by_user.html.erb +0 -8
  74. data/app/views/thredded/topics/_topic_condensed.html.erb +0 -24
  75. data/app/views/thredded/topics/_topic_form.html.erb +0 -27
  76. data/app/views/thredded/topics/by_category.html.erb +0 -54
  77. data/app/views/thredded/topics/edit.html.erb +0 -28
  78. data/app/views/thredded/topics/index.html.erb +0 -34
  79. data/app/views/thredded/topics/menu/_new_topic.html.erb +0 -3
  80. data/app/views/thredded/topics/new.html.erb +0 -21
  81. data/app/views/thredded/topics/search.html.erb +0 -34
  82. data/config/initializers/griddler.rb +0 -4
  83. data/config/routes.rb +0 -29
  84. data/db/migrate/20130425230852_create_thredded_tables.rb +0 -143
  85. data/db/migrate/20131005032727_prevent_null_sticky_and_locked.rb +0 -15
  86. data/db/migrate/20131014014258_uniqs_on_user_topic_read.rb +0 -9
  87. data/db/migrate/20131019014258_index_necessary_columns.rb +0 -24
  88. data/db/migrate/20131026202621_move_filter_to_messageboards.rb +0 -11
  89. data/db/migrate/20131029034507_convert_textile_to_markdown.rb +0 -7
  90. data/lib/html/pipeline/at_mention_filter.rb +0 -19
  91. data/lib/html/pipeline/attached_image_filter.rb +0 -59
  92. data/lib/html/pipeline/bbcode_filter.rb +0 -19
  93. data/lib/tasks/thredded_tasks.rake +0 -4
  94. data/lib/thredded.rb +0 -58
  95. data/lib/thredded/at_notification_extractor.rb +0 -15
  96. data/lib/thredded/at_notifier.rb +0 -67
  97. data/lib/thredded/at_users.rb +0 -19
  98. data/lib/thredded/email_processor.rb +0 -76
  99. data/lib/thredded/engine.rb +0 -17
  100. data/lib/thredded/errors.rb +0 -40
  101. data/lib/thredded/messageboard_user_permissions.rb +0 -27
  102. data/lib/thredded/post_sql_builder.rb +0 -34
  103. data/lib/thredded/post_user_permissions.rb +0 -41
  104. data/lib/thredded/private_topic_notifier.rb +0 -56
  105. data/lib/thredded/private_topic_user_permissions.rb +0 -38
  106. data/lib/thredded/search_parser.rb +0 -45
  107. data/lib/thredded/search_sql_builder.rb +0 -25
  108. data/lib/thredded/setup_thredded.rb +0 -7
  109. data/lib/thredded/table_sql_builder.rb +0 -105
  110. data/lib/thredded/topic_sql_builder.rb +0 -32
  111. data/lib/thredded/topic_user_permissions.rb +0 -55
  112. data/lib/thredded/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df7af89356e2a063cd53eb323694e5e5ddce74a4
4
- data.tar.gz: fffc4fd4e91f2828b3d45dd7761bf01861dc8802
3
+ metadata.gz: 6344a040f11def4139b502666d34e34cf822ba02
4
+ data.tar.gz: 43bcb0e00cb9fc7d14d5cc37a1eb1cb6b639a4d0
5
5
  SHA512:
6
- metadata.gz: 77112aabf3ce777664be0d5c19cad1449d7d6cc67f67c04ac82b23b3c2a134b176a30c5a0a59f6eade60ab860004f4a9f17c183810f3a615247b33f9d716e32f
7
- data.tar.gz: 49465daf00d25b2bd94dfe37d0b322049f4d8b32864f3674dfb92b9207a6b24d28cbe1ae2e2e650e7f59b83e13f2226e85d30f2bf3410da8285f2c098914694e
6
+ metadata.gz: e48c6343d9c1c77c8ca0cc82a51d5521657d2dc52a61fffee09b176cd2537adb7843ca4ab500e25761363ae61ca73a98f994aa2acd2c8abc3cae47627a335d9b
7
+ data.tar.gz: 3d5734b4de6a9cb03f4dfee9a5a84715d07db6816144f18e9c5db28d41e61f1da903fabb09b505115eafc3194ede9f03ee6253978ecb1317d53edb48d816f170
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thredded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bbcoder
@@ -422,122 +422,15 @@ email:
422
422
  executables: []
423
423
  extensions: []
424
424
  extra_rdoc_files: []
425
- files:
426
- - app/assets/javascripts/thredded/application.js
427
- - app/assets/stylesheets/thredded/application.css
428
- - app/controllers/thredded/application_controller.rb
429
- - app/controllers/thredded/emails_controller.rb
430
- - app/controllers/thredded/messageboards_controller.rb
431
- - app/controllers/thredded/posts_controller.rb
432
- - app/controllers/thredded/preferences_controller.rb
433
- - app/controllers/thredded/private_topics_controller.rb
434
- - app/controllers/thredded/setups_controller.rb
435
- - app/controllers/thredded/topics_controller.rb
436
- - app/decorators/thredded/messageboard_decorator.rb
437
- - app/decorators/thredded/post_decorator.rb
438
- - app/decorators/thredded/topic_decorator.rb
439
- - app/decorators/thredded/user_topic_decorator.rb
440
- - app/helpers/thredded/application_helper.rb
441
- - app/helpers/thredded/posts_helper.rb
442
- - app/helpers/thredded/topics_helper.rb
443
- - app/mailers/thredded/post_mailer.rb
444
- - app/mailers/thredded/topic_mailer.rb
445
- - app/models/thredded/ability.rb
446
- - app/models/thredded/attachment.rb
447
- - app/models/thredded/category.rb
448
- - app/models/thredded/image.rb
449
- - app/models/thredded/messageboard.rb
450
- - app/models/thredded/messageboard_preference.rb
451
- - app/models/thredded/null_preference.rb
452
- - app/models/thredded/null_topic.rb
453
- - app/models/thredded/null_topic_read.rb
454
- - app/models/thredded/null_user.rb
455
- - app/models/thredded/post.rb
456
- - app/models/thredded/post_notification.rb
457
- - app/models/thredded/private_topic.rb
458
- - app/models/thredded/private_user.rb
459
- - app/models/thredded/role.rb
460
- - app/models/thredded/topic.rb
461
- - app/models/thredded/topic_category.rb
462
- - app/models/thredded/user_detail.rb
463
- - app/models/thredded/user_extender.rb
464
- - app/models/thredded/user_preference.rb
465
- - app/models/thredded/user_topic_read.rb
466
- - app/uploaders/thredded/attachment_uploader.rb
467
- - app/uploaders/thredded/image_uploader.rb
468
- - app/views/thredded/attachments/_attachment.html.erb
469
- - app/views/thredded/messageboards/_messageboard.html.erb
470
- - app/views/thredded/messageboards/index.html.erb
471
- - app/views/thredded/post_mailer/at_notification.html.erb
472
- - app/views/thredded/post_mailer/at_notification.text.erb
473
- - app/views/thredded/posts/_form.html.erb
474
- - app/views/thredded/posts/_null_user.html.erb
475
- - app/views/thredded/posts/_post.html.erb
476
- - app/views/thredded/posts/_user.html.erb
477
- - app/views/thredded/posts/edit.html.erb
478
- - app/views/thredded/posts/index.html.erb
479
- - app/views/thredded/preferences/edit.html.erb
480
- - app/views/thredded/private_topics/_form.html.erb
481
- - app/views/thredded/private_topics/index.html.erb
482
- - app/views/thredded/private_topics/new.html.erb
483
- - app/views/thredded/search/_form.html.erb
484
- - app/views/thredded/setups/_form.html.erb
485
- - app/views/thredded/setups/new.html.erb
486
- - app/views/thredded/shared/_currently_online.html.erb
487
- - app/views/thredded/shared/_error_msgs.html.erb
488
- - app/views/thredded/shared/_google_analytics.html.erb
489
- - app/views/thredded/shared/_topic_nav.html.erb
490
- - app/views/thredded/topic_mailer/message_notification.html.erb
491
- - app/views/thredded/topic_mailer/message_notification.text.erb
492
- - app/views/thredded/topics/_form.html.erb
493
- - app/views/thredded/topics/_recent_topics_by_user.html.erb
494
- - app/views/thredded/topics/_topic_condensed.html.erb
495
- - app/views/thredded/topics/_topic_form.html.erb
496
- - app/views/thredded/topics/by_category.html.erb
497
- - app/views/thredded/topics/edit.html.erb
498
- - app/views/thredded/topics/index.html.erb
499
- - app/views/thredded/topics/menu/_new_topic.html.erb
500
- - app/views/thredded/topics/new.html.erb
501
- - app/views/thredded/topics/search.html.erb
502
- - config/initializers/griddler.rb
503
- - config/routes.rb
504
- - db/migrate/20130425230852_create_thredded_tables.rb
505
- - db/migrate/20131005032727_prevent_null_sticky_and_locked.rb
506
- - db/migrate/20131014014258_uniqs_on_user_topic_read.rb
507
- - db/migrate/20131019014258_index_necessary_columns.rb
508
- - db/migrate/20131026202621_move_filter_to_messageboards.rb
509
- - db/migrate/20131029034507_convert_textile_to_markdown.rb
510
- - lib/html/pipeline/at_mention_filter.rb
511
- - lib/html/pipeline/attached_image_filter.rb
512
- - lib/html/pipeline/bbcode_filter.rb
513
- - lib/tasks/thredded_tasks.rake
514
- - lib/thredded/at_notification_extractor.rb
515
- - lib/thredded/at_notifier.rb
516
- - lib/thredded/at_users.rb
517
- - lib/thredded/email_processor.rb
518
- - lib/thredded/engine.rb
519
- - lib/thredded/errors.rb
520
- - lib/thredded/messageboard_user_permissions.rb
521
- - lib/thredded/post_sql_builder.rb
522
- - lib/thredded/post_user_permissions.rb
523
- - lib/thredded/private_topic_notifier.rb
524
- - lib/thredded/private_topic_user_permissions.rb
525
- - lib/thredded/search_parser.rb
526
- - lib/thredded/search_sql_builder.rb
527
- - lib/thredded/setup_thredded.rb
528
- - lib/thredded/table_sql_builder.rb
529
- - lib/thredded/topic_sql_builder.rb
530
- - lib/thredded/topic_user_permissions.rb
531
- - lib/thredded/version.rb
532
- - lib/thredded.rb
533
- - MIT-LICENSE
534
- - Rakefile
535
- - README.mkdn
425
+ files: []
536
426
  homepage: https://www.thredded.com
537
427
  licenses:
538
428
  - MIT
539
429
  metadata: {}
540
- post_install_message:
430
+ post_install_message: |2
431
+ * * *
432
+ Deprecation Notice: v.0.0.15 will have posts' attachments removed entirely from the gem. As of release v0.0.13 the ability to add new attachments has been removed. See upgrade notes in the README.
433
+ * * *
541
434
  rdoc_options: []
542
435
  require_paths:
543
436
  - lib
@@ -1,20 +0,0 @@
1
- Copyright 2013 YOURNAME
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,72 +0,0 @@
1
- # Thredded (the gem / rails engine)
2
-
3
- ## Installation
4
-
5
- Add the gem to your Gemfile:
6
-
7
- ```ruby
8
- gem 'thredded'
9
- ```
10
-
11
- Add an initializer to your app: `config/initializers/thredded.rb`
12
-
13
- ```ruby
14
- Thredded.user_class = 'User'
15
- Thredded.email_incoming_host = 'incoming.example.com'
16
- Thredded.email_from = 'no-reply@example.com'
17
- Thredded.email_outgoing_prefix = '[Thredded] '
18
- Thredded.user_path = ->(user){ "/path/to/where/you/show/#{user}" }
19
- Thredded.file_storage = :file # or :fog
20
- Thredded.asset_root = 'http://assets.website.com/assets' # where important things, like emojis, might live
21
- Thredded.layout = 'thredded' # looks for `app/views/layouts/thredded.html.erb`
22
- Thredded.avatar_default = 'mm' # or other gravatar defaults or URL to an image
23
- ```
24
-
25
- Copy the migrations over to your parent application and migrate:
26
-
27
- ```
28
- rake thredded:install:migrations db:migrate db:test:prepare
29
- ```
30
-
31
- Mount the thredded engine in your routes file:
32
-
33
- ```
34
- mount Thredded::Engine => '/forum'
35
- ```
36
-
37
- ## Get Your App Ready
38
-
39
- There are a few things you need in your app to get things looking just right.
40
-
41
- 1. Add a to_s method to your user model. The following example assumes a column in my user model called `name`:
42
-
43
- ```ruby
44
- class User < ActiveRecord::Base
45
- def to_s
46
- name
47
- end
48
- end
49
- ```
50
-
51
- 2. Ensure you have a view layout that thredded will wrap around its views.
52
-
53
- A couple of notes with regards to your layout.
54
-
55
- * When using route helpers -- eg: `new_session_path`, et al -- make sure to prepend main_app to the helper: `main_app.new_session_path` as rails engines like thredded will not know about those routes' existence unless explicitly told so.
56
- * As noted above, by default thredded will look for a layout file in your application called `thredded.html.erb`. If you would like to use something else, like your main application layout, you may change it to that in your initializer.
57
- * The chosen layout has two content_tags available to yield - `:thredded_page_title` and `:thredded_page_id`. The views within thredded pass those up through to your layout if you would like to use them. Example layout:
58
-
59
- ```html
60
- <html>
61
- <head>
62
- <title>My Application | <%= yield :thredded_page_title %></title>
63
- </head>
64
- <body id="<%= yield :thredded_page_id %>">
65
- <%= yield %>
66
- </body>
67
- </html>
68
- ```
69
-
70
- * * *
71
-
72
- For more information see [the full-fledged rails app](https://github.com/jayroh/thredded_app)
data/Rakefile DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
-
8
- begin
9
- require 'rdoc/task'
10
- rescue LoadError
11
- require 'rdoc/rdoc'
12
- require 'rake/rdoctask'
13
- RDoc::Task = Rake::RDocTask
14
- end
15
-
16
- RDoc::Task.new(:rdoc) do |rdoc|
17
- rdoc.rdoc_dir = 'rdoc'
18
- rdoc.title = 'Thredded'
19
- rdoc.options << '--line-numbers'
20
- rdoc.rdoc_files.include('README.rdoc')
21
- rdoc.rdoc_files.include('lib/**/*.rb')
22
- end
23
-
24
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
25
- load 'rails/tasks/engine.rake'
26
-
27
- require 'rspec/core/rake_task'
28
- RSpec::Core::RakeTask.new(:spec)
29
- task default: :spec
30
-
31
- Bundler::GemHelper.install_tasks
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,60 +0,0 @@
1
- module Thredded
2
- class ApplicationController < ::ApplicationController
3
- helper Thredded::Engine.helpers
4
- helper_method :messageboard, :preferences
5
- layout Thredded.layout
6
-
7
- rescue_from CanCan::AccessDenied,
8
- Thredded::Errors::MessageboardNotFound,
9
- Thredded::Errors::MessageboardReadDenied,
10
- Thredded::Errors::TopicCreateDenied do |exception|
11
-
12
- redirect_to thredded.root_path, alert: exception.message
13
- end
14
-
15
- rescue_from Thredded::Errors::EmptySearchResults,
16
- Thredded::Errors::TopicNotFound do |exception|
17
-
18
- redirect_to messageboard_topics_path(messageboard),
19
- alert: exception.message
20
- end
21
-
22
- private
23
-
24
- def authorize_reading(obj)
25
- if cannot? :read, obj
26
- class_name = obj.class.to_s
27
- error = class_name
28
- .gsub(/Thredded::/, 'Thredded::Errors::') + 'ReadDenied'
29
- raise error.constantize
30
- end
31
- end
32
-
33
- def authorize_creating(obj)
34
- if cannot? :create, obj
35
- class_name = obj.class.to_s
36
- error = class_name
37
- .gsub(/Thredded::/, 'Thredded::Errors::') + 'CreateDenied'
38
- raise error.constantize
39
- end
40
- end
41
-
42
- def update_user_activity
43
- messageboard.update_activity_for!(current_user)
44
- end
45
-
46
- def current_ability
47
- @current_ability ||= Ability.new(current_user)
48
- end
49
-
50
- def messageboard
51
- @messageboard ||= Messageboard.find_by_slug(params[:messageboard_id])
52
- end
53
-
54
- def preferences
55
- if current_user
56
- @preferences ||= UserPreference.where(user_id: current_user.id).first
57
- end
58
- end
59
- end
60
- end
@@ -1,4 +0,0 @@
1
- module Thredded
2
- class EmailsController < ::Griddler::EmailsController
3
- end
4
- end
@@ -1,7 +0,0 @@
1
- module Thredded
2
- class MessageboardsController < Thredded::ApplicationController
3
- def index
4
- @messageboards = Messageboard.where(closed: false).decorate
5
- end
6
- end
7
- end
@@ -1,85 +0,0 @@
1
- module Thredded
2
- class PostsController < Thredded::ApplicationController
3
- load_and_authorize_resource only: [:index, :show]
4
- helper_method :messageboard, :topic, :user_topic
5
- before_filter :update_user_activity
6
-
7
- def index
8
- authorize! :read, topic
9
-
10
- @posts = Post
11
- .where(topic_id: topic.id)
12
- .includes(:user, :messageboard, :topic, :attachments)
13
- .order('id ASC')
14
- .page(current_page)
15
-
16
- @post = messageboard.posts.build(topic: topic)
17
-
18
- update_read_status!
19
- end
20
-
21
- def create
22
- topic.posts.create(post_params)
23
- redirect_to :back
24
- end
25
-
26
- def edit
27
- authorize! :edit, post
28
- end
29
-
30
- def update
31
- post.update_attributes(post_params.except(:user, :ip))
32
-
33
- redirect_to messageboard_topic_posts_url(messageboard, topic)
34
- end
35
-
36
- private
37
-
38
- def post_params
39
- params
40
- .require(:post)
41
- .permit!
42
- .merge!(
43
- ip: request.remote_ip,
44
- user: current_user,
45
- messageboard: messageboard,
46
- filter: messageboard.filter,
47
- )
48
- end
49
-
50
- def update_read_status!
51
- if current_user
52
- read_history = UserTopicRead.where(
53
- user: current_user,
54
- topic: topic,
55
- ).first_or_initialize
56
-
57
- read_history.update_attributes(
58
- farthest_post: @posts.last,
59
- posts_count: topic.posts_count,
60
- page: current_page,
61
- )
62
- end
63
- end
64
-
65
- def topic
66
- @topic ||= topic_with_eager_loaded_user_topic_reads
67
- end
68
-
69
- def topic_with_eager_loaded_user_topic_reads
70
- messageboard.topics.find_by_slug(params[:topic_id])
71
- end
72
-
73
- def user_topic
74
- @user_topic ||= UserTopicDecorator.new(current_user, topic)
75
- end
76
-
77
- def post
78
- @post ||= topic.posts.find(params[:id])
79
- end
80
-
81
- def current_page
82
- params[:page].nil? ? 1 : params[:page].to_i
83
- end
84
- end
85
- end