Skip to content

Commit

Permalink
#2 Hide "sponsor" link for resolved/closed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tony.franca committed Sep 18, 2012
1 parent f96bcd4 commit 34fac01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.status.Status;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;

Expand All @@ -23,9 +24,12 @@ public Map getContextMap(User user, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
String baseUrl = applicationProperties.getString("jira.baseurl");
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
String issueKey = currentIssue.getKey();
String issueKey = currentIssue.getKey();
String status = ((Status)currentIssue.getStatusObject()).getName();
boolean visible = !status.equalsIgnoreCase("resolved") && !status.equalsIgnoreCase("closed");
contextMap.put("issueKey", issueKey);
contextMap.put("baseUrl", baseUrl);
contextMap.put("visible", visible);


return contextMap;
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/sponsorthis.vm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#if( ${visible} )
<p>
<a style="font-weight: bold; color: green;"
href="http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseUrl}/browse/${issueKey}"
target="_fs">
Sponsor $issueKey on FreedomSponsors.org</a>
</p>
</p>
#end

0 comments on commit 34fac01

Please sign in to comment.