Commit Graph

422 Commits

Author SHA1 Message Date
Ryuta Kamizono
146b1c2e33 Enable Style/RedundantReturn rubocop rule, and fixed a couple more
Follow up of #31004.
2017-11-01 07:32:04 +09:00
प्रथमेश Sonpatki
55fdb125db Remove CHANGELOG entry that was backported to Rails 5.1.3. [ci skip] (#30986)
- Backport commit: 7122a2cdc3
2017-10-25 22:56:38 +05:30
Rafael Mendonça França
48766e32d3
Removed deprected evented redis adapter 2017-10-23 12:50:45 -04:00
Akira Matsuda
40a8db6329 [Action Cable] require_relative => require
This basically reverts f851e1f705f26d8f92f0fc1b265b20bc389d23cb
2017-10-21 22:48:29 +09:00
Jeremy Daer
5fb282239d Merge pull request #30748 from jeremy/redis-rb-4.0.1
redis-rb 4.0 support
2017-10-08 16:14:55 -07:00
Jeremy Daer
53c516d88d
redis-rb 4.0 support
* Use `gem 'redis', '~> 4.0'` for new app Gemfiles
* Loosen Action Cable redis-rb dep to `>= 3.3, < 5`
* Bump redis-namespace for looser Redis version dep
* Avoid using the underlying `redis.client` directly
* Use `Redis.new` instead of `Redis.connect`
2017-10-08 15:37:54 -07:00
Jeremy Daer
55a2c101b2
Distinguish missing adapter gems from load errors within the adapter
* When the adapter is missing, raise an exception that points out config
  typos and missing Gemfile entries. (We can assume that a non-builtin
  adapter was used since these are always available.)
* When loading an adapter raises a LoadError, prefix its error message
  to indicate that the adapter is likely missing an optional dependency.
2017-10-08 14:47:51 -07:00
Richard Machielse
4b629eca21
ActionCable: use find method when unsubscribing
If a frontend for some reason tries to unsubscribe from a non existing subscription, the following error is logged:

Could not execute command from ({"command"=>"unsubscribe", "identifier"=>"{\"channel\":\"SomeChannel\"}"}) [NoMethodError - undefined method `unsubscribe_from_channel' for nil:NilClass]

Instead, it will now properly log:

Could not execute command from ({"command"=>"unsubscribe", "identifier"=>"{\"channel\":\"SomeChannel\"}"}) [RuntimeError - Unable to find subscription with identifier: {"channel":"SomeChannel"}]
2017-09-26 11:47:55 +02:00
Yauheni Dakuka
c9527652c7 Fix quotes [ci skip] 2017-09-18 09:38:47 +03:00
Matthew Draper
2e6658ae51 Clarify intentions around method redefinitions
Don't use remove_method or remove_possible_method just before a new
definition: at best the purpose is unclear, and at worst it creates a
race condition.

Instead, prefer redefine_method when practical, and
silence_redefinition_of_method otherwise.
2017-09-01 14:27:13 +09:30
Yoshiyuki Hirano
5eb831d3f2 Use typewriter in doc for Action Cable [ci skip] 2017-08-26 07:56:46 +09:00
Yoshiyuki Hirano
3a11e0586e Update MIT licenses link [ci skip] 2017-08-22 08:46:02 +09:00
Matthew Draper
1da7fa8728 Attributes are protected, not private, to avoid the warning 2017-08-20 01:07:05 +09:30
Jon Moss
f84019cd63 Capitalize Redis
[ci skip]
2017-08-17 10:55:10 -04:00
Koichi ITO
7c260ae201 Fix RuboCop offenses
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
2017-08-16 17:55:25 +09:00
Ryuta Kamizono
67f1b51f85 Remove unused close_connection in Action Cable tests (#30195) 2017-08-11 14:09:53 -04:00
Claudio B
af954ddd54 [ci skip] Prefer cookies.encrypted over signed (#30129)
In some examples and guides we are recommending to use code like:

```ruby
verified_user = User.find_by(id: cookies.signed[:user_id])
```

My suggestion is to use instead:

```ruby
verified_user = User.find_by(id: cookies.encrypted[:user_id])
```

which invites users to prefer the "newer" encrypted cookies over the
"legacy" signed cookies.
2017-08-07 22:32:03 -05:00
Jon Moss
5e222f3d91 Lint actioncable/CHANGELOG.md
Postgres --> PostgreSQL
ActionCable --> Action Cable

[ci skip]
2017-08-06 22:14:10 -04:00
Kir Shatrov
385825fb70 Use frozen string literal in actioncable/ 2017-07-23 23:30:29 +03:00
Kir Shatrov
87bf94d1ce Make actioncable ready for frozen strings 2017-07-23 23:20:40 +03:00
palkan
be806d8696 Fix postgresql adapter setup for ActionCable tests
(cherry picked from commit e2093c1f678175bde7c37c848686d979427346e1)
(cherry picked from commit d7dbe48273bd9e0adb1de5b52e3cdaeb4a65630b)
2017-07-11 16:38:30 +03:00
palkan
2bce7777b7 [Fix #28751] Hash stream long stream identifiers when using Postgres adapter 2017-07-06 17:34:05 +03:00
Xavier Noria
92c29d82eb Merge branch 'master' into require_relative_2017 2017-07-02 13:50:25 -07:00
Ryuta Kamizono
6aa658e329 Remove redundant assert_respond_to
It is covered by following assertion.
2017-07-03 00:16:53 +09:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Akira Matsuda
f851e1f705 [Action Cable] require => require_relative 2017-07-01 18:38:05 +09:00
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Rafael França
cf8c46938b Merge pull request #29588 from greysteil/add-gemspec-links
Add source code and changelog links to gemspecs
2017-06-28 11:24:02 -04:00
Grey Baker
3e6ce1cd69 Add source code and changelog links to gemspecs 2017-06-28 10:06:01 +01:00
Marc Rendl Ignacio
d7252786f4 Adds CHANGELOG for f55ecc6 [ci skip] 2017-06-27 09:34:37 +08:00
Marc Ignacio
f55ecc6a7c Allows for other common redis options to be in cable.yml, by default
- Adds RedisAdapterTest::AlternateConfiguration to account
  for a relatively common alternative setup, as it’s used
  as the first example in the
  [Redis rubygem](https://github.com/redis/redis-rb#getting-started)

- Supplies original RedisAdapterTest with more complete
  redis:// url format by adding a ‘userinfo’ (blank user),
  so that it resembles the alternate configuration

- Supplies original EventedRedisAdapterTest with more complete
  redis:// url as well

- Adds before_script to start redis-server with password as a daemon
  and with explicit defaults copied from the default redis.conf
  (Instead of using Travis' default init/upstart scripts for `redis` service)
2017-06-22 16:15:47 +08:00
T.J. Schuck
2f8dc184fc nodoc AC::Connection::WebSocket
Users should never publicly be interacting with an instance of this.  The instance that comes along with an `AC::Connection::Base` instance (the only thing a user should be working with) is [itself intended to be private](https://github.com/tjschuck/rails/blob/master/actioncable/lib/action_cable/connection/base.rb#L137-L140).

[ci skip]
2017-06-16 18:36:04 -04:00
bogdanvlviv
6673cf7071
Use require_relative instead of require with full path 2017-06-14 12:10:17 +03:00
Genadi Samokovarov
b6b0c99ff3 Use mattr_accessor default: option throughout the project 2017-06-03 13:52:48 +03:00
David Heinemeier Hansson
1c275d812f Add option for class_attribute default (#29270)
* Allow a default value to be declared for class_attribute

* Convert to using class_attribute default rather than explicit setter

* Removed instance_accessor option by mistake

* False is a valid default value

* Documentation
2017-05-29 18:01:50 +02:00
bogdanvlviv
40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
Akira Matsuda
f31ad74f7b identifiers is already defined via Connection::Identification module 2017-05-21 12:37:18 +09:00
Koichi ITO
89e097fa46 Suppress warning: assigned but unused variable - stdout 2017-05-12 15:37:42 +09:00
Ryuta Kamizono
89389428b5 Cleanup CHANGELOGs [ci skip]
* Remove trailing spaces.
* Add backticks around method and command.
* Fix indentation.
2017-04-30 02:41:44 +09:00
edwardmp
fc416d3721 Log any errors originating from the socket 2017-04-16 20:14:28 +02:00
Matthew Draper
fd097cff79 Work around all the things 2017-04-06 07:19:58 +09:30
Matthew Draper
c866cf9df8 Avoid "can't modify frozen IOError" failures
https://bugs.ruby-lang.org/issues/13239
2017-04-05 06:27:52 +09:30
Ryuta Kamizono
bdbee0b8e5 Rename local variable name current_user to verified_user [ci skip]
Assigning local variable named `current_user` in the condition is
confusing.
2017-03-25 20:48:34 +09:00
Kasper Timm Hansen
b242796765 Revert "Merge pull request #28569 from HarryCollins/patch-1"
This reverts commit 296d024b4e91c4891ae0b010249193513e63b921, reversing
changes made to e341d835070c7ef9990f41e02bbf46536be0aee7.

We aren't trying to compare to current_user, we're assigning that variable.
2017-03-25 12:40:53 +01:00
HarryCollins
591891e51e Update Action Cable README.md - typo fix 2017-03-25 10:45:31 +00:00
T.J. Schuck
11a09dbe53 Document AC::Connection::Authorization#reject_unauthorized_connection
This method is repeatedly used throughout the docs (in the [AC::Connection docs](12b6849858/actioncable/lib/action_cable/connection/base.rb (L28)), the [AC README](12b6849858/actioncable/README.md (a-full-stack-example)), the [AC Guides](12b6849858/guides/source/action_cable_overview.md (connection-setup))), but not actually documented itself and seemingly not supported for public use based on its current `private` status.

This actually makes the method public and documents it.  The actual behavior that’s documented here is implemented [here](12b6849858/actioncable/lib/action_cable/connection/base.rb (L213-L219)), via [this rescuing of the UnauthorizedError](3dd1de8ba4/actioncable/lib/action_cable/connection/base.rb (L172)).

The method is [already tested here](25473baf40/actioncable/test/connection/authorization_test.rb (L17-L29)).
2017-03-22 19:30:49 -04:00
Matthew Draper
62a8e838e0 Fix a race in ActionCable stream tests
These tests double-stub connection.pubsub, so we need to ensure the
first call's completed before we set up for the second.
2017-03-23 05:52:38 +10:30
Matthew Draper
6c08d480f1 Start Rails 5.2 development 2017-03-22 10:11:39 +10:30
Javan Makhmali
2d2b3025ec Restore action_cable.js UMD module support. Fixes #28366 2017-03-11 16:12:36 -05:00
Rafael Mendonça França
8bb0b99a4a
Update package.json 2017-02-23 15:03:20 -05:00