{
private LocalDateTime expireDate;
private String uid;
+ private Boolean dismissible = true;
+
@DataBoundConstructor
public SystemMessage(String message, SystemMessageColor level, String uid) {
this.message = Util.fixEmptyAndTrim(message);
@@ -38,6 +40,17 @@ public SystemMessage(String message, SystemMessageColor level, String uid) {
this.uid = uid;
}
+ public Boolean getDismissible() {
+ return dismissible;
+ }
+
+ @DataBoundSetter
+ public void setDismissible(Boolean dismissible) {
+ if (dismissible != null) {
+ this.dismissible = dismissible;
+ }
+ }
+
@DataBoundSetter
public void setExpireDate(String expireDate) {
if (Util.fixEmptyAndTrim(expireDate) != null) {
@@ -58,7 +71,7 @@ public String getExpireDate() {
public boolean isDismissed() {
User user = User.current();
- if (user != null) {
+ if (user != null && dismissible) {
UserHeader userHeader = user.getProperty(UserHeader.class);
if (userHeader != null) {
return userHeader.getDismissedMessages().contains(uid);
@@ -101,6 +114,9 @@ public void setColor(String color) {
public Object readResolve() {
setColor(color);
color = null;
+ if (dismissible == null) {
+ dismissible = true;
+ }
return this;
}
diff --git a/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/config.jelly b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/config.jelly
index 2d8e7a5..bc5f359 100644
--- a/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/config.jelly
+++ b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/config.jelly
@@ -3,6 +3,9 @@
+
+
+
${it.toString()}
diff --git a/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/help-dismissible.html b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/help-dismissible.html
new file mode 100644
index 0000000..912ead9
--- /dev/null
+++ b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/help-dismissible.html
@@ -0,0 +1,3 @@
+
+ When not checked, users are not able to dismiss the message.
+
\ No newline at end of file
diff --git a/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/index.jelly b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/index.jelly
index a397817..9adba8c 100644
--- a/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/index.jelly
+++ b/src/main/resources/io/jenkins/plugins/customizable_header/SystemMessage/index.jelly
@@ -3,7 +3,7 @@