git ssb

30+

cel / git-ssb-web



Commit f6796afa2aa64a4b29be370cf2e10548f8745920

Set branch property in issue comment posts

Charles Lehner committed on 3/27/2016, 12:34:35 PM
Parent: d3c935772de1f3a9100852af7769cc9083245340

Files changed

index.jschanged
index.jsView
@@ -1211,8 +1211,9 @@
12111211 /* Issue */
12121212
12131213 function serveRepoIssue(req, repo, issue, path) {
12141214 var isAuthor = (myId == issue.author) || (myId == repo.feed)
1215+ var newestMsg = {key: issue.id, value: {timestamp: issue.created_at}}
12151216 return renderRepoPage(repo, null, cat([
12161217 pull.once(
12171218 renderNameForm(!isPublic, issue.id, issue.title, 'issue-title', null,
12181219 'Rename the issue',
@@ -1245,8 +1246,10 @@
12451246 var authorLink = link([msg.value.author], msg.authorName)
12461247 var msgTimeLink = link([msg.key],
12471248 new Date(msg.value.timestamp).toLocaleString())
12481249 var c = msg.value.content
1250+ if (msg.value.timestamp > newestMsg.value.timestamp)
1251+ newestMsg = msg
12491252 switch (c.type) {
12501253 case 'post':
12511254 if (c.root == issue.id) {
12521255 var changed = issues.isStatusChanged(msg, issue)
@@ -1279,9 +1282,13 @@
12791282 '</section>'
12801283 }
12811284 })
12821285 ),
1283- pull.once(isPublic ? '' : '<section><form action="" method="post">' +
1286+ isPublic ? pull.empty() : readOnce(renderCommentForm)
1287+ ]))
1288+
1289+ function renderCommentForm(cb) {
1290+ cb(null, '<section><form action="" method="post">' +
12841291 '<input type="radio" class="tab-radio" id="tab1" name="tab" checked="checked"/>' +
12851292 '<input type="radio" class="tab-radio" id="tab2" name="tab"/>' +
12861293 '<div class="tab-links">' +
12871294 '<label for="tab1" id="write-tab-link" class="tab1-link">Write</label>' +
@@ -1289,8 +1296,9 @@
12891296 '</div>' +
12901297 '<div id="write-tab" class="tab1">' +
12911298 '<input type="hidden" name="action" value="comment">' +
12921299 '<input type="hidden" name="id" value="' + issue.id + '">' +
1300+ '<input type="hidden" name="branch" value="' + newestMsg.key + '">' +
12931301 '<textarea id="comment-text" name="text" class="wide-input" rows="4" cols="77"></textarea>' +
12941302 '</div>' +
12951303 '<div class="preview-text tab2" id="preview-tab">' +
12961304 '</div>' +
@@ -1301,8 +1309,8 @@
13011309 '/>' : '') +
13021310 '<input type="submit" class="btn open" value="Comment" />' +
13031311 '<script>' + issueCommentScript + '</script>' +
13041312 '</section></form>')
1305- ]))
1313+ }
13061314 }
13071315
13081316 }

Built with git-ssb-web