Skip to content

Consume login client from data client library #2894

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

Merged

Conversation

maskaravivek
Copy link
Member

@maskaravivek maskaravivek commented Apr 18, 2019

As part of backend overhaul, am starting to consume login client.

@maskaravivek maskaravivek marked this pull request as ready for review July 6, 2019 12:24
@maskaravivek maskaravivek changed the base branch from master to backend-overhaul July 6, 2019 12:24
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@maskaravivek you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

1 Message
⚠️ Due to its size, this pull request will likely have a little longer turnaround time and will probably require multiple passes from our reviewers.

@maskaravivek maskaravivek force-pushed the loginClient branch 4 times, most recently from 8f0a748 to 21e0b32 Compare July 6, 2019 22:32
@maskaravivek
Copy link
Member Author

All of the authenticated calls(ie login, upload, nomination for deletion, thank, notifications etc) made to commons wiki is working perfectly. I am stuck with a cross-wiki call to Wikidata. I am trying to call Service:wbcreateclaim to create a claim on Wikidata but the call is failing. I have attached the relevant logs below.

@dbrant It would be great if you could take a look at the logs and suggest what might be wrong. Is it because of some issue with cookies because as far as I see, as expected I am sending the params in POST request body with application/x-www-form-urlencoded?

2019-07-07 03:59:27.528 30797-30831/fr.free.nrw.commons D/OkHttp: --> GET https://commons.wikimedia.org/w/api.php?format=json&formatversion=2&errorformat=plaintext&action=query&meta=tokens&type=csrf
2019-07-07 03:59:27.528 30797-30831/fr.free.nrw.commons D/OkHttp: Cache-Control: no-cache
2019-07-07 03:59:27.528 30797-30831/fr.free.nrw.commons D/OkHttp: --> END GET
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: <-- 200 https://commons.wikimedia.org/w/api.php?format=json&formatversion=2&errorformat=plaintext&action=query&meta=tokens&type=csrf (372ms)
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: date: Sat, 06 Jul 2019 22:29:28 GMT
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: content-type: application/json; charset=utf-8
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: server: mw1231.eqiad.wmnet
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: x-powered-by: HHVM/3.18.6-dev
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: x-content-type-options: nosniff
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: content-disposition: inline; filename=api-result.json
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: x-frame-options: DENY
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: cache-control: private, must-revalidate, max-age=0
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: backend-timing: D=49160 t=1562452168033060
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: vary: Accept-Encoding,X-Seven
2019-07-07 03:59:27.901 30797-30831/fr.free.nrw.commons D/OkHttp: x-varnish: 589036969, 270197130, 954072031, 197187785
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: via: 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1)
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: accept-ranges: bytes
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: age: 0
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: x-cache: cp1081 pass, cp2013 pass, cp5010 pass, cp5008 pass
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: x-cache-status: pass
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: server-timing: cache;desc="pass"
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: strict-transport-security: max-age=106384710; includeSubDomains; preload
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: x-analytics: ns=-1;special=Badtitle;loggedIn=1;WMF-Last-Access=06-Jul-2019;https=1
2019-07-07 03:59:27.902 30797-30831/fr.free.nrw.commons D/OkHttp: x-client-ip: 183.82.21.187
2019-07-07 03:59:27.906 30797-30831/fr.free.nrw.commons D/OkHttp: {"batchcomplete":true,"query":{"tokens":{"csrftoken":"7f2e657b7b3ed669908f9534d70c5d515d2120c8+\\"}}}
2019-07-07 03:59:27.906 30797-30831/fr.free.nrw.commons D/OkHttp: <-- END HTTP (101-byte body)
2019-07-07 03:59:27.925 30797-30831/fr.free.nrw.commons D/OkHttp: --> POST https://wikidata.org/w/api.php?format=json&formatversion=2&errorformat=plaintext&action=wbcreateclaim&errorlang=uselang
2019-07-07 03:59:27.925 30797-30831/fr.free.nrw.commons D/OkHttp: Content-Type: application/x-www-form-urlencoded
2019-07-07 03:59:27.925 30797-30831/fr.free.nrw.commons D/OkHttp: Content-Length: 144
2019-07-07 03:59:27.926 30797-30831/fr.free.nrw.commons D/OkHttp: Cache-Control: no-cache
2019-07-07 03:59:27.926 30797-30831/fr.free.nrw.commons D/OkHttp: entity=Q6019809&snaktype=value&property=P18&value=Indian_Airlines_Flight_605.jpg&uselang=en&token=7f2e657b7b3ed669908f9534d70c5d515d2120c8%2B%5C
2019-07-07 03:59:27.926 30797-30831/fr.free.nrw.commons D/OkHttp: --> END POST (144-byte body)
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: <-- 200 https://www.wikidata.org/w/api.php?format=json&formatversion=2&errorformat=plaintext&action=wbcreateclaim&errorlang=uselang (807ms)
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: date: Sat, 06 Jul 2019 22:29:29 GMT
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: content-type: application/json; charset=utf-8
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: server: mw1280.eqiad.wmnet
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: x-powered-by: HHVM/3.18.6-dev
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: mediawiki-api-error: noentity
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: p3p: CP="This is not a P3P policy! See https://www.wikidata.org/wiki/Special:CentralAutoLogin/P3P for more info."
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: cache-control: private, must-revalidate, max-age=0
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: content-disposition: inline; filename=api-result.json
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: x-content-type-options: nosniff
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: x-frame-options: DENY
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: backend-timing: D=44813 t=1562452168870923
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: vary: Accept-Encoding,X-Seven
2019-07-07 03:59:28.735 30797-30831/fr.free.nrw.commons D/OkHttp: x-varnish: 645642479, 8330244, 234735478, 199505191
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: via: 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1), 1.1 varnish (Varnish/5.1)
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: accept-ranges: bytes
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: age: 0
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: x-cache: cp1087 pass, cp2006 pass, cp5012 pass, cp5008 pass
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: x-cache-status: pass
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: server-timing: cache;desc="pass"
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: strict-transport-security: max-age=106384710; includeSubDomains; preload
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: x-analytics: WMF-Last-Access=06-Jul-2019;WMF-Last-Access-Global=06-Jul-2019;https=1
2019-07-07 03:59:28.736 30797-30831/fr.free.nrw.commons D/OkHttp: x-client-ip: 183.82.21.187
2019-07-07 03:59:28.740 30797-30831/fr.free.nrw.commons D/OkHttp: {"errors":[{"code":"noentity","text":"The \"entity\" parameter must be set.","module":"wbcreateclaim"}],"docref":"See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.","servedby":"mw1280"}
2019-07-07 03:59:28.740 30797-30831/fr.free.nrw.commons D/OkHttp: <-- END HTTP (374-byte body)
2019-07-07 03:59:31.454 30797-30817/fr.free.nrw.commons I/zygote64: Explicit concurrent copying 

@maskaravivek maskaravivek force-pushed the loginClient branch 2 times, most recently from ad59568 to 65bf544 Compare July 7, 2019 07:44
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
@codecov-io
Copy link

Codecov Report

Merging #2894 into backend-overhaul will increase coverage by 0.13%.
The diff coverage is 7.38%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           backend-overhaul   #2894      +/-   ##
===================================================
+ Coverage              4.95%   5.08%   +0.13%     
===================================================
  Files                   260     263       +3     
  Lines                 12155   11773     -382     
  Branches               1033     967      -66     
===================================================
- Hits                    602     599       -3     
+ Misses                11507   11127     -380     
- Partials                 46      47       +1
Impacted Files Coverage Δ
...mmons/contributions/ContributionsListFragment.java 0% <ø> (ø) ⬆️
...ain/java/fr/free/nrw/commons/upload/FileUtils.java 23.18% <ø> (ø) ⬆️
...va/fr/free/nrw/commons/actions/PageEditClient.java 0% <0%> (ø)
...ommons/modifications/ModificationsSyncAdapter.java 0% <0%> (ø) ⬆️
.../java/fr/free/nrw/commons/di/NetworkingModule.java 0% <0%> (ø) ⬆️
...a/fr/free/nrw/commons/review/ReviewController.java 0% <0%> (ø) ⬆️
...a/fr/free/nrw/commons/wikidata/WikidataClient.java 0% <0%> (ø)
...nrw/commons/notification/NotificationActivity.java 0% <0%> (ø) ⬆️
...fr/free/nrw/commons/notification/Notification.java 0% <0%> (ø) ⬆️
.../java/fr/free/nrw/commons/upload/UploadClient.java 0% <0%> (ø)
... and 24 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 7ad9d8f...1bf4004. Read the comment docs.

@ashishkumar468 ashishkumar468 merged commit 6d88b6a into commons-app:backend-overhaul Jul 7, 2019
maskaravivek added a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 7, 2019
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
maskaravivek added a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 7, 2019
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
maskaravivek added a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 7, 2019
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
maskaravivek added a commit that referenced this pull request Jul 10, 2019
* Consume login client from data client library (#2894)

Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library

* Minor fixes in media and search
maskaravivek added a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 10, 2019
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
maskaravivek added a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 10, 2019
Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
maskaravivek pushed a commit that referenced this pull request Jul 15, 2019
…Client (#3056)

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* OkHttpJsonApi#getMediaList migrated to retrofit (#3054)

* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController

* getSubCategoryList and getParentCategoryList migrated to retrofit (#3055)

* Migrated getSubCategoryList to retrofit

* Migrated getParentCategoryList to retrofit

* Removed obsolete functions

* Added tests

* Fixed small bugs

* Migrated OkHttpJsonApiClient#getMedia and getPictureOfTheDay to MediaClient

* Removed obsolete functions and added tests

* Fixed merge errors

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* OkHttpJsonApi#getMediaList migrated to retrofit (#3054)

* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController

* getSubCategoryList and getParentCategoryList migrated to retrofit (#3055)

* Migrated getSubCategoryList to retrofit

* Migrated getParentCategoryList to retrofit

* Removed obsolete functions

* Added tests

* Fixed small bugs

* Consume login client from data client library (#2894)

Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
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.

3 participants