mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
(refs #584) Refactored
This commit is contained in:
@@ -248,10 +248,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
val id = params("id")
|
val id = params("id")
|
||||||
createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName, form.content,
|
createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName, form.content,
|
||||||
form.fileName, form.oldLineNumber, form.newLineNumber, form.issueId.isDefined)
|
form.fileName, form.oldLineNumber, form.newLineNumber, form.issueId.isDefined)
|
||||||
if (form.issueId.isDefined)
|
form.issueId match {
|
||||||
recordCommentPullRequestActivity(repository.owner, repository.name, context.loginAccount.get.userName, form.issueId.get, form.content)
|
case Some(issueId) => recordCommentPullRequestActivity(repository.owner, repository.name, context.loginAccount.get.userName, issueId, form.content)
|
||||||
else
|
case None => recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
||||||
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
}
|
||||||
redirect(s"/${repository.owner}/${repository.name}/commit/${id}")
|
redirect(s"/${repository.owner}/${repository.name}/commit/${id}")
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -273,10 +273,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
val id = params("id")
|
val id = params("id")
|
||||||
val commentId = createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName,
|
val commentId = createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName,
|
||||||
form.content, form.fileName, form.oldLineNumber, form.newLineNumber, form.issueId.isDefined)
|
form.content, form.fileName, form.oldLineNumber, form.newLineNumber, form.issueId.isDefined)
|
||||||
if (form.issueId.isDefined)
|
form.issueId match {
|
||||||
recordCommentPullRequestActivity(repository.owner, repository.name, context.loginAccount.get.userName, form.issueId.get, form.content)
|
case Some(issueId) => recordCommentPullRequestActivity(repository.owner, repository.name, context.loginAccount.get.userName, issueId, form.content)
|
||||||
else
|
case None => recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
||||||
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
}
|
||||||
helper.html.commitcomment(getCommitComment(repository.owner, repository.name, commentId.toString).get,
|
helper.html.commitcomment(getCommitComment(repository.owner, repository.name, commentId.toString).get,
|
||||||
hasWritePermission(repository.owner, repository.name, context.loginAccount), repository)
|
hasWritePermission(repository.owner, repository.name, context.loginAccount), repository)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ $(function(){
|
|||||||
var commitId = $this.closest('.table-bordered').attr('commitId'),
|
var commitId = $this.closest('.table-bordered').attr('commitId'),
|
||||||
fileName = $this.closest('.table-bordered').attr('fileName'),
|
fileName = $this.closest('.table-bordered').attr('fileName'),
|
||||||
oldLineNumber, newLineNumber = $this.closest('.newline').clone().children().remove().end().text(),
|
oldLineNumber, newLineNumber = $this.closest('.newline').clone().children().remove().end().text(),
|
||||||
url = '@url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName @if(issueId.isDefined){+ '&issueId=@issueId.get'};
|
url = '@url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName@issueId.map { id => + '&issueId=@id' };
|
||||||
if (viewType == 0) {
|
if (viewType == 0) {
|
||||||
oldLineNumber = $this.closest('.oldline').clone().children().remove().end().text();
|
oldLineNumber = $this.closest('.oldline').clone().children().remove().end().text();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -29,10 +29,10 @@
|
|||||||
<input type="submit" class="btn btn-success" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
|
<input type="submit" class="btn btn-success" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if(issueId.isDefined){<input type="hidden" name="issueId" value="@issueId.get">}
|
@issueId.map { issueId => <input type="hidden" name="issueId" value="@issueId"> }
|
||||||
@if(fileName.isDefined){<input type="hidden" name="fileName" value="@fileName.get">}
|
@fileName.map { fileName => <input type="hidden" name="fileName" value="@fileName"> }
|
||||||
@if(oldLineNumber.isDefined){<input type="hidden" name="oldLineNumber" value="@oldLineNumber.get">}
|
@oldLineNumber.map { oldLineNumber => <input type="hidden" name="oldLineNumber" value="@oldLineNumber"> }
|
||||||
@if(newLineNumber.isDefined){<input type="hidden" name="newLineNumber" value="@newLineNumber.get">}
|
@newLineNumber.map { newLineNumber => <input type="hidden" name="newLineNumber" value="@newLineNumber"> }
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
$('.btn-inline-comment').click(function(e) {
|
$('.btn-inline-comment').click(function(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user