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

Viewing User models in ActiveAdmin makes Intercom Messenger act as if you are that user #283

Open
nickurban opened this issue Mar 26, 2018 · 1 comment

Comments

@nickurban
Copy link

nickurban commented Mar 26, 2018

Version info

  • intercom-rails version: 0.3.8
  • Rails version: 5.1.5

Expected behavior

When viewing users as an AdminUser in ActiveAdmin, Intercom messenger should not be active.

Actual behavior

When viewing a User as an AdminUser in ActiveAdmin, Intercom messenger suddenly appears as if I were the User whose record I am viewing.

Steps to reproduce

  1. Create a User model with Devise
  2. Install ActiveAdmin and create an AdminUser model
  3. Create an admin module for editing User records
  4. View a User record in ActiveAdmin
  5. Congrats, Intercom now things you are the user you are viewing.

Logs

@nickurban
Copy link
Author

nickurban commented Mar 26, 2018

Ah, it looks like intercom-rails picks up @user by default as the current user, which I suspect ActiveAdmin sets when editing a user.

Setting config.user.current = Proc.new { current_user } seems to have resolved the issue.

Given that lots of apps set @user when editing a user, I would suggest only pulling the current user from current_user (and perhaps @current_user) by default.

@keloe keloe added invalid and removed invalid labels Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants