Hi Jay,

Well you definitely don't want to modify Review Board to force that field
to be accepted in extra_data. That's not a long-term solution. It's also
very possible that the latest reported issue is yet another side-effect of
handling the extra_data field incorrectly.

Fields store extra_data on the review request draft. They're only then
transferred to the review request when published. If you force content to
be in ReviewRequest.extra_data while a draft is opened, and then published,
it's going to be overwritten by the value in ReviewRequestDraft.extra_data,
which presumably is empty.

You cannot both use a field *and* force that data into
ReviewRequest.extra_data. That's not how it's designed, and if it ever
worked, it was a bug.

Can you go into the full-on use case of this extension? The entire workflow
and purpose? That'll help me guide you to the right solution.

Christian

-- 
Christian Hammond - christ...@beanbaginc.com
Review Board - https://www.reviewboard.org
Beanbag, Inc. - https://www.beanbaginc.com

On Sun, Aug 30, 2015 at 1:05 AM, <jaylee108...@gmail.com> wrote:

> Hey Christian,
>
> Thanks for getting back to me. We came from 2.0.11. What I noticed what
> that the field was probably now considered a markdown field which mean't
> that the review request resource couldn't update it as opposed to any other
> extra data field.
>
> I altered the `update` method of the web API file `review_request.py` to
> forcefully add the field into the `extra_data` dict.
>
> However, the situation I am now running into is that I also have an
> associated extension button on the page and whenever the extension button
> is clicked, the `extra_data` for this field is wiped. How can I prevent
> this from happening? I am under a fair amount of stress to get this
> operational before the weekend ends so any help would be very appreciated.
>
> The field is on the UI and editable by the user to include output notes
> along with the automated notes.
>
> The extension looks something like:
>
>  class ExtensionOutput(Extension):
>
>   is_configurable = True
>
>   def initialize(self):
>     ReviewRequestFieldsHook(self, 'main', [OutputField])
>     ReviewRequestActionHook(self, actions=[
>             {
>                 'id': 'button',
>                 'label': 'Special Button',
>                 'url': '',
>             },
>     ])
>
>
> class OutputField(BaseTextAreaField):
>
>     field_id = 'extension_result_output'
>     label = 'Output'
>
>     def load_value(self, review_request_details):
>
>       curr_val = super(OutputField,
> self).load_value(review_request_details)
>       if not curr_val:
>         try:
>           return ExtensionOutput.instance.settings['message']
>         except Exception:
>           return "Default message."
>       else:
>         return curr_val
>
> Sincerely,
> Jay
>
> On Saturday, August 29, 2015 at 8:10:45 PM UTC-7, Christian Hammond wrote:
>>
>> Hi Jay,
>>
>> What version were you using before you upgraded?
>>
>> I suspect you're hitting a problem due to a fix we put in several
>> releases back. It was always the intention that any extra_data key
>> associated with a custom review request field should be set with the draft
>> review request API, which would then carry over to the review request when
>> published, just like any other field.
>>
>> We had a bug that got fixed where the state between the two was being
>> shared incorrectly at a specific point, which caused undesired behavior. We
>> fixed this, and it's possible that exposed a problem in this extension.
>>
>> How is this field used? Is there a need to expose this field in the UI?
>>
>> Would you be able to share the source of the field?
>>
>> Christian
>>
>>
>> On Saturday, August 29, 2015, <jaylee...@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> My company has recently upgrade to Review Board 2.0.18.
>>>
>>> We had a number of extensions; one of which was an output box for the
>>> results of some of our automated machinery.
>>>
>>> The extension was built with a review request fields hook and a
>>> `BaseEditableField`.
>>>
>>>
>>> https://www.reviewboard.org/docs/manual/2.0/extending/extensions/hooks/review-request-fields-hook/
>>>
>>> The `BaseEditableField` had an extra data field on the review request
>>> with name of `extension_result_output`.
>>>
>>> We used to do PUT requests to the review request resource API to update
>>> this extra data field. Unfortunately, this no longer works in Review Board
>>> 2.0.18 with this specific extra data field (I'm guessing this might be due
>>> to the fact that there is some code interaction with the extension that
>>> might prevent this).
>>>
>>> A PUT request to the review request resource API can update any other
>>> extra data field (which we are not using in extensions) except
>>> `extension_result_output`.
>>>
>>> Instead, `extension_result_ouptut` can get updated by the review request
>>> draft resource API, but this causes emails to get sent out on small 1 line
>>> updates to the output box. Additionally, the review request UI will get
>>> flooded with updates to the box itself. Is there any way to prevent this as
>>> it currently spams our users both by inbox and through the UI.
>>>
>>> What is causing this discrepancy between why certain extra data fields
>>> can get updated through the review request resource and others not? We run
>>> a fairly high traffic Review Board instance. What is a recommended,
>>> immediate solution and maybe long term solution that we might be able to
>>> implement?
>>>
>>> Thanks,
>>> Jay
>>>
>>>
>>> --
>>> Supercharge your Review Board with Power Pack:
>>> https://www.reviewboard.org/powerpack/
>>> Want us to host Review Board for you? Check out RBCommons:
>>> https://rbcommons.com/
>>> Happy user? Let us know! https://www.reviewboard.org/users/
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "reviewboard" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to reviewboard+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> --
>> Christian Hammond - chri...@beanbaginc.com
>> Review Board - https://www.reviewboard.org
>> Beanbag, Inc. - https://www.beanbaginc.com
>>
>> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to