1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 18:28:47 +02:00
phorge-phorge/src/applications/doorkeeper
epriestley c6fd969416 Fix an edge case when trying to pull duplicate refs via Doorkeeper
Summary:
Report from Asana. In some unclear circumstances, we my attempt to resolve duplicate refs which currently ends up hitting a duplicate key error.

Instead, reference the same external object if we happen to be handed duplicate refs.

Test Plan:
Used this script to reproduce the issue. Applied the fix; issue went away:

  #!/usr/bin/env php
  <?php

  require_once 'scripts/__init_script__.php';

  $args = new PhutilArgumentParser($argv);
  $args->parseStandardArguments();

  $ref = id(new DoorkeeperObjectRef())
    ->setApplicationType(DoorkeeperBridgeAsana::APPTYPE_ASANA)
    ->setApplicationDomain(DoorkeeperBridgeAsana::APPDOMAIN_ASANA)
    ->setObjectType(DoorkeeperBridgeAsana::OBJTYPE_TASK)
    ->setObjectID(7253737283629); // Use a new task ID which we've never pulled.

  $refs = array(clone $ref, clone $ref);

  $asana_user = id(new PhabricatorPeopleQuery())
    ->setViewer(PhabricatorUser::getOmnipotentUser())
    ->withUsernames(array('asana'))
    ->executeOne();

  $resolved_refs = id(new DoorkeeperImportEngine())
    ->setViewer($asana_user)
    ->setRefs($refs)
    ->execute();

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7709
2013-12-05 11:45:59 -08:00
..
application Add JIRA doorkeeper and remarkup support 2013-09-03 17:27:38 -07:00
bridge Add JIRA doorkeeper and remarkup support 2013-09-03 17:27:38 -07:00
controller Add remarkup support for Asana URIs 2013-06-24 15:55:08 -07:00
engine Fix an edge case when trying to pull duplicate refs via Doorkeeper 2013-12-05 11:45:59 -08:00
option Add a configuration option to put Asana tasks into Asana projects 2013-11-25 17:40:12 -08:00
query Lock policy queries to their applications 2013-10-21 17:20:27 -07:00
remarkup Add JIRA doorkeeper and remarkup support 2013-09-03 17:27:38 -07:00
storage Explain policy exception rules to users 2013-09-27 08:43:41 -07:00
view Render linked JIRA issues with a Doorkeeper tag 2013-11-25 14:54:35 -08:00
worker Add a configuration option to put Asana tasks into Asana projects 2013-11-25 17:40:12 -08:00