Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Added claim issue button to each issue, and unclaim issue #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions client/issues/issue.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@
vertical-align: middle;
}

.claimed-text {
padding-right: 50px;
color: white;
border-size: 5px;
border-radius: 5px;
}
.claim-button, .unclaim-button {
background-color: green;
border-radius: 2px;
border-size: 2px;
border-color: transparent;
float: right;
cursor: pointer;
}

.unclaim-button {
background-color: red;
}

.needs-response {
background-color: white;
border-radius: 2px;
Expand Down
12 changes: 12 additions & 0 deletions client/issues/issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
<span class="issue-number"> #{{issueDocument.number}} </span>
({{status}})
</div>
{{#unless claimed}}
<button class="claim-button">
Claim this issue
</button>
{{else}}
<button class="unclaim-button">
Unclaim this issue
</button>
<div class="claimed-text" >
Issue has been claimed by {{claimedBy}}
</div>
{{/unless}}
{{#if displayNeedsResponseButton}}
<div class="needs-response">
needs response
Expand Down
16 changes: 16 additions & 0 deletions client/issues/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,21 @@ Template.issue.events({
number: this.issueDocument.number
});
Session.set(displayId(this), false);
},
'click .claim-button': function() {
Meteor.call('claim', {
repoOwner: this.repoOwner,
repoName: this.repoName,
number: this.issueDocument.number
});
Session.set(displayId(this), false);
},
'click .unclaim-button': function() {
Meteor.call('unclaim', {
repoOwner: this.repoOwner,
repoName: this.repoName,
number: this.issueDocument.number
});
Session.set(displayId(this), false);
}
});
43 changes: 43 additions & 0 deletions packages/hubble:issue-sync/classify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,49 @@ P.asyncMethod('needsResponse', function (options, cb) {
recordAction('needsResponses', options, cb);
});

Meteor.methods(
{
claim : function(options, cb) {
check(options, {
repoOwner: String,
repoName: String,
number: Match.Integer
});
var mongoId = P.issueMongoId(options.repoOwner, options.repoName, options.number);
if (! Issues.findOne(mongoId)) {
cb(new Meteor.Error(404, "No such issue"));
return;
}
var user = new Meteor.user();
Issues.update(mongoId, {
$set: {
claimed: true,
claimedBy: user.services.github.username
}
});
},

unclaim: function(options, cb) {
check(options, {
repoOwner: String,
repoName: String,
number: Match.Integer
});
var mongoId = P.issueMongoId(options.repoOwner, options.repoName, options.number);
if (! Issues.findOne(mongoId)) {
cb(new Meteor.Error(404, "No such issue"));
return;
}
var user = new Meteor.user();
Issues.update(mongoId, {
$set: {
claimed: false,
claimedBy: null
}
});
}
});

var recordAction = function (actionField, options, cb) {
var mongoId;

Expand Down
4 changes: 3 additions & 1 deletion publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ if (Meteor.isServer) {
lastUpdateOrComment: 1,
highlyActive: 1,
status: 1,
canBeSnoozed: 1
canBeSnoozed: 1,
claimed: 1,
claimedBy: 1
};

Meteor.publish('issues-by-status', function (status) {
Expand Down