1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/src/applications/phortune
epriestley 2bbddb8c0f Improve some setInitialValue() behavior for PhortuneMerchants
Summary:
This fixes the permissions issue with D16750, which is actually not really a permissions issue, exactly.

This is the only place anywhere that we use a tokenizer field //and// give it a default value which is not the same as the object value (when creating a merchant, we default it to the viewer).

In other cases (like Maniphest) we avoid this because you can edit the form to have defaults, which would collide with whatever default we provide. Some disucssion in T10222.

Since we aren't going to let you edit these forms for the forseeable future, this behavior is reasonable here though.

However, it triggered a sort-of-bug related to conflict detection for these fields (see T4768). These fields actually have two values: a hidden "initial" value, and a visible edited value.

When you submit the form, we compute your edit by comparing the edited value to the initial value, then applying adds/removes, instead of just saying "set value equal to new value". This prevents issues when two people edit at the same time and both make changes to the field.

In this case, the initial value was being set to the display value, so the field would say "Value: [(alincoln x)]" but internally have that as the intitial value, too. When you submitted, it would see "you didn't change anything", and thus not add any members.

So the viewer wouldn't actually be added as a member, then the policy check would correctly fail.

Note that there are still some policy issues here (you can remove yourself from a Merchant and lock yourself out) but they fall into the realm of stuff discussed in D16677.

Test Plan: Created a merchant account with D16750 applied.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D16764
2016-10-28 14:54:13 -07:00
..
application Update Phortune Merchant to EditEngine 2016-10-28 14:15:26 -07:00
capability Add Merchants to Phortune 2014-10-07 10:55:16 -07:00
cart Extend from Phobject 2015-06-15 18:02:27 +10:00
constants Extend from Phobject 2015-06-15 18:02:27 +10:00
contentsource Modularize content sources 2016-03-26 11:59:45 -07:00
control phtize all the things 2015-05-22 21:16:39 +10:00
controller Update Phortune Merchant to EditEngine 2016-10-28 14:15:26 -07:00
currency phtize all the things 2015-05-22 21:16:39 +10:00
edge Give Phortune merchants explicit members 2014-10-13 11:13:50 -07:00
editor Improve some setInitialValue() behavior for PhortuneMerchants 2016-10-28 14:54:13 -07:00
mail phtize all the things 2015-05-22 21:16:39 +10:00
management phtize all the things 2015-05-22 21:16:39 +10:00
phid Mark PhabricatorPHIDType::getPHIDTypeApplicationClass() as abstract 2015-11-03 06:47:12 +11:00
product Modularize content sources 2016-03-26 11:59:45 -07:00
provider Remove the PhortuneNotImplementedException class 2015-11-12 06:33:39 +11:00
query Add a Merchant logo to Phortune 2016-10-28 13:56:35 -07:00
storage Update Phortune Merchant to EditEngine 2016-10-28 14:15:26 -07:00
subscription Extend from Phobject 2015-06-15 18:02:27 +10:00
view Convert all calls to 'IconFont' to just 'Icon' 2016-01-27 20:59:27 -08:00
worker Fix a Phortune bug where an invalid viewer could sometimes be selected for billing a subscription 2016-10-26 15:54:04 -07:00