jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/390549 )

Change subject: Respect the full URL in gallery image description links
......................................................................


Respect the full URL in gallery image description links

Our gallery link handling always constructs a page title based on the
current app language, but gallery image descriptions come from Wikimedia
Commons and may contain links to any wiki.

This updates the link handling code so as not to assume the app language
is the wiki being linked to, when a full URL is provided.

Bug: T114025
Change-Id: I8aa14f7a13d37a5f59edb397aa6dd11718a3c508
---
M app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Cooltey: Looks good to me, approved



diff --git a/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java 
b/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
index 074656d..1acbcd4 100644
--- a/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
+++ b/app/src/main/java/org/wikipedia/gallery/GalleryActivity.java
@@ -393,21 +393,21 @@
         public void onUrlClick(@NonNull String url, @Nullable String notUsed) {
             L.v("Link clicked was " + url);
             url = resolveProtocolRelativeUrl(url);
-            WikiSite appWikiSite = app.getWikiSite();
             if (url.startsWith("/wiki/")) {
-                PageTitle title = appWikiSite.titleForInternalLink(url);
+                PageTitle title = app.getWikiSite().titleForInternalLink(url);
                 showLinkPreview(title);
             } else {
                 Uri uri = Uri.parse(url);
                 String authority = uri.getAuthority();
                 if (authority != null && WikiSite.supportedAuthority(authority)
                     && uri.getPath().startsWith("/wiki/")) {
-                    PageTitle title = appWikiSite.titleForUri(uri);
+                    PageTitle title = new WikiSite(uri).titleForUri(uri);
                     showLinkPreview(title);
                 } else {
                     // if it's a /w/ URI, turn it into a full URI and go 
external
                     if (url.startsWith("/w/")) {
-                        url = String.format("%1$s://%2$s", 
appWikiSite.scheme(), appWikiSite.authority()) + url;
+                        url = String.format("%1$s://%2$s", 
app.getWikiSite().scheme(),
+                                app.getWikiSite().authority()) + url;
                     }
                     handleExternalLink(GalleryActivity.this, Uri.parse(url));
                 }

-- 
To view, visit https://gerrit.wikimedia.org/r/390549
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8aa14f7a13d37a5f59edb397aa6dd11718a3c508
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Cooltey <cf...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Sharvaniharan <sha...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to