PhabricatorPeopleProfilePictureController: fix "Duplicate entry" error
Summary:
"Thanks" to a recent change designed to keep track of transformed images
(ee4245098b9f4cb996501631d94de07840db2620) it's more evident that
Phorge was creating duplicate PhabricatorFile(s).
These duplicate files - now tracked - were causing this regression:
#1062: Duplicate entry 'PHID-FILE-ffps4pzs36kkikrpvgdh-profile' for key 'originalPHID'
This crash was reproduced in the "Edit Profile Picture" menu, when selecting
your GitHub profile picture.
After this patch, the original image has the "profile transform" generated only once
in your database. So, consequent "Edit Profile Picture" on the same GitHub
image does not pollute your database table 'phabricator_file.file' with duplicates,
and this error is fixed.
See also D26803 with a similar bug by @aklapper, during the early
phase of the GitHub image import.
Closes T16527
Ref T16528
Test Plan:
Prepare GitHub OAuth (curtesy of aklapper):
* Log into github.com create a new OAuth App via https://github.com/settings/applications/new
* As an admin, set up GitHub Auth provider via http://phorge.localhost/auth/
* Copy Client ID into "OAuth App ID" and Client Secret into "OAuth App Secret"
Then:
* visit profile Settings > External Accounts, and connect GitHub
* visit profile Manage > Edit Profile Picture, and select the GitHub image
The error `#1062: Duplicate entry 'PHID-FILE-foobar' for key 'originalPHID'` does not appear.
Check for regressions:
Upload a new image as profile picture: it still works.
Reviewers: O1 Blessed Committers, avivey
Reviewed By: O1 Blessed Committers, avivey
Subscribers: avivey, tobiaswiese, Matthew, aklapper, Cigaryno
Maniphest Tasks: T16528, T16527
Differential Revision: https://we.phorge.it/D26804