thredded 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/thredded/application_controller.rb +9 -11
  3. data/app/controllers/thredded/emails_controller.rb +4 -0
  4. data/app/controllers/thredded/messageboards_controller.rb +1 -1
  5. data/app/controllers/thredded/posts_controller.rb +44 -48
  6. data/app/controllers/thredded/preferences_controller.rb +10 -2
  7. data/app/controllers/thredded/private_topics_controller.rb +18 -1
  8. data/app/controllers/thredded/setups_controller.rb +9 -4
  9. data/app/controllers/thredded/topics_controller.rb +47 -49
  10. data/app/decorators/thredded/post_decorator.rb +1 -1
  11. data/app/decorators/thredded/topic_decorator.rb +1 -9
  12. data/app/decorators/thredded/user_topic_decorator.rb +88 -0
  13. data/app/helpers/thredded/messageboard_helper.rb +1 -9
  14. data/app/helpers/thredded/topics_helper.rb +0 -17
  15. data/app/models/thredded/ability.rb +8 -0
  16. data/app/models/thredded/attachment.rb +0 -1
  17. data/app/models/thredded/category.rb +2 -3
  18. data/app/models/thredded/image.rb +0 -1
  19. data/app/models/thredded/messageboard.rb +15 -7
  20. data/app/models/thredded/messageboard_decorator.rb +2 -2
  21. data/app/models/thredded/messageboard_preference.rb +0 -1
  22. data/app/models/thredded/null_messageboard_preference.rb +7 -0
  23. data/app/models/thredded/null_preference.rb +8 -6
  24. data/app/models/thredded/null_topic_read.rb +15 -9
  25. data/app/models/thredded/null_user.rb +8 -0
  26. data/app/models/thredded/post.rb +13 -17
  27. data/app/models/thredded/post_notification.rb +0 -1
  28. data/app/models/thredded/private_topic.rb +11 -2
  29. data/app/models/thredded/private_user.rb +0 -1
  30. data/app/models/thredded/role.rb +0 -2
  31. data/app/models/thredded/topic.rb +27 -23
  32. data/app/models/thredded/topic_category.rb +0 -1
  33. data/app/models/thredded/user_extender.rb +2 -8
  34. data/app/models/thredded/user_topic_read.rb +5 -63
  35. data/app/views/thredded/attachments/_attachment.html.erb +7 -0
  36. data/app/views/thredded/messageboards/_messageboard.html.erb +1 -1
  37. data/app/views/thredded/post_mailer/at_notification.html.erb +1 -1
  38. data/app/views/thredded/post_mailer/at_notification.text.erb +1 -1
  39. data/app/views/thredded/posts/_post.html.erb +6 -2
  40. data/app/views/thredded/posts/index.html.erb +24 -37
  41. data/app/views/thredded/private_topics/_form.html.erb +15 -0
  42. data/app/views/thredded/private_topics/index.html.erb +33 -0
  43. data/app/views/thredded/private_topics/new.html.erb +24 -0
  44. data/app/views/thredded/shared/_currently_online.html.erb +2 -2
  45. data/app/views/thredded/shared/_topic_nav.html.erb +13 -10
  46. data/app/views/thredded/topic_mailer/message_notification.html.erb +1 -1
  47. data/app/views/thredded/topic_mailer/message_notification.text.erb +1 -1
  48. data/app/views/thredded/topics/_recent_topics_by_user.html.erb +8 -0
  49. data/app/views/thredded/topics/_topic_condensed.html.erb +6 -2
  50. data/app/views/thredded/topics/index.html.erb +5 -26
  51. data/app/views/thredded/topics/new.html.erb +1 -1
  52. data/app/views/thredded/topics/search.html.erb +6 -21
  53. data/config/initializers/griddler.rb +4 -0
  54. data/config/routes.rb +8 -5
  55. data/db/migrate/20131005032727_prevent_null_sticky_and_locked.rb +15 -0
  56. data/db/migrate/20131014014258_uniqs_on_user_topic_read.rb +9 -0
  57. data/db/migrate/20131019014258_index_necessary_columns.rb +24 -0
  58. data/lib/thredded.rb +3 -0
  59. data/lib/thredded/at_notifier.rb +4 -2
  60. data/lib/thredded/at_users.rb +2 -2
  61. data/lib/thredded/email_processor.rb +57 -55
  62. data/lib/thredded/engine.rb +1 -1
  63. data/lib/thredded/errors.rb +8 -0
  64. data/lib/thredded/post_sql_builder.rb +3 -3
  65. data/lib/thredded/post_user_permissions.rb +4 -0
  66. data/lib/thredded/private_topic_user_permissions.rb +7 -1
  67. data/lib/thredded/search_sql_builder.rb +1 -1
  68. data/lib/thredded/table_sql_builder.rb +1 -1
  69. data/lib/thredded/version.rb +1 -1
  70. metadata +21 -35
@@ -10,7 +10,7 @@ module Thredded
10
10
  g.helper false
11
11
  end
12
12
 
13
- config.after_initialize do
13
+ config.to_prepare do
14
14
  Thredded.user_class.send(:include, Thredded::UserExtender)
15
15
  end
16
16
  end
@@ -0,0 +1,8 @@
1
+ module Thredded
2
+ class Error < StandardError
3
+ end
4
+
5
+ module Errors
6
+ class TopicNotFound < Thredded::Error; end
7
+ end
8
+ end
@@ -3,7 +3,7 @@ module Thredded
3
3
  def build_text_search
4
4
  if text.present?
5
5
  search_text = text
6
- add_from('posts p')
6
+ add_from('thredded_posts p')
7
7
  add_where('t.id = p.topic_id')
8
8
  add_where("to_tsvector('english', p.content) @@ plainto_tsquery('english', ?)", search_text.uniq.join(' '))
9
9
 
@@ -17,7 +17,7 @@ module Thredded
17
17
 
18
18
  def build_in_category
19
19
  if categories.present?
20
- add_from('topic_categories tc')
20
+ add_from('thredded_topic_categories tc')
21
21
  add_where('tc.topic_id = t.id')
22
22
  add_where('tc.category_id in (?)', categories)
23
23
  end
@@ -25,7 +25,7 @@ module Thredded
25
25
 
26
26
  def build_by_user
27
27
  if users.present?
28
- add_from 'posts p'
28
+ add_from 'thredded_posts p'
29
29
  add_where('t.id = p.topic_id')
30
30
  add_where('p.user_id in (?)', users)
31
31
  end
@@ -10,6 +10,10 @@ module Thredded
10
10
  @user_details = user_details || UserDetail.new
11
11
  end
12
12
 
13
+ def editable?
14
+ created_post? || messageboard.member_is_a?(user, 'admin')
15
+ end
16
+
13
17
  def manageable?
14
18
  created_post?
15
19
  end
@@ -9,6 +9,12 @@ module Thredded
9
9
  @user_details = user_details || UserDetail.new
10
10
  end
11
11
 
12
+ def listable?
13
+ if user.thredded_private_topics
14
+ user.thredded_private_topics.for_user(user).any?
15
+ end
16
+ end
17
+
12
18
  def manageable?
13
19
  user_started_topic?
14
20
  end
@@ -19,7 +25,7 @@ module Thredded
19
25
 
20
26
  def creatable?
21
27
  TopicUserPermissions
22
- .new(private_topic, user, user_details).creatable?
28
+ .new(private_topic, user, user_details).creatable?
23
29
  end
24
30
 
25
31
  private
@@ -11,7 +11,7 @@ module Thredded
11
11
 
12
12
  def build
13
13
  [
14
- 'SELECT * FROM topics WHERE id IN (', @post_builder.sql,
14
+ 'SELECT * FROM thredded_topics WHERE id IN (', @post_builder.sql,
15
15
  'UNION', @topic_builder.sql,
16
16
  ')', @order_by,
17
17
  'LIMIT 50'
@@ -8,7 +8,7 @@ module Thredded
8
8
  @terms = SearchParser.new(query).parse
9
9
 
10
10
  @select = 'SELECT t.id'
11
- @from = 'FROM topics t'
11
+ @from = 'FROM thredded_topics t'
12
12
  @where = ['t.messageboard_id = ?']
13
13
  @binds = [messageboard.id]
14
14
 
@@ -1,3 +1,3 @@
1
1
  module Thredded
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.3'
3
3
  end
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.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2013-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: RedCloth
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: client_side_validations
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: escape_utils
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -164,20 +150,6 @@ dependencies:
164
150
  - - '>='
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: jquery-rails
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :runtime
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - '>='
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
153
  - !ruby/object:Gem::Dependency
182
154
  name: kaminari
183
155
  requirement: !ruby/object:Gem::Requirement
@@ -252,16 +224,16 @@ dependencies:
252
224
  name: rails
253
225
  requirement: !ruby/object:Gem::Requirement
254
226
  requirements:
255
- - - ~>
227
+ - - '>='
256
228
  - !ruby/object:Gem::Version
257
- version: '3.2'
229
+ version: '4.0'
258
230
  type: :runtime
259
231
  prerelease: false
260
232
  version_requirements: !ruby/object:Gem::Requirement
261
233
  requirements:
262
- - - ~>
234
+ - - '>='
263
235
  - !ruby/object:Gem::Version
264
- version: '3.2'
236
+ version: '4.0'
265
237
  - !ruby/object:Gem::Dependency
266
238
  name: rails_emoji
267
239
  requirement: !ruby/object:Gem::Requirement
@@ -412,6 +384,7 @@ files:
412
384
  - app/assets/javascripts/thredded/application.js
413
385
  - app/assets/stylesheets/thredded/application.css
414
386
  - app/controllers/thredded/application_controller.rb
387
+ - app/controllers/thredded/emails_controller.rb
415
388
  - app/controllers/thredded/messageboards_controller.rb
416
389
  - app/controllers/thredded/posts_controller.rb
417
390
  - app/controllers/thredded/preferences_controller.rb
@@ -420,6 +393,7 @@ files:
420
393
  - app/controllers/thredded/topics_controller.rb
421
394
  - app/decorators/thredded/post_decorator.rb
422
395
  - app/decorators/thredded/topic_decorator.rb
396
+ - app/decorators/thredded/user_topic_decorator.rb
423
397
  - app/helpers/thredded/application_helper.rb
424
398
  - app/helpers/thredded/messageboard_helper.rb
425
399
  - app/helpers/thredded/posts_helper.rb
@@ -433,6 +407,7 @@ files:
433
407
  - app/models/thredded/messageboard.rb
434
408
  - app/models/thredded/messageboard_decorator.rb
435
409
  - app/models/thredded/messageboard_preference.rb
410
+ - app/models/thredded/null_messageboard_preference.rb
436
411
  - app/models/thredded/null_preference.rb
437
412
  - app/models/thredded/null_topic_read.rb
438
413
  - app/models/thredded/null_user.rb
@@ -449,6 +424,7 @@ files:
449
424
  - app/models/thredded/user_topic_read.rb
450
425
  - app/uploaders/thredded/attachment_uploader.rb
451
426
  - app/uploaders/thredded/image_uploader.rb
427
+ - app/views/thredded/attachments/_attachment.html.erb
452
428
  - app/views/thredded/messageboards/_messageboard.html.erb
453
429
  - app/views/thredded/messageboards/index.html.erb
454
430
  - app/views/thredded/post_mailer/at_notification.html.erb
@@ -460,6 +436,9 @@ files:
460
436
  - app/views/thredded/posts/edit.html.erb
461
437
  - app/views/thredded/posts/index.html.erb
462
438
  - app/views/thredded/preferences/edit.html.erb
439
+ - app/views/thredded/private_topics/_form.html.erb
440
+ - app/views/thredded/private_topics/index.html.erb
441
+ - app/views/thredded/private_topics/new.html.erb
463
442
  - app/views/thredded/search/_form.html.erb
464
443
  - app/views/thredded/setups/_form.html.erb
465
444
  - app/views/thredded/setups/new.html.erb
@@ -470,6 +449,7 @@ files:
470
449
  - app/views/thredded/topic_mailer/message_notification.html.erb
471
450
  - app/views/thredded/topic_mailer/message_notification.text.erb
472
451
  - app/views/thredded/topics/_form.html.erb
452
+ - app/views/thredded/topics/_recent_topics_by_user.html.erb
473
453
  - app/views/thredded/topics/_topic_condensed.html.erb
474
454
  - app/views/thredded/topics/_topic_form.html.erb
475
455
  - app/views/thredded/topics/by_category.html.erb
@@ -478,14 +458,19 @@ files:
478
458
  - app/views/thredded/topics/menu/_new_topic.html.erb
479
459
  - app/views/thredded/topics/new.html.erb
480
460
  - app/views/thredded/topics/search.html.erb
461
+ - config/initializers/griddler.rb
481
462
  - config/routes.rb
482
463
  - db/migrate/20130425230852_create_thredded_tables.rb
464
+ - db/migrate/20131005032727_prevent_null_sticky_and_locked.rb
465
+ - db/migrate/20131014014258_uniqs_on_user_topic_read.rb
466
+ - db/migrate/20131019014258_index_necessary_columns.rb
483
467
  - lib/tasks/thredded_tasks.rake
484
468
  - lib/thredded/at_notification_extractor.rb
485
469
  - lib/thredded/at_notifier.rb
486
470
  - lib/thredded/at_users.rb
487
471
  - lib/thredded/email_processor.rb
488
472
  - lib/thredded/engine.rb
473
+ - lib/thredded/errors.rb
489
474
  - lib/thredded/filter/at_notification.rb
490
475
  - lib/thredded/filter/attachment.rb
491
476
  - lib/thredded/filter/base.rb
@@ -512,7 +497,8 @@ files:
512
497
  - Rakefile
513
498
  - README.mkdn
514
499
  homepage: https://www.thredded.com
515
- licenses: []
500
+ licenses:
501
+ - MIT
516
502
  metadata: {}
517
503
  post_install_message:
518
504
  rdoc_options: []