Closed ankitrox closed 8 months ago
@ankitrox any chance you're able to handle the code review item above?
@peterwilsoncc Thanks for the review :)
I wanted those couple of variables to be persistent across multiple function calls, but I agree that static may not be the idea ones as far as unit tests are concerned.
I have changed it to use options table in order for them to be persistent. This will also be handy for unit tests.
I just tested this and am still seeing the no authorized resellers warning when the file contains both a placeholder and a valid record.
I did some testing to see if I could come up with an approach that worked but comment lines ended up suppressing the error if the file contained placeholders and comments (which is just as bad, if not worse).
My thoughts are:
has_placeholder_records
to has_only_placeholder_records
, in the validate_file function set it to null
false
null
, set it to true.We'll need to account for:
Thank you @peterwilsoncc
I have added the fix as per Peter's suggestion and it seems to be working fine. Also, added the unit test for the placeholder record.
CC: @jeffpaul
Description of the Change
Closes #78
How to test the Change
Add the following record in ads.txt editor and save changes. You shall receive the warning "Your ads.txt indicates no authorized advertising sellers."
Add following record in ads.txt editor. You will get the error "Line 2: Ads.txt contains placeholder record with another records."
Changelog Entry
Credits
Props @peterwilsoncc
Checklist: