Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification_action_cable_allowed? error #138

Closed
szechyjs opened this issue May 23, 2020 · 2 comments
Closed

notification_action_cable_allowed? error #138

szechyjs opened this issue May 23, 2020 · 2 comments

Comments

@szechyjs
Copy link
Contributor

Steps to reproduce

Setup up notifications so that User receives notifications for User create.

acts_as_notifiable :users,
  targets: ->(user, key) {
    User.with_role(:admin)
  },
  tracked: { only: [:create] },
  notifiable_path: :user_notifiable_path,
  printable_name: ->(user) { "User #{user.email}" }

Open the user's notifications view.

Expected behavior

Should render the page without error

Actual behavior

The following error:

ActionView::Template::Error (wrong number of arguments (given 0, expected 1..2)):
    39:   }
    40: </style>
    41:
    42: <% if @target.notification_action_cable_allowed? %>
    43:   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/push.js/1.0.9/push.min.js"></script>
    44:   <script>
    45:     App.activity_notification = App.cable.subscriptions.create(

activity_notification (9f35a5b3a420) lib/activity_notification/models/concerns/notifiable.rb:165:in `notification_action_cable_allowed?'
activity_notification (9f35a5b3a420) app/views/activity_notification/notifications/default/index.html.erb:42

System configuration

activity_notification gem version: 2.1.2 (master)
Rails version: 6.0.3
ORM (ActiveRecord, Mongoid or Dynamoid): ActiveRecord

@simukappu
Copy link
Owner

Thank you for your report.
The reason of this issue is that we have two different method ActivityNotification::Target#notification_action_cable_allowed?(notifiable = nil, key = nil) and ActivityNotification::Notifiable#notification_action_cable_allowed?(target, key = nil).
If you could customize your view, we would appreciate your pull request.

simukappu added a commit that referenced this issue Sep 27, 2020
…tion_cable_allowed? to fix duplicate method name error - #138
@simukappu
Copy link
Owner

We've just published as v2.1.4.
https://rubygems.org/gems/activity_notification/versions/2.1.4

Thank you!

simukappu added a commit that referenced this issue Nov 25, 2020
…tion_cable_allowed? to fix duplicate method name error - #138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants