doortts doortts 2016-12-07
project: Fix application.context bug at recent history
Even though the user specified application.context,
recent history links on project pages do not work properly.

This fix is feat by @sjstyle.

See: Github issue #102
@21e7d5bcfa7ad3c39961a5107ed608456f6f5cbc
app/models/History.java
--- app/models/History.java
+++ app/models/History.java
@@ -20,6 +20,8 @@
  */
 package models;
 
+import org.apache.commons.lang3.StringUtils;
+import play.Configuration;
 import playRepository.Commit;
 
 import java.util.*;
@@ -83,7 +85,12 @@
     }
 
     public void setUrl(String url) {
-        this.url = url;
+        String contextRoot = Configuration.root().getString("application.context");
+        if(StringUtils.isBlank(contextRoot)){
+            this.url = url;
+        } else {
+            this.url = (contextRoot + "/" + url).replaceAll("//","/");
+        }
     }
 
     public String getUserPageUrl() {
 
app/utils/SecurityManager.java (added)
+++ app/utils/SecurityManager.java
@@ -0,0 +1,7 @@
+package utils;
+
+/**
+ * Created by doortts on 12/5/16.
+ */
+public class SecurityManager {
+}
conf/application.conf.default
--- conf/application.conf.default
+++ conf/application.conf.default
@@ -6,6 +6,12 @@
 # The name of your website
 application.siteName="Yona"
 
+# Application Context
+# ~~~~~~~~~~~~~~~~~~~
+# If you want your own application context root, you can set it.
+# Don't miss first / (slash) letter!
+# application.context = /myroot
+
 # Anonymous access
 # ~~~~~~~~~~~~~~~~
 # This site allows anonymous access. (default: true)
Add a comment
List