Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
AutoLinkRenderer: Bug fix
Browse files Browse the repository at this point in the history
Problem: trying to making a link to a commit of the project that is not using code feature.

Solution: changed to return empty link for a project that is not using code feature.
  • Loading branch information
Keesun Baik committed Mar 3, 2015
1 parent 54f4493 commit 923dc51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ public void changeVCS() throws Exception {
this.update();
}

public boolean isCodeAvailable() {
return menuSetting == null || menuSetting.code;
}

public enum State {
PUBLIC, PRIVATE, ALL
}
Expand Down
8 changes: 7 additions & 1 deletion app/utils/AutoLinkRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.*;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
import org.tmatesoft.svn.core.SVNException;
import playRepository.Commit;
Expand Down Expand Up @@ -276,6 +278,10 @@ private Link toValidSHALink(Project project, String SHA) {
private Link toValidSHALink(String prefix, Project project, String sha) {
if (project != null) {
try {
if (!project.isCodeAvailable()) {
return Link.EMPTY_LINK;
}

PlayRepository repository = RepositoryService.getRepository(project);

if (repository != null) {
Expand Down

0 comments on commit 923dc51

Please sign in to comment.