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

Upgrade more services to Angular 8 #7145

Merged
merged 38 commits into from
Jul 19, 2019
Merged

Upgrade more services to Angular 8 #7145

merged 38 commits into from
Jul 19, 2019

Conversation

YashJipkate
Copy link
Contributor

@YashJipkate YashJipkate commented Jul 15, 2019

Explanation

Upgrades:

  • AnswerClassificationResultObjectFactory
  • ClassifierObjectFactory
  • ExplorationDraftObjectFactory
  • PredictionResultObjectFactory
  • RuleObjectFactory
  • TopicRightsObjectFactory
  • WrittenTranslationObjectFactory

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR has an appropriate "CHANGELOG: ..." label (If you are unsure of which label to add, ask the reviewers for guidance).
  • The PR follows the style guide.
  • The PR addresses the points mentioned in the codeowner checks for the files/folders changed. (See the codeowner's wiki page.)
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer and don't tick this checkbox.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue. Do not only request the review but also add the reviewer as an assignee.

@YashJipkate YashJipkate reopened this Jul 18, 2019
@YashJipkate YashJipkate reopened this Jul 18, 2019
@kevinlee12 kevinlee12 assigned YashJipkate and unassigned seanlip Jul 18, 2019
@kevinlee12
Copy link
Contributor

kevinlee12 commented Jul 18, 2019

@YashJipkate, ptal at the failing tests! (I've restarted them after Sean restarted them and it still fails.)

@YashJipkate YashJipkate reopened this Jul 19, 2019
@oppiabot
Copy link

oppiabot bot commented Jul 19, 2019

Hi @YashJipkate. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

canPublishTopicBool: boolean;
canEditTopicBool: boolean;
}) {
topicRightsBackendObject: any) {
Copy link
Member

Choose a reason for hiding this comment

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

This concerns me. Why does typing raise errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because if I type it then can_publish_topic would raise a lint error, so I changed it to camelCase. But this also needs to changed everywhere it is being referenced and most importantly in all of the backend since it is passed as a dict with these keys. So, this comes under 'complex' criteria and I decided to type it as any

I think we should file an issue to overcome this. Note that this might be tricky because I think pylint has a rule against naming in camelCase and favors underscore_case.

What do you think?

Copy link
Member

@seanlip seanlip Jul 19, 2019

Choose a reason for hiding this comment

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

Yes, I understand the complexity. One thing I'd say is -- for anything like this, please file an issue proactively (and leave a comment here pointing to it), don't wait for a reviewer to point it out. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will keep that in mind in the future.
Raised #7176,
Thanks!

@@ -15,6 +15,9 @@
/**
* @fileoverview Service for managing CSRF tokens.
*/

import * as $ from 'jquery';
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit concerning. What's going on here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a fix to something not going well with Karma. After the introduction of Angular and upgrading some services, this service started to come under Angular zone due to it being dependency, now the zone was not able to find AJAX directly as a global like we do in AngularJS (the same reason we cannot upgrade the constants like INTERACTION_SPECS which are defined in a global variable).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And hence we need to import it specifically, like we do for all the Angular things (like the imports in AppInit.ts are explicit and do not depend on global definitions)

Copy link
Member

@seanlip seanlip Jul 19, 2019

Choose a reason for hiding this comment

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

There needs to be a comment for things like this, which explains what is going on and that points to an authoritative link explaining the context behind such a solution. Developers won't understand it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will add a comment to it.
But about a link, I do not have one because I discovered this fix myself. There is one open question in which the problem of OP is the same as mine but he also did not get a correct answer, I myself have posted an answer on it which was this very fix. I don't know which link to provide.

Could you please give some suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

You can link to that thread. Also, explain in the comment what this syntax is actually doing.

(Thanks for helping other folks on StackOverflow, btw!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@YashJipkate YashJipkate reopened this Jul 19, 2019
@YashJipkate YashJipkate assigned seanlip and unassigned YashJipkate Jul 19, 2019
@YashJipkate
Copy link
Contributor Author

@seanlip @kevinlee12 The tests pass now. PTAL!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

OK, lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants