Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
feat: Update Discover Course pages by removing course path (#1817)
Browse files Browse the repository at this point in the history
- Update the course detail template through changes made in the config repository.
- Remove the relevant code associated with the course path.

Fixes: LEARNER-9525
  • Loading branch information
HamzaIsrar12 authored Aug 28, 2023
1 parent 5844ad1 commit 1c3ce13
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
6 changes: 0 additions & 6 deletions OpenEdXMobile/src/main/java/org/edx/mobile/util/UrlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import androidx.annotation.NonNull;

import org.edx.mobile.logger.Logger;
import org.edx.mobile.util.links.WebViewLink;

import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -64,11 +63,6 @@ public static Map<String, String> getQueryParams(@NonNull Uri uri) {
for (String name : paramNames) {
String value = uri.getQueryParameter(name);
if (value != null) {
if (name.equals(WebViewLink.Param.PATH_ID) &&
value.startsWith(WebViewLink.PATH_ID_COURSE_PREFIX)) {
// Our config already has this prefix in the URI, so we need to get rid of it here in the param's value
value = value.substring(WebViewLink.PATH_ID_COURSE_PREFIX.length()).trim();
}
paramsMap.put(name, value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
public class WebViewLink {
public static final String SCHEME = "edxapp";
public static final String PATH_ID_COURSE_PREFIX = "course/";

public enum Authority {
COURSE_INFO("course_info"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@ public void testWebViewLinkCorrectlyParsesCourseIdWithEmailOptIn() {
assertEquals(emailOptIn, Boolean.valueOf(link.params.get(WebViewLink.Param.EMAIL_OPT)));
}

@Test
public void testWebViewLinkParsesCourseIdAndRemovesCoursePrefix() {
final String courseId = "cosmology-anux-anu-astro4x";
final Uri uri = new Uri.Builder()
.scheme(WebViewLink.SCHEME)
.authority(WebViewLink.Authority.COURSE_INFO.getKey())
.appendQueryParameter(WebViewLink.Param.PATH_ID,
WebViewLink.PATH_ID_COURSE_PREFIX + courseId)
.build();
final WebViewLink link = WebViewLink.parse(uri.toString());
assertNotNull(link);
assertNotNull(link.params);
assertEquals(courseId, link.params.get(WebViewLink.Param.PATH_ID));
}

/**
* Tests our workaround for edx.org failing to encode plus signs in the course_id parameter
* See https://openedx.atlassian.net/browse/MA-1901
Expand Down

0 comments on commit 1c3ce13

Please sign in to comment.