HomePhabricator

Fix an exception in Tokens if a bad object was given a token

Description

Fix an exception in Tokens if a bad object was given a token

Summary:
Fixes T10057. Root issue is:

  • In the past, you could give tokens to objects of type X (here, Ponder answers).
  • Now, you can't.
  • If you try to load a token on an object of type X, we do a bad call to attach it and fatal.

Instead, make sure objects implement the proper interface before we attach them, and just pretend the token does not exist otherwise.

Test Plan: Faked the exception in T10057, applied patch, got clean tokens page.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10057

Differential Revision: https://secure.phabricator.com/D14905