Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spaceship] Allow for removing app from sale by updating territories #20324

Merged
merged 6 commits into from Jun 29, 2022

Conversation

lucgrabowski
Copy link
Contributor

@lucgrabowski lucgrabowski commented May 26, 2022

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

There are 3 discussions with questions about removing apps from sale: #19040, #17032, #19375
This change allows for removing an app from sale by updating a list of territories.

app = ... # fetch app
# 
app.update(attributes:{ "availableInNewTerritories": false }, territory_ids:[], allow_removing_from_sale: true) 

Description

It was not possible to remove app from all territories as app update method expected either nil or an array of territory_ids with at least one territory id.

Just for explain use of availableInNewTerritories:
availableInNewTerritories attribute is responsible for New Countries or Regions checkbox
available in new territories

Testing Steps

Tested by removing an app from sale using code above in irb

@lacostej
Copy link
Collaborator

Code looks good. Maybe add documentation to the method stating that empty array removes the app from sale.

Is the Tunes.update that calls patch_app used anywhere (even in popular external actions)? Is there a risk of callers accidentally passing empty arrays earlier that would trigger accidental removing from sale?

@lucgrabowski
Copy link
Contributor Author

Thanks for review @lacostej . I'll add documentation.

Is the Tunes.update that calls patch_app used anywhere (even in popular external actions)? Is there a risk of callers accidentally passing empty arrays earlier that would trigger accidental removing from sale?

You're right. patch_app isn't called in any other place, but update is called in several places and in one of them in UploadPriceTier it's called with territory_ids and it has to be fixed.

@lacostej
Copy link
Collaborator

lacostej commented Jun 1, 2022

@lucgrabowski that makes me worried that someone has code somewhere that would cause this unintended behavior. Do we have a better way of rolling this without risking this? Maybe it's acceptable as we can always roll it out... WDYT?

@lucgrabowski
Copy link
Contributor Author

@lacostej I'm wondering right now if it wouldn't be better to add a param allow_removing_from_sale: false to

update(client: nil, attributes: nil, app_price_tier_id: nil, territory_ids: nil, allow_removing_from_sale: false)

and:

patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil, allow_removing_from_sale: false)

That way if someone has code directly using those methods, we wouldn't break it.

@fastlane-bot
Copy link

Hey @lucgrabowski 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.207.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Sep 1, 2022
@lacostej lacostej deleted the lucgrabowski-allow-for-removing-app-from-sale branch November 24, 2023 14:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants