Skip to content
Permalink
Browse files
Fix JENKINS-15442
Removed check for triggers to determine configured state.
  • Loading branch information
slide committed Oct 10, 2013
1 parent ca20d1a commit 7ba282f904ebdf52cd2241a1a41307b9e13b248e
@@ -191,20 +191,6 @@ public ExtendedEmailPublisher() {
return configuredTriggers;
}

/**
* Return true if the project has been configured, otherwise returns false
*/
public boolean isConfigured() {
return !getConfiguredTriggers().isEmpty();
}

/**
* Return true if the project has been configured, otherwise returns false
*/
public boolean getConfigured() {
return isConfigured();
}

public MatrixTriggerMode getMatrixTriggerMode() {
if (matrixTriggerMode ==null) return MatrixTriggerMode.BOTH;
return matrixTriggerMode;
@@ -10,7 +10,7 @@ d = namespace("jelly:define")


def triggers = hudson.plugins.emailext.plugins.EmailTrigger.all()
def configured = instance != null ? instance.configured : false
def configured = instance != null

f.entry(title: _("Project Recipient List"), help: "/plugin/email-ext/help/projectConfig/globalRecipientList.html", description: _("Comma-separated list of email address that should receive notifications for this project.")) {
f.textbox(name: "project_recipient_list", value: configured ? instance.recipientList : "\$DEFAULT_RECIPIENTS", checkUrl: "'${rootURL}/publisher/ExtendedEmailPublisher/recipientListRecipientsCheck?value='+encodeURIComponent(this.value)")
@@ -1,5 +1,7 @@
package hudson.plugins.emailext;

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.containsString;
@@ -42,6 +44,8 @@
import org.jvnet.mock_javamail.Mailbox;
import org.kohsuke.stapler.Stapler;
import static org.junit.Assert.*;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.JenkinsRule.WebClient;

public class ExtendedEmailPublisherTest {

@@ -763,6 +767,22 @@ public Void call() throws Exception {
}
});
}

@Test
@Bug(15442)
public void testConfiguredStateNoTriggers()
throws Exception {
FreeStyleProject prj = j.createFreeStyleProject("JENKINS-15442");
prj.getPublishersList().add(publisher);

publisher.recipientList = "mickey@disney.com";
publisher.configuredTriggers.clear();

WebClient client = j.createWebClient();
HtmlPage page = client.goTo("job/JENKINS-15442/configure");
HtmlTextInput recipientList = page.getElementByName("project_recipient_list");
assertEquals(recipientList.getText(), "mickey@disney.com");
}

private void addEmailType(EmailTrigger trigger) {
trigger.setEmail(new EmailType() {

0 comments on commit 7ba282f

Please sign in to comment.