commontator 5.1.0 → 6.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/README.md +83 -63
- data/app/assets/javascripts/commontator/mentions.js +2 -2
- data/app/assets/stylesheets/commontator/application.scss +101 -0
- data/app/assets/stylesheets/commontator/comments.scss +103 -0
- data/app/controllers/commontator/application_controller.rb +21 -21
- data/app/controllers/commontator/comments_controller.rb +123 -114
- data/app/controllers/commontator/security_transgression.rb +2 -0
- data/app/controllers/commontator/subscriptions_controller.rb +20 -22
- data/app/controllers/commontator/threads_controller.rb +50 -50
- data/app/helpers/commontator/application_helper.rb +3 -5
- data/app/helpers/commontator/link_renderer.rb +25 -0
- data/app/mailers/commontator/subscriptions_mailer.rb +35 -35
- data/app/models/commontator/comment.rb +208 -91
- data/app/models/commontator/json_array_coder.rb +10 -0
- data/app/models/commontator/subscription.rb +13 -16
- data/app/models/commontator/thread.rb +139 -133
- data/app/views/commontator/comments/_actions.html.erb +9 -10
- data/app/views/commontator/comments/_body.html.erb +11 -6
- data/app/views/commontator/comments/_form.html.erb +31 -20
- data/app/views/commontator/comments/_list.html.erb +6 -5
- data/app/views/commontator/comments/_reply.html.erb +15 -0
- data/app/views/commontator/comments/_show.html.erb +31 -25
- data/app/views/commontator/comments/_votes.html.erb +12 -11
- data/app/views/commontator/comments/cancel.js.erb +6 -14
- data/app/views/commontator/comments/create.js.erb +20 -14
- data/app/views/commontator/comments/delete.js.erb +14 -14
- data/app/views/commontator/comments/edit.js.erb +6 -4
- data/app/views/commontator/comments/new.js.erb +11 -7
- data/app/views/commontator/comments/update.js.erb +6 -4
- data/app/views/commontator/comments/vote.js.erb +3 -4
- data/app/views/commontator/shared/_thread.html.erb +23 -11
- data/app/views/commontator/subscriptions/_link.html.erb +7 -8
- data/app/views/commontator/subscriptions/subscribe.js.erb +3 -4
- data/app/views/commontator/subscriptions_mailer/comment_created.html.erb +9 -8
- data/app/views/commontator/threads/_hide_show_links.js.erb +10 -9
- data/app/views/commontator/threads/_reply.html.erb +17 -16
- data/app/views/commontator/threads/_show.html.erb +75 -76
- data/app/views/commontator/threads/_show.js.erb +12 -16
- data/app/views/commontator/threads/show.js.erb +9 -6
- data/config/initializers/commontator.rb +81 -67
- data/config/locales/de.yml +28 -48
- data/config/locales/en.yml +38 -27
- data/config/locales/pt-BR.yml +31 -29
- data/config/locales/ru.yml +34 -29
- data/config/locales/zh.yml +65 -48
- data/db/migrate/0_install_commontator.rb +27 -32
- data/db/migrate/1_add_replying_to_comments.rb +9 -0
- data/lib/commontator.rb +9 -140
- data/lib/commontator/acts_as_commontable.rb +24 -33
- data/lib/commontator/acts_as_commontator.rb +28 -25
- data/lib/commontator/build_thread.rb +10 -0
- data/lib/commontator/commontable_config.rb +10 -10
- data/lib/commontator/commontator_config.rb +10 -10
- data/lib/{commontator.rb~ → commontator/config.rb} +57 -57
- data/lib/commontator/controllers.rb +35 -29
- data/lib/commontator/engine.rb +6 -4
- data/lib/commontator/shared_helper.rb +58 -21
- data/lib/commontator/version.rb +1 -3
- data/lib/tasks/commontator_tasks.rake +2 -2
- data/vendor/assets/stylesheets/mentionsInput/jquery.mentionsInput.css +0 -1
- metadata +50 -496
- data/Rakefile +0 -22
- data/app/assets/javascripts/commontator/application.js~ +0 -3
- data/app/assets/javascripts/commontator/mentions.js~ +0 -31
- data/app/assets/stylesheets/commontator/application.css +0 -5
- data/app/assets/stylesheets/commontator/application.css~ +0 -14
- data/app/assets/stylesheets/commontator/comments.css +0 -121
- data/app/assets/stylesheets/commontator/threads.css +0 -71
- data/app/assets/stylesheets/commontator/threads.css~ +0 -71
- data/app/controllers/commontator/comments_controller.rb~ +0 -160
- data/app/controllers/commontator/threads_controller.rb~ +0 -75
- data/app/mailers/commontator/subscriptions_mailer.rb~ +0 -65
- data/app/models/commontator/comment.rb~ +0 -124
- data/app/models/commontator/subscription.rb~ +0 -23
- data/app/views/commontator/shared/_thread.html.erb~ +0 -21
- data/app/views/commontator/subscriptions_mailer/comment_created.html.erb~ +0 -10
- data/app/views/commontator/threads/_hide_show.js.erb~ +0 -21
- data/app/views/commontator/threads/_hide_show_links.js.erb~ +0 -17
- data/app/views/commontator/threads/_show.html.erb~ +0 -118
- data/app/views/commontator/threads/_show.js.erb~ +0 -18
- data/config/initializers/commontator.rb~ +0 -290
- data/config/locales/en.yml~ +0 -101
- data/config/locales/ru.yml~ +0 -79
- data/config/locales/zh.yml~ +0 -79
- data/config/routes.rb~ +0 -25
- data/db/migrate/0_install_commontator.rb~ +0 -52
- data/db/migrate/1_add_parent_comment_id_to_commontator_comments.rb~ +0 -9
- data/lib/commontator/link_renderer.rb +0 -28
- data/lib/commontator/security_transgression.rb +0 -4
- data/lib/commontator/shared_helper.rb~ +0 -26
- data/lib/commontator/version.rb~ +0 -3
- data/spec/controllers/commontator/comments_controller_spec.rb +0 -613
- data/spec/controllers/commontator/comments_controller_spec.rb~ +0 -612
- data/spec/controllers/commontator/subscriptions_controller_spec.rb +0 -101
- data/spec/controllers/commontator/subscriptions_controller_spec.rb~ +0 -101
- data/spec/controllers/commontator/threads_controller_spec.rb +0 -219
- data/spec/controllers/commontator/threads_controller_spec.rb~ +0 -218
- data/spec/dummy/README.md +0 -4
- data/spec/dummy/README.md~ +0 -3
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/Rakefile~ +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -17
- data/spec/dummy/app/assets/javascripts/application.js~ +0 -16
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/assets/stylesheets/application.css~ +0 -14
- data/spec/dummy/app/controllers/application_controller.rb +0 -6
- data/spec/dummy/app/controllers/application_controller.rb~ +0 -4
- data/spec/dummy/app/controllers/dummy_models_controller.rb +0 -23
- data/spec/dummy/app/controllers/dummy_models_controller.rb~ +0 -23
- data/spec/dummy/app/helpers/application_helper.rb +0 -16
- data/spec/dummy/app/helpers/application_helper.rb~ +0 -15
- data/spec/dummy/app/models/dummy_dependent_model.rb +0 -4
- data/spec/dummy/app/models/dummy_model.rb +0 -4
- data/spec/dummy/app/models/dummy_model.rb~ +0 -3
- data/spec/dummy/app/models/dummy_user.rb +0 -14
- data/spec/dummy/app/models/dummy_user.rb~ +0 -13
- data/spec/dummy/app/views/dummy_models/index.html.erb~ +0 -6
- data/spec/dummy/app/views/dummy_models/show.html.erb +0 -2
- data/spec/dummy/app/views/dummy_models/show.html.erb~ +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/app/views/layouts/application.html.erb~ +0 -14
- data/spec/dummy/config.ru +0 -5
- data/spec/dummy/config.ru~ +0 -4
- data/spec/dummy/config/application.rb +0 -27
- data/spec/dummy/config/application.rb~ +0 -26
- data/spec/dummy/config/boot.rb +0 -6
- data/spec/dummy/config/boot.rb~ +0 -5
- data/spec/dummy/config/database.yml +0 -26
- data/spec/dummy/config/database.yml~ +0 -25
- data/spec/dummy/config/environment.rb +0 -8
- data/spec/dummy/config/environment.rb~ +0 -8
- data/spec/dummy/config/environments/development.rb +0 -31
- data/spec/dummy/config/environments/development.rb~ +0 -31
- data/spec/dummy/config/environments/production.rb +0 -82
- data/spec/dummy/config/environments/production.rb~ +0 -82
- data/spec/dummy/config/environments/test.rb +0 -40
- data/spec/dummy/config/environments/test.rb~ +0 -40
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/spec/dummy/config/initializers/backtrace_silencers.rb~ +0 -7
- data/spec/dummy/config/initializers/commontator.rb +0 -20
- data/spec/dummy/config/initializers/commontator.rb~ +0 -21
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb~ +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -17
- data/spec/dummy/config/initializers/inflections.rb~ +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -6
- data/spec/dummy/config/initializers/mime_types.rb~ +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -13
- data/spec/dummy/config/initializers/secret_token.rb~ +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb~ +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -15
- data/spec/dummy/config/initializers/wrap_parameters.rb~ +0 -14
- data/spec/dummy/config/routes.rb +0 -9
- data/spec/dummy/config/routes.rb~ +0 -10
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/1_create_dummy_models.rb +0 -7
- data/spec/dummy/db/migrate/1_create_dummy_models.rb~ +0 -7
- data/spec/dummy/db/migrate/2_create_dummy_users.rb +0 -7
- data/spec/dummy/db/migrate/2_create_dummy_users.rb~ +0 -7
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +0 -22
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb~ +0 -27
- data/spec/dummy/db/migrate/4_create_dummy_dependent_models.rb +0 -7
- data/spec/dummy/db/schema.rb +0 -85
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/controllers.rb~ +0 -10
- data/spec/dummy/lib/dummy_controllers.rb +0 -10
- data/spec/dummy/log/development.log +0 -6693
- data/spec/dummy/log/test.log +0 -125970
- data/spec/dummy/public/404.html +0 -27
- data/spec/dummy/public/404.html~ +0 -26
- data/spec/dummy/public/422.html +0 -27
- data/spec/dummy/public/422.html~ +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/500.html~ +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -7
- data/spec/dummy/script/rails~ +0 -6
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-RolHYhJdGiLoPkoWZXQdI9AIWUjMMCa2yFJezCE_Bo.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-STzK7UuGeY3gSvnmTELWLvtRMKpmSAQCEw4ao3b1r8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3NH8nN7uktAXgA3NqaqXTXDVic3BxBvqCxoLpGGbib4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4_iT7KM6P2IT75Rssrk9p4crTBwM8DQWR41gmsxczL0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/58TLCXvf5bFFYY-mIUXrQNOVWlGsq7qPAoSX2OIIB8Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6OQdyrATvNatvWu8Mp1qbuvRx-HLmzCZ5XBGYca-rZU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6UKCUV-ZLaWCoPMfMB6a2W0RCFPQzPJ6Mz-y67sH7zk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/6wKNjFdNd4OHjIpLC0nq1kBWcbYg1aEYrp7ZhWoJlvY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7Xxb5iYP5elo40JRlhNQB1gLbv3ueELK2rTinYt5xdc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/7twIKlS6VYCyLlwhsQg2vu4wLSUJsT2REHR4DjZf1oE.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/87m-4EcbQnkbo2HYkQp4V9I2U3AYQO1mPeReieduolA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8B331vt8qC4iXTcVzkx3j-ET8i1oaQskj5LyqGq8mPQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8KWvIOgvo7BVJYtdTpFuiSQQFFwZhLWYtwacZv52y48.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9yQa5M2ObK2-qDu231zMoarjVbhKUUg-ND3r2iXqB_Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/A-ffuUI2juZT6qFpTUwUR1P8OPWcyFFN26WSUZe60Ko.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/BbO4diS6uacx69Hn_bCabYlXEbWWdjHShRlfzlWSOMI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CXhqxaQQAQ8b0Y8y0jTQyiqsZ6Oe4fZn0YiacpJ9IoI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EmPkV3H8p2Snv9WyPjWran_kOMQ0MqQ1a9CVdGDd8l4.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Hc12Nxe7cw2e0u2pzNsAe8D3ncQpcqLuI2NVL7aAXgw.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/HdWuQr9W2mZvggsAxVjDgLYUNfg3rbI-T8KhaDIsvQk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/I7lsrHTKpbfLWqIqdDIx2RN_12yFL2PyLRyYsMxg1IU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JOCzfBjMjX3D5BUUGh5lJ7fjzMuJrHLxAginRA2_hZQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KAY1_IaTONtGr0KK8ihOdoA-RDXybqBMNSZLIDRHx68.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KBHIDNfa4ryw9LAkYqK8GgPWne7HkX6mNYgrJajGm94.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/L_lv02y00MmIFiFhg5c9zhl7CDHLSahehzLyi_mRZeY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MOT2X4iikR8v89A4N1bxDTeS1-xV8c9036TNFXmwXCM.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MiX2Z4Vbha1riozZWw1U3_PGttRiZ1iQ_o4wSZJnKCs.cache +0 -3
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MntKfwol0ud4LuvrX3MVPthTlfNlJZRYbQXpQBxhRrs.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/MrqmgPGNYJV1capJKIKJOVEQ4NiO-Z_2YhpjNteJ8B8.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/NVMnAwylzGp5bjl_o9dwMAQxVAPDzc4ygddNQSD1fiw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/O2sKqGxNuCYhjzuEZVC9hX_FeemOfRn_1-CCuHBQYyg.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Qy3TykLFmAt5jhSluMTaZaefcA5c_vfBRhQ7tin-gsk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/R3DpUgZ_hja1dQTIzumiP9AD_r8mlOaqv0U9QqnGQqo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RF07mgb06A30OcDWtCaDlM5tEc1yp0uAsk986Gqs5w8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TKV8dUTo88gdFY-z2I7Xa5vDC1Z3LY6Paa18385MJsI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UI4zPmWfZA2d_5ZZIXqK9KmkjOKSDg6JoM7qcOIxm0Q.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UP29vrIQbCkfghZGSCFxpW5gjlsgCxlVrncjjopvRqM.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/UoU16f4V7haEXM5GY5j4QFuNMP7PJZaAMEvVNNtNLBA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/VqPqYNG07yqcjbd7FA05Mu-jr5hzsZPaHFf8X0FFbXk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkN1QFvcuzXSsyNmfaK02ojXPk-8zmdEegzNPfdAEL4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/WkQX7Wiz41OKx2aGF7uffOmS04hIVZeGCondBAvwum8.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XMeYF1vwAg53eVjXVkw_IKQH2W3-9tWvtuCdqUCbPBM.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XX0Z7OM0xZKfQaAvHARpyeQNZCstNyu9MlsnwThSkg8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y-pGNFTA6bAKxSvqZvmMVs3b4Els1aByxZVFxtJR71c.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Y3p3m5V5NOm7yq56apKmF5KZUUsTfnhT_SG3fqbEJgo.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/YLZuRWklL6q-csC-7A7CiOTTTYEQcA9PCdWEOm9MpNU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Yo7V5YXukEBm6z37l-TIRCJx3HZExEUBu3MUMhAzkMU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bK6QttR8pGmMAMJO0avCBLwH0za8_bAC-yWqkU3Yj24.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/cLncjrqpQXzsVBp7K0W7iG1STLrnzfGpbJXxNE7aIUk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/dBcAd64EZFdhHZNXKGXPIR7EtPGf03bzqkci2W12T8g.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/d_bbPiareJHKkzFZFCl3pcwfQOFzsB1KHn4A2xxhR20.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/eaHZBuJRcawVlkGZVyyRr5_4xYKVOXbCqnTcmaNXzL0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gWnmfJty3jBn53qsJfOXKrWv4e8i3Dp80wVel-f1L1E.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/jKTlG9KP0iaCGHwg8kQ1amz9SHJ1OAWeCRRn9wc5w7c.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/kPJfTiWbmX-q6i2rjM9MAMdEf2silSihU0_lxlTGVA8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lrt1SWPj4qWUZUMH9xg3n9KLYUqJZxRn-XI-NTU6oTI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mcCP5u08nlCL6TgWdzzrem9uE2rbsbG3KyIXxvWvlJE.cache +0 -3
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pC4exGjkQLXXPE0O9hjX_2AJ4DASTFeB6RGjXagxEac.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/pIRh_Lq-ZhYC_XdRcqIsCtUkTnwVET0Wrrpw1EltHd8.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/qfXc71sDbi1cE9f327D6ABPURPU6lLguGiJqH2fqM0w.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rBcrkzXcMaiCjwvWl8tO0eARzKZS69I3i-lfsTAFzcc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sfl8l1_1AGn-4llkmb91Q0wHJ-A-x5gAGkIUWe1zLqo.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tFQc0MOeWpJ7t7cNP2GOzo7o9Z6YBgLEpdS0tGLvUSw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tb9v5OemP-ADEwYnETLLi1r088kZm_TMb9ZVeTV5JxI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/uKmWfbgaNZ8FTsVK1VNuUv15rmtTHzSdJ7TQRGr0Rck.cache +0 -2
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ul0QEoovfr_12YOpyWx8BJs8fvz5Ay3AZG8-lsLr-a4.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vY6eUgBIXKHqfU2ZroS-GugKPg5_fo2QBs-vS5gBN2o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/vrRc4DPAbHIJHJqsXfBYdyKUPFv8f8YYKJUrk-1zdVw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wTET4PQq7wlxzrgvNivPJad-CACkoQS4BNxAP0FQaR4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/wcvE87iLx7cDjMDs_Yu1jKYvep-VyLEyj1eXL79KLp4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQeZ92qbm2t9FaRck5xUakvNP-MJ2cs0RroN-fm0Tf8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xQz9WPf67Mu5uV4rNuOfU-y6_KWSlWcnTWrTvQPonKM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/xhYTRUOS8cIvyRp2Jn6FKnXlGOSsIM2z3HAGOJoJs7w.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/yLxMFI0ARh2OKSOQLF2xEfM7sbst2vUbOBXoOuI6iTE.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ynnYZxuxqerlFUytw54dl_CwP94g0U4HmGjyILWnhfQ.cache +0 -1
- data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zCivVPbSRpKF_X-P5OJeld32YhymG-bkjQwzqe2o6zg.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/02d4b791eb831cf2057bf4703a1218d1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a3fb9025f90ff05a6fd4afc7ded2692c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a41c8be5379abec3c0d0d98e2f0d5609 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c69ee3cc5796188d873574179290a6ef +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1f674c11941d62aac1764ef3a7134e4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e85565206c3e5fdf9dfeb367c85557b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/-gXoYfEJ-e9QQUbNRpNa-pwMCnTc7Eqvkq6Bosde6W8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/6iNAIrMKxHltOChiHQQf9VNsLQuj2rVKz6oqWnK7aSM.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/E1zaNOh68xzPxdtdOwRtOaMCoKivN2dxVwCP65WEi5I.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/HsNbq1o4RbrEWNL4zXVqFfUVnXXLK_y0F0BvddDre6g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/JusxTSXt06IqBm9jeCMM2nTmM3Wvbl3i3L1IwEvW5YA.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/L5DjABL_iOtoxSOLn3X7_YlxECU5EhnrVIKxJFAysgc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/PNc9TJUmRdGTSwgZvGlxKaIiJIkyoWtTPiGGWBqpHAE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/QkgTHa6nNs7XP6RPoV3yBbWWV-uo1u2-qxLuvLCFe_0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/S-6Iq5YOEpVnd_vQ0RSSfrmyIwB1dk0op35alFgJ9xA.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/Vuc93A9yywiFxc9CAdxrzdsAQw4jxiCa6JRzRjNxOYs.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/YAPBll4U0cgs6cz-WyMRKoakK_gVOOcl9n0CvGyxPjY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/bDNeZfPBQaef5z0YajZc4jFE54nNy9gc06mPNKvvPFk.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/c5Wa2loowFYFRBaMoTn1IWYXo4BGMbEy7NIi0vbvfRU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/dkn8MYu2ve_AJW6u0jjTlKrj1KBRqorOHQR0Obx2elU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/fZuAzt_-48u9C7ZXmsPgTraGDYtNC9B9zN-9-EnxJG4.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/gumo32Bd3W_q7MYEt9JIZEiQdHF93tLSsGfmXIm2MqU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ige85jXyj8X7XYr7HpA0gSTThqfPUm71HjhSJXtTbUY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/kuYeE5bV6FdXmfB_o-xhflhSDWoQhYYaaupAXODZ9dQ.cache +0 -1
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/qhZbbNIRUaAOtGano94zLHjeBKUhKr4qbh2tTCi0Bnk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/wJJbzdHJHP6tchng3HhfTwmjc5LursgX8yZkAjpO5UA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/xNL1WW-qU3EvV2iTSW6F4hAFRBsCYmFKJhLjgCZkOV8.cache +0 -2
- data/spec/dummy/tmp/cache/assets/test/sprockets/v3.0/ytHkF2DwUE6oaiLyrK6tL-0INpeNhjN6ctD7J0LNY6I.cache +0 -2
- data/spec/helpers/commontator/application_helper_spec.rb +0 -10
- data/spec/helpers/commontator/application_helper_spec.rb~ +0 -9
- data/spec/lib/commontator/acts_as_commontable_spec.rb +0 -25
- data/spec/lib/commontator/acts_as_commontable_spec.rb~ +0 -25
- data/spec/lib/commontator/acts_as_commontator_spec.rb +0 -26
- data/spec/lib/commontator/acts_as_commontator_spec.rb~ +0 -52
- data/spec/lib/commontator/commontable_config_spec.rb +0 -28
- data/spec/lib/commontator/commontable_config_spec.rb~ +0 -29
- data/spec/lib/commontator/commontator_config_spec.rb +0 -28
- data/spec/lib/commontator/commontator_config_spec.rb~ +0 -29
- data/spec/lib/commontator/controller_includes_spec.rb~ +0 -18
- data/spec/lib/commontator/controllers_spec.rb +0 -18
- data/spec/lib/commontator/controllers_spec.rb~ +0 -18
- data/spec/lib/commontator/shared_helper_spec.rb +0 -21
- data/spec/lib/commontator/shared_helper_spec.rb~ +0 -22
- data/spec/lib/commontator_spec.rb +0 -25
- data/spec/lib/commontator_spec.rb~ +0 -26
- data/spec/mailers/commontator/subscriptions_mailer_spec.rb +0 -49
- data/spec/mailers/commontator/subscriptions_mailer_spec.rb~ +0 -30
- data/spec/models/commontator/comment_spec.rb +0 -82
- data/spec/models/commontator/comment_spec.rb~ +0 -82
- data/spec/models/commontator/subscription_spec.rb +0 -38
- data/spec/models/commontator/subscription_spec.rb~ +0 -38
- data/spec/models/commontator/thread_spec.rb +0 -159
- data/spec/models/commontator/thread_spec.rb~ +0 -122
- data/spec/rails_helper.rb +0 -72
- data/spec/rails_helper.rb~ +0 -74
- data/spec/spec_helper.rb +0 -94
- data/spec/spec_helper.rb~ +0 -93
- data/vendor/assets/javascripts/mentionsInput/index.js~ +0 -3
@@ -1,29 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
before_action :set_user, :ensure_user
|
1
|
+
class Commontator::ApplicationController < ActionController::Base
|
2
|
+
before_action :commontator_set_user, :ensure_user
|
4
3
|
|
5
|
-
|
4
|
+
rescue_from Commontator::SecurityTransgression, with: -> { head(:forbidden) }
|
6
5
|
|
7
|
-
|
6
|
+
helper Commontator::ApplicationHelper
|
8
7
|
|
9
|
-
|
10
|
-
raise SecurityTransgression unless check
|
11
|
-
end
|
8
|
+
protected
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
def security_transgression_unless(check)
|
11
|
+
raise Commontator::SecurityTransgression unless check
|
12
|
+
end
|
13
|
+
|
14
|
+
def ensure_user
|
15
|
+
security_transgression_unless(@commontator_user && @commontator_user.is_commontator)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def set_thread
|
19
|
+
@commontator_thread = params[:thread_id].blank? ?
|
20
|
+
Commontator::Thread.find(params[:id]) :
|
21
|
+
Commontator::Thread.find(params[:thread_id])
|
22
|
+
|
23
|
+
security_transgression_unless @commontator_thread.can_be_read_by? @commontator_user
|
24
|
+
end
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
Commontator::Thread.find(params[:id]) : \
|
24
|
-
Commontator::Thread.find(params[:thread_id])
|
25
|
-
security_transgression_unless @thread.can_be_read_by? @user
|
26
|
-
commontator_set_new_comment(@thread, @user)
|
27
|
-
end
|
26
|
+
def commontable_url
|
27
|
+
main_app.polymorphic_url(@commontator_thread.commontable)
|
28
28
|
end
|
29
29
|
end
|
@@ -1,159 +1,168 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
class Commontator::CommentsController < Commontator::ApplicationController
|
2
|
+
before_action :set_thread, :commontator_set_thread_variables, only: [ :new, :create ]
|
3
|
+
before_action :set_comment_and_thread, except: [ :new, :create ]
|
4
|
+
|
5
|
+
# GET /threads/1/comments/new
|
6
|
+
def new
|
7
|
+
@comment = Commontator::Comment.new(thread: @commontator_thread, creator: @commontator_user)
|
8
|
+
parent_id = params.dig(:comment, :parent_id)
|
9
|
+
unless parent_id.blank?
|
10
|
+
parent = Commontator::Comment.find parent_id
|
11
|
+
@comment.parent = parent
|
12
|
+
@comment.body = "<blockquote><span class=\"author\">#{
|
13
|
+
Commontator.commontator_name(parent.creator)
|
14
|
+
}</span>\n#{
|
15
|
+
parent.body
|
16
|
+
}\n</blockquote>\n" if @commontator_thread.config.comment_reply_style == :q
|
17
|
+
end
|
18
|
+
security_transgression_unless @comment.can_be_created_by?(@commontator_user)
|
19
19
|
|
20
|
+
respond_to do |format|
|
21
|
+
format.html { redirect_to commontable_url }
|
22
|
+
format.js
|
20
23
|
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# POST /threads/1/comments
|
27
|
+
def create
|
28
|
+
@comment = Commontator::Comment.new(
|
29
|
+
thread: @commontator_thread, creator: @commontator_user, body: params.dig(:comment, :body)
|
30
|
+
)
|
31
|
+
parent_id = params.dig(:comment, :parent_id)
|
32
|
+
@comment.parent = Commontator::Comment.find(parent_id) unless parent_id.blank?
|
33
|
+
security_transgression_unless @comment.can_be_created_by?(@commontator_user)
|
34
|
+
|
35
|
+
respond_to do |format|
|
36
|
+
if params[:cancel].blank?
|
37
|
+
if @comment.save
|
38
|
+
sub = @commontator_thread.config.thread_subscription.to_sym
|
39
|
+
@commontator_thread.subscribe(@commontator_user) if sub == :a || sub == :b
|
40
|
+
subscribe_mentioned if @commontator_thread.config.mentions_enabled
|
41
|
+
Commontator::Subscription.comment_created(@comment)
|
21
42
|
|
22
|
-
# POST /threads/1/comments
|
23
|
-
def create
|
24
|
-
@comment = Comment.new
|
25
|
-
@comment.thread = @thread
|
26
|
-
@comment.creator = @user
|
27
|
-
@comment.body = params[:comment].nil? ? nil : params[:comment][:body]
|
28
|
-
security_transgression_unless @comment.can_be_created_by?(@user)
|
29
|
-
subscribe_mentioned if Commontator.mentions_enabled
|
30
|
-
|
31
|
-
respond_to do |format|
|
32
|
-
if !params[:cancel].nil?
|
33
|
-
format.html { redirect_to @thread }
|
34
|
-
format.js { render :cancel }
|
35
|
-
elsif @comment.save
|
36
|
-
sub = @thread.config.thread_subscription.to_sym
|
37
|
-
@thread.subscribe(@user) if sub == :a || sub == :b
|
38
|
-
Subscription.comment_created(@comment)
|
39
|
-
|
40
|
-
@per_page = params[:per_page] || @thread.config.comments_per_page
|
41
|
-
|
42
|
-
format.html { redirect_to @thread }
|
43
43
|
format.js
|
44
44
|
else
|
45
|
-
format.html { redirect_to @thread }
|
46
45
|
format.js { render :new }
|
47
46
|
end
|
47
|
+
else
|
48
|
+
format.js { render :cancel }
|
48
49
|
end
|
50
|
+
|
51
|
+
format.html { redirect_to commontable_url }
|
49
52
|
end
|
53
|
+
end
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
|
55
|
+
# GET /comments/1/edit
|
56
|
+
def edit
|
57
|
+
@comment.editor = @commontator_user
|
58
|
+
security_transgression_unless @comment.can_be_edited_by?(@commontator_user)
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
60
|
+
respond_to do |format|
|
61
|
+
format.html { redirect_to commontable_url }
|
62
|
+
format.js
|
59
63
|
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# PUT /comments/1
|
67
|
+
def update
|
68
|
+
@comment.editor = @commontator_user
|
69
|
+
@comment.body = params.dig(:comment, :body)
|
70
|
+
security_transgression_unless @comment.can_be_edited_by?(@commontator_user)
|
71
|
+
|
72
|
+
respond_to do |format|
|
73
|
+
if params[:cancel].blank?
|
74
|
+
if @comment.save
|
75
|
+
subscribe_mentioned if @commontator_thread.config.mentions_enabled
|
60
76
|
|
61
|
-
# PUT /comments/1
|
62
|
-
def update
|
63
|
-
security_transgression_unless @comment.can_be_edited_by?(@user)
|
64
|
-
@comment.body = params[:comment].nil? ? nil : params[:comment][:body]
|
65
|
-
@comment.editor = @user
|
66
|
-
subscribe_mentioned if Commontator.mentions_enabled
|
67
|
-
|
68
|
-
respond_to do |format|
|
69
|
-
if !params[:cancel].nil?
|
70
|
-
format.html { redirect_to @thread }
|
71
|
-
format.js { render :cancel }
|
72
|
-
elsif @comment.save
|
73
|
-
format.html { redirect_to @thread }
|
74
77
|
format.js
|
75
78
|
else
|
76
|
-
format.html { redirect_to @thread }
|
77
79
|
format.js { render :edit }
|
78
80
|
end
|
81
|
+
else
|
82
|
+
@comment.restore_attributes
|
83
|
+
|
84
|
+
format.js { render :cancel }
|
79
85
|
end
|
86
|
+
|
87
|
+
format.html { redirect_to commontable_url }
|
80
88
|
end
|
89
|
+
end
|
81
90
|
|
82
|
-
|
83
|
-
|
84
|
-
|
91
|
+
# PUT /comments/1/delete
|
92
|
+
def delete
|
93
|
+
security_transgression_unless @comment.can_be_deleted_by?(@commontator_user)
|
85
94
|
|
86
|
-
|
87
|
-
|
95
|
+
@comment.errors.add(:base, t('commontator.comment.errors.already_deleted')) \
|
96
|
+
unless @comment.delete_by(@commontator_user)
|
88
97
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
98
|
+
respond_to do |format|
|
99
|
+
format.html { redirect_to commontable_url }
|
100
|
+
format.js { render :delete }
|
93
101
|
end
|
102
|
+
end
|
94
103
|
|
95
|
-
|
96
|
-
|
97
|
-
|
104
|
+
# PUT /comments/1/undelete
|
105
|
+
def undelete
|
106
|
+
security_transgression_unless @comment.can_be_deleted_by?(@commontator_user)
|
98
107
|
|
99
|
-
|
100
|
-
|
108
|
+
@comment.errors.add(:base, t('commontator.comment.errors.not_deleted')) \
|
109
|
+
unless @comment.undelete_by(@commontator_user)
|
101
110
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
111
|
+
respond_to do |format|
|
112
|
+
format.html { redirect_to commontable_url }
|
113
|
+
format.js { render :delete }
|
106
114
|
end
|
115
|
+
end
|
107
116
|
|
108
|
-
|
109
|
-
|
110
|
-
|
117
|
+
# PUT /comments/1/upvote
|
118
|
+
def upvote
|
119
|
+
security_transgression_unless @comment.can_be_voted_on_by?(@commontator_user)
|
111
120
|
|
112
|
-
|
121
|
+
@comment.upvote_from @commontator_user
|
113
122
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
123
|
+
respond_to do |format|
|
124
|
+
format.html { redirect_to commontable_url }
|
125
|
+
format.js { render :vote }
|
118
126
|
end
|
127
|
+
end
|
119
128
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
129
|
+
# PUT /comments/1/downvote
|
130
|
+
def downvote
|
131
|
+
security_transgression_unless @comment.can_be_voted_on_by?(@commontator_user) &&\
|
132
|
+
@comment.thread.config.comment_voting.to_sym == :ld
|
124
133
|
|
125
|
-
|
134
|
+
@comment.downvote_from @commontator_user
|
126
135
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
136
|
+
respond_to do |format|
|
137
|
+
format.html { redirect_to commontable_url }
|
138
|
+
format.js { render :vote }
|
131
139
|
end
|
140
|
+
end
|
132
141
|
|
133
|
-
|
134
|
-
|
135
|
-
|
142
|
+
# PUT /comments/1/unvote
|
143
|
+
def unvote
|
144
|
+
security_transgression_unless @comment.can_be_voted_on_by?(@commontator_user)
|
136
145
|
|
137
|
-
|
146
|
+
@comment.unvote voter: @commontator_user
|
138
147
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
end
|
148
|
+
respond_to do |format|
|
149
|
+
format.html { redirect_to commontable_url }
|
150
|
+
format.js { render :vote }
|
143
151
|
end
|
152
|
+
end
|
144
153
|
|
145
|
-
|
154
|
+
protected
|
146
155
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
156
|
+
def set_comment_and_thread
|
157
|
+
@comment = Commontator::Comment.find(params[:id])
|
158
|
+
@commontator_thread = @comment.thread
|
159
|
+
commontator_set_new_comment
|
160
|
+
end
|
152
161
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
162
|
+
def subscribe_mentioned
|
163
|
+
Commontator.commontator_mentions(@commontator_user, @commontator_thread, '')
|
164
|
+
.where(id: params[:mentioned_ids]).each do |user|
|
165
|
+
@commontator_thread.subscribe(user)
|
157
166
|
end
|
158
167
|
end
|
159
168
|
end
|
@@ -1,32 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
before_action :set_thread
|
1
|
+
class Commontator::SubscriptionsController < Commontator::ApplicationController
|
2
|
+
before_action :set_thread
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# PUT /threads/1/subscribe
|
5
|
+
def subscribe
|
6
|
+
security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user)
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
respond_to do |format|
|
13
|
-
format.html { redirect_to @thread }
|
14
|
-
format.js { render :subscribe }
|
15
|
-
end
|
8
|
+
@commontator_thread.errors.add(:base, t('commontator.subscription.errors.already_subscribed')) \
|
9
|
+
unless @commontator_thread.subscribe(@commontator_user)
|
16
10
|
|
11
|
+
respond_to do |format|
|
12
|
+
format.html { redirect_to commontable_url }
|
13
|
+
format.js { render :subscribe }
|
17
14
|
end
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
end
|
17
|
+
|
18
|
+
# PUT /threads/1/unsubscribe
|
19
|
+
def unsubscribe
|
20
|
+
security_transgression_unless @commontator_thread.can_subscribe?(@commontator_user)
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
@commontator_thread.errors.add(:base, t('commontator.subscription.errors.not_subscribed')) \
|
23
|
+
unless @commontator_thread.unsubscribe(@commontator_user)
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
25
|
+
respond_to do |format|
|
26
|
+
format.html { redirect_to commontable_url }
|
27
|
+
format.js { render :subscribe }
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -1,68 +1,68 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
class Commontator::ThreadsController < Commontator::ApplicationController
|
2
|
+
skip_before_action :ensure_user, only: :show
|
3
|
+
before_action :set_thread
|
4
|
+
before_action :commontator_set_thread_variables, except: :mentions
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
respond_to do |format|
|
12
|
-
format.html { redirect_to main_app.polymorphic_path(@thread.commontable) }
|
13
|
-
format.js
|
14
|
-
end
|
6
|
+
# GET /threads/1
|
7
|
+
def show
|
8
|
+
respond_to do |format|
|
9
|
+
format.html { redirect_to commontable_url }
|
10
|
+
format.js { commontator_thread_show(@commontator_thread.commontable) }
|
15
11
|
end
|
12
|
+
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@thread.errors.add(:base, t('commontator.thread.errors.already_closed')) \
|
22
|
-
unless @thread.close(@user)
|
14
|
+
# PUT /threads/1/close
|
15
|
+
def close
|
16
|
+
security_transgression_unless @commontator_thread.can_be_edited_by?(@commontator_user)
|
23
17
|
|
24
|
-
|
18
|
+
@commontator_thread.errors.add(:base, t('commontator.thread.errors.already_closed')) \
|
19
|
+
unless @commontator_thread.close(@commontator_user)
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
respond_to do |format|
|
22
|
+
format.html { redirect_to commontable_url }
|
23
|
+
format.js do
|
24
|
+
commontator_thread_show(@commontator_thread.commontable)
|
25
|
+
render :show
|
29
26
|
end
|
30
27
|
end
|
28
|
+
end
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
@thread.errors.add(:base, t('commontator.thread.errors.not_closed')) \
|
37
|
-
unless @thread.reopen
|
30
|
+
# PUT /threads/1/reopen
|
31
|
+
def reopen
|
32
|
+
security_transgression_unless @commontator_thread.can_be_edited_by?(@commontator_user)
|
38
33
|
|
39
|
-
|
34
|
+
@commontator_thread.errors.add(:base, t('commontator.thread.errors.not_closed')) \
|
35
|
+
unless @commontator_thread.reopen
|
40
36
|
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
respond_to do |format|
|
38
|
+
format.html { redirect_to commontable_url }
|
39
|
+
format.js do
|
40
|
+
commontator_thread_show(@commontator_thread.commontable)
|
41
|
+
render :show
|
44
42
|
end
|
45
43
|
end
|
44
|
+
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
# GET /threads/1/mentions.json
|
47
|
+
def mentions
|
48
|
+
security_transgression_unless @commontator_thread.can_be_read_by?(@commontator_user) &&
|
49
|
+
@commontator_thread.config.mentions_enabled
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
else
|
56
|
-
render json: serialized_mentions(query)
|
57
|
-
end
|
58
|
-
end
|
51
|
+
respond_to do |format|
|
52
|
+
format.json do
|
53
|
+
query = params[:q].to_s
|
59
54
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
if query.size < 3
|
56
|
+
render json: { errors: ['Query string is too short (minimum 3 characters)'] },
|
57
|
+
status: :unprocessable_entity
|
58
|
+
else
|
59
|
+
render json: {
|
60
|
+
mentions: Commontator.commontator_mentions(
|
61
|
+
@commontator_user, @commontator_thread, query
|
62
|
+
).map { |user| { id: user.id, name: Commontator.commontator_name(user), type: 'user' } }
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|