Skip to content

Commit 01735b7

Browse files
committed
New feature for bitbucket: add new comment
1 parent c9a9acc commit 01735b7

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/model/bitbucket/connector.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ define(function (require, exports) {
151151
});
152152
};
153153

154+
self.addComment = function(args){
155+
var repoApiUrl = args.server.api + args.issueTracker.context,
156+
requestUrl = repoApiUrl + "/issues/"+args.number+ "/comments",
157+
credential = args.server.credential.usr + ":" + args.server.credential.pass;
158+
159+
return $.ajax
160+
({
161+
type: "POST",
162+
url: requestUrl,
163+
data: {content:args.text},
164+
async: true,
165+
beforeSend: function (xhr){
166+
xhr.setRequestHeader('Authorization', "Basic " + btoa(credential));
167+
}
168+
}).done(function(response){
169+
console.log("Comment created sucessfully");
170+
console.log(response);
171+
});
172+
};
154173
exports.name = "Bitbucket";
155174
exports.getIssues = self.getIssues;
156175
exports.issueDetail = self.issueDetail;

src/model/gitlab/connector.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,8 @@ define(function (require, exports) {
161161
console.warn("[Gitlab connector] The user doesn't have any acces token!");
162162
}
163163

164-
var tengoladata = {
165-
body: args.text
166-
};
167-
return $.ajax
168-
({
164+
return $.ajax
165+
({
169166
type: "POST",
170167
url: requestUrl,
171168
data: {body:args.text},

0 commit comments

Comments
 (0)