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

Remove unused tech_support_email and admin_support_email #443

Merged
merged 3 commits into from Apr 3, 2019

Conversation

mayorova
Copy link
Contributor

@mayorova mayorova commented Dec 19, 2018

What this PR does / why we need it:

Removes unused fields from the API request and response (they are not visible in the UI and not used anywhere).

Which issue(s) this PR fixes

Closes https://issues.jboss.org/browse/THREESCALE-1615

Verification steps

tech_support_email and admin_support_email:

  • are not visible in the UI
  • are not read anywhere
  • are not returned as part of any API response (API Service List)
  • can't be added or updated in the DB

Special notes for your reviewer:

@Martouta
Copy link
Contributor

If I understood correctly, these fields are not used at all anywhere.
In that case, you should remove them from everywhere, including the DB (with a migration for it) 😄
image
image

@mayorova mayorova changed the title Remove unused tech_support_email and admin_support_email [WIP] Remove unused tech_support_email and admin_support_email Dec 19, 2018
@codecov
Copy link

codecov bot commented Jan 15, 2019

Codecov Report

Merging #443 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #443      +/-   ##
=========================================
+ Coverage   92.86%   92.9%   +0.03%     
=========================================
  Files        2390    2391       +1     
  Lines       77758   77851      +93     
=========================================
+ Hits        72209   72326     +117     
+ Misses       5549    5525      -24
Impacted Files Coverage Δ
app/representers/service_representer.rb 100% <ø> (ø) ⬆️
...t/integration/user-management-api/services_test.rb 100% <ø> (ø) ⬆️
app/controllers/admin/api/services_controller.rb 100% <ø> (ø) ⬆️
lib/developer_portal/lib/liquid/drops/service.rb 82.35% <ø> (ø) ⬆️
test/integration/api/services_controller_test.rb 100% <100%> (ø) ⬆️
app/models/service.rb 93.79% <100%> (-0.05%) ⬇️
app/models/policy.rb 96.61% <0%> (-1.7%) ⬇️
app/models/payment_transaction.rb 80.64% <0%> (-1.08%) ⬇️
.../find_and_delete_accounts_scheduled_worker_test.rb 100% <0%> (ø) ⬆️
config/jobs.rb 60% <0%> (ø) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90284d4...a7ea2f2. Read the comment docs.

@mayorova
Copy link
Contributor Author

@3scale/system if we could verify whether the liquid {{ admin_support_email }} is never used in SaaS without an if (it is OK in this default template I assume), I guess we can also remove https://github.com/3scale/porta/pull/443/files#diff-9a60f34aa62e2f3321db3a42f1d89fb1R184 ?

@mayorova mayorova changed the title [WIP] Remove unused tech_support_email and admin_support_email Remove unused tech_support_email and admin_support_email Jan 25, 2019
@mayorova mayorova force-pushed the remove-unused-service-emails branch from 999e69d to 48aada1 Compare March 13, 2019 09:05
@josemigallas josemigallas self-assigned this Mar 13, 2019
@josemigallas josemigallas requested a review from a team March 13, 2019 12:18
@Martouta
Copy link
Contributor

Martouta commented Mar 13, 2019

According to what we spoke, this is what we need to remove from the attributes tech_support_email and admin_support_email in this specific PR:

  • the attributes from the xml/json response from the model
  • the attributes from the xml/json response from the representer
  • update the swagger spec of the api
  • fix corresponding rspec and tests.
  • don't accept this params through the controllers anymore

I also see that a useful comment in lib/developer_portal/lib/liquid/drops/service.rb was added, good 👍

I will review more in depth now 😉

@Martouta
Copy link
Contributor

Martouta commented Mar 13, 2019

@josemigallas You still need to change this:
https://github.com/3scale/porta/blob/48aada188a78eb65620aa22323e34222d9ac020e/app/controllers/admin/api/services_controller.rb#L113-L115
It is accepting all current attributes from service and we shouldn't allow tech_support_email or admin_support_email anymore.
Same in the other ServicesController

Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review done 😄 Few changes requested and that's it, you are almost there. Besides what I've said in the comments, nothing else left to do I'd say 👍

image

@Martouta Martouta changed the title Remove unused tech_support_email and admin_support_email [WIP] Remove unused tech_support_email and admin_support_email Mar 19, 2019
@josemigallas josemigallas force-pushed the remove-unused-service-emails branch 2 times, most recently from c6bbcbb to ac19614 Compare March 21, 2019 10:15
@Martouta Martouta requested review from Martouta and a team March 21, 2019 10:39
@josemigallas josemigallas changed the title [WIP] Remove unused tech_support_email and admin_support_email Remove unused tech_support_email and admin_support_email Mar 25, 2019
@josemigallas josemigallas force-pushed the remove-unused-service-emails branch 2 times, most recently from 3eac7f5 to 2b35493 Compare March 25, 2019 17:52
@@ -181,7 +181,7 @@ def metrics
Drops::Metric.wrap(@service.metrics.top_level)
end

# TODO: remove this and remove all references, views, controllers
# NOTE: keeping in case somebody already using 'admin_support_email' liquid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should return nil and I think we should think about removing for real those deprecated tags.
@secretsurf @3scale/product @3scale/support
We need to make a plan on when and how to remove those.

My idea would be in 3 steps (3 releases)

  1. add a logger there to know if people are still using it. And collect data.
  2. Send a deprecation notice to those tenants
  3. Remove the feature definitively

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hallelujah @macejmic
Should we add here as well 1 for the tech_support_email?

hidden
deprecated "Use **support_email** instead."
def tech_support_email
  @service.support_email
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hallelujah I would be in favour of add a logger so we can collect usage data and go from there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I guess this should be like the following example (please confirm @hallelujah ):

# NOTE: keeping in case somebody already using 'admin_support_email' liquid
hidden
deprecated "Use **support_email** instead."
def admin_support_email
  Rails.logger.info "Liquid::Drops::Service#admin_support_email is being used by Service ##{@service.id}"
  nil
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josemigallas No need to add the tech_support_email here 😄 If it isn't there is because nobody is using it which is what we want 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Sorry this method do not have to change, forget about my first comment.

@josemigallas josemigallas force-pushed the remove-unused-service-emails branch 2 times, most recently from fc5d406 to 55ed144 Compare March 29, 2019 06:41
@josemigallas josemigallas added the Priority: High Closes a JIRA issue in our sprint label Mar 29, 2019
@@ -42,6 +42,24 @@ class Api::ServicesControllerTest < ActionDispatch::IntegrationTest
expected_signup_and_use.each { |attr_name, attr_value| assert_equal attr_value, service.public_send(attr_name) }
end

# This test can be removed once used deprecated attributes have been removed from the schema
test 'deprecated attributes should not be updated' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👍 💪

@Martouta Martouta dismissed their stale review April 3, 2019 08:40

Doing a new review now :)

Martouta
Martouta previously approved these changes Apr 3, 2019
Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @josemigallas 🎉 🥇

Copy link
Contributor

@hallelujah hallelujah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the attr_readonly and good to :shipit:

Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@hallelujah hallelujah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then prepare a separate PR to remove the columns then

@josemigallas josemigallas merged commit 30b5082 into master Apr 3, 2019
@josemigallas josemigallas deleted the remove-unused-service-emails branch April 3, 2019 12:09
@ianseyer
Copy link

It would've been great to get a public release notice about this, as it broke our production APIs 👎

@thomasmaas
Copy link
Member

Hi @ianseyer, that's very unfortunate. We are investigating what went wrong. Would you care to explain how this change broke your production APIs?

@thomasmaas
Copy link
Member

ping @ianseyer: to get some more specifics would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Closes a JIRA issue in our sprint
Projects
None yet
7 participants