summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-10 23:58:58 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-10 23:58:58 +0000
commit251a5821bb590e7f71d68615b6d7cc4ebf124ca1 (patch)
tree95955be83b9430f5faed211ed6ba57a3e2be9f39 /src/main
parentfb9d381938d026cfcca564f64d795a832486165e (diff)
Move URL to object attributes, add title
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java11
-rw-r--r--src/main/java/uk/co/blatech/blaears/models/gitlab/Merge.java10
-rw-r--r--src/main/java/uk/co/blatech/blaears/models/gitlab/ObjectAttributes.java18
3 files changed, 24 insertions, 15 deletions
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java
index 8752401..b33b075 100644
--- a/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java
+++ b/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java
@@ -23,21 +23,22 @@ public class GitMergeController {
try {
String action = "";
- if (mergeMsg.getObjectKind().equals("open")) {
+ if (mergeMsg.getObjectAttributes().getAction().equals("open")) {
action = " created a merge request from ";
- } else if (mergeMsg.getObjectKind().equals("merge")) {
+ } else if (mergeMsg.getObjectAttributes().getAction().equals("merge")) {
action = " merged from branch ";
} else {
- action = " did a " + mergeMsg.getObjectKind() + " from ";
+ action = " did a " + mergeMsg.getObjectAttributes().getAction() + " from ";
// return "gitlab";
}
String user = mergeMsg.getUser().getUsername();
String source = mergeMsg.getObjectAttributes().getSourceBranch();
String target = mergeMsg.getObjectAttributes().getTargetBranch();
- String url = mergeMsg.getUrl();
+ String url = mergeMsg.getObjectAttributes().getUrl();
+ String title = mergeMsg.getObjectAttributes().getUrl();
//DANGER
- Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + user + action + source + " to " + target + ": " + url + " | bash /home/smsd/msgrelay.bash "});
+ Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + user + action + source + " to " + target + ": [" + title + "] "+ url + " | bash /home/smsd/msgrelay.bash "});
model.addAttribute("result", "OK");
} catch (IOException e) {
diff --git a/src/main/java/uk/co/blatech/blaears/models/gitlab/Merge.java b/src/main/java/uk/co/blatech/blaears/models/gitlab/Merge.java
index 18c910d..ced162c 100644
--- a/src/main/java/uk/co/blatech/blaears/models/gitlab/Merge.java
+++ b/src/main/java/uk/co/blatech/blaears/models/gitlab/Merge.java
@@ -13,7 +13,6 @@ public class Merge {
User user;
@JsonProperty("object_attributes")
ObjectAttributes objectAttributes;
- String url;
public String getObjectKind() {
return objectKind;
@@ -39,13 +38,4 @@ public class Merge {
this.objectAttributes = objectAttributes;
}
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
}
diff --git a/src/main/java/uk/co/blatech/blaears/models/gitlab/ObjectAttributes.java b/src/main/java/uk/co/blatech/blaears/models/gitlab/ObjectAttributes.java
index 63bc758..9c3a0c3 100644
--- a/src/main/java/uk/co/blatech/blaears/models/gitlab/ObjectAttributes.java
+++ b/src/main/java/uk/co/blatech/blaears/models/gitlab/ObjectAttributes.java
@@ -16,6 +16,8 @@ public class ObjectAttributes {
@JsonProperty("source_branch")
String sourceBranch;
String title;
+ String action;
+ String url;
public int getId() {
return id;
@@ -48,4 +50,20 @@ public class ObjectAttributes {
public void setTitle(String title) {
this.title = title;
}
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
}