Compare commits

...

5 Commits

Author SHA1 Message Date
Naoki Takezoe
976202be0a Update README.md 2017-12-07 01:15:51 +09:00
Naoki Takezoe
a07576525c Bump to 4.19.3 2017-12-06 14:41:48 +09:00
Naoki Takezoe
f9c3607370 Fix comment reply form behavior in the diff view (#1796) 2017-12-06 14:39:25 +09:00
Naoki Takezoe
7078f32d1c Fix diff class attribute in split mode 2017-12-06 14:39:19 +09:00
Naoki Takezoe
c51fd7a7cd Fix file uploading issue 2017-12-06 14:39:09 +09:00
9 changed files with 72 additions and 50 deletions

View File

@@ -71,6 +71,11 @@ Support
What's New in 4.19.x
-------------
### 4.19.3 - 7 Dec 2017
- Fix file uploading bug
- Fix reply comment form behavior in the diff view
### 4.19.2 - 3 Dec 2017
- Fix routing bug in `CompositeScalatraFilter`

View File

@@ -3,7 +3,7 @@ import com.typesafe.sbt.pgp.PgpKeys._
val Organization = "io.github.gitbucket"
val Name = "gitbucket"
val GitBucketVersion = "4.19.2"
val GitBucketVersion = "4.19.3"
val ScalatraVersion = "2.6.1"
val JettyVersion = "9.4.7.v20170914"

View File

@@ -46,5 +46,6 @@ object GitBucketCoreModule extends Module("gitbucket-core",
new Version("4.18.0"),
new Version("4.19.0"),
new Version("4.19.1"),
new Version("4.19.2")
new Version("4.19.2"),
new Version("4.19.3")
)

View File

@@ -116,6 +116,7 @@ class FileUploadController extends ScalatraServlet with FileUploadSupport with R
case Some(file) if(mimeTypeChcker(file.name)) =>
defining(FileUtil.generateFileId){ fileId =>
f(file, fileId)
contentType = "text/plain"
Ok(fileId)
}
case _ => BadRequest()

View File

@@ -36,18 +36,22 @@ class CompositeScalatraFilter extends Filter {
requestPath + "/"
}
filters
.filter { case (_, path) =>
val start = path.replaceFirst("/\\*$", "/")
checkPath.startsWith(start)
}
.foreach { case (filter, _) =>
val mockChain = new MockFilterChain()
filter.doFilter(request, response, mockChain)
if(mockChain.continue == false){
return ()
if(!checkPath.startsWith("/upload/") && !checkPath.startsWith("/git/") && !checkPath.startsWith("/git-lfs/") &&
!checkPath.startsWith("/plugin-assets/") && !checkPath.startsWith("/console/")){
filters
.filter { case (_, path) =>
val start = path.replaceFirst("/\\*$", "/")
checkPath.startsWith(start)
}
}
.foreach { case (filter, _) =>
val mockChain = new MockFilterChain()
filter.doFilter(request, response, mockChain)
if(mockChain.continue == false){
return ()
}
}
}
chain.doFilter(request, response)
}
@@ -62,8 +66,8 @@ class MockFilterChain extends FilterChain {
}
}
class FilterChainFilter(chain: FilterChain) extends Filter {
override def init(filterConfig: FilterConfig): Unit = ()
override def destroy(): Unit = ()
override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
}
//class FilterChainFilter(chain: FilterChain) extends Filter {
// override def init(filterConfig: FilterConfig): Unit = ()
// override def destroy(): Unit = ()
// override def doFilter(request: ServletRequest, response: ServletResponse, mockChain: FilterChain) = chain.doFilter(request, response)
//}

View File

@@ -232,7 +232,6 @@ $(function(){
var $this = $(this);
var $tr = $this.closest('tr');
var $check = $this.closest('table:not(.diff)').find('.toggle-notes');
//var url = '';
if (!$check.prop('checked')) {
$check.prop('checked', true).trigger('change');
}

View File

@@ -186,11 +186,7 @@ $(function(){
$content = $('#issueContent');
}
$.get(url,
{
dataType : 'html'
},
function(data){
$.get(url, { dataType : 'html' }, function(data){
$content.empty().html(data);
});
return false;
@@ -198,8 +194,7 @@ $(function(){
$('.issue-comment-box i.octicon-x').click(function(){
if(confirm('Are you sure you want to delete this?')) {
var id = $(this).closest('a').data('comment-id');
$.post('@helpers.url(repository)/issue_comments/delete/' + id,
function(data){
$.post('@helpers.url(repository)/issue_comments/delete/' + id, function(data){
if(data > 0) {
$('#comment-' + id).remove();
}
@@ -213,22 +208,24 @@ $(function(){
var url = '@helpers.url(repository)/commit_comments/_data/' + id;
var $content = $('.commit-commentContent-' + id, $(this).closest('.commit-comment-box'));
$.get(url,
{
dataType : 'html'
},
function(data){
$.get(url, { dataType : 'html' }, function(data){
$content.empty().html(data);
});
return false;
});
$(document).on('click', '.commit-comment-box i.octicon-x', function(){
if(confirm('Are you sure you want to delete this?')) {
var id = $(this).closest('a').data('comment-id');
$.post('@helpers.url(repository)/commit_comments/delete/' + id,
function(data){
if(data > 0) {
$('.commit-comment-' + id).closest('.not-diff').remove();
var comment = $('.commit-comment-' + id).closest('.not-diff');
if(comment.prev('.not-diff').length == 0){
comment.next('.not-diff').find('.reply-comment').remove();
}
comment.remove();
}
});
}
@@ -260,10 +257,7 @@ $(function(){
var $commentContent = $(ev.target).parents('div[class*=commit-commentContent-]'),
commentId = $commentContent.attr('class').match(/commit-commentContent-.+/)[0].replace(/commit-commentContent-/, ''),
checkboxes = $commentContent.find(':checkbox');
$.get('@helpers.url(repository)/commit_comments/_data/' + commentId,
{
dataType : 'html'
},
$.get('@helpers.url(repository)/commit_comments/_data/' + commentId, { dataType : 'html' },
function(responseContent){
$.ajax({
url: '@helpers.url(repository)/commit_comments/edit/' + commentId,
@@ -283,10 +277,7 @@ $(function(){
@if(issue.isDefined){
$('#issueContent').on('click', ':checkbox', function(ev){
var checkboxes = $('#issueContent :checkbox');
$.get('@helpers.url(repository)/issues/_data/@issue.get.issueId',
{
dataType : 'html'
},
$.get('@helpers.url(repository)/issues/_data/@issue.get.issueId', { dataType : 'html' },
function(responseContent){
$.ajax({
url: '@helpers.url(repository)/issues/edit/@issue.get.issueId',
@@ -304,10 +295,7 @@ $(function(){
var $commentContent = $(ev.target).parents('div[id^=commentContent-]'),
commentId = $commentContent.attr('id').replace(/commentContent-/, ''),
checkboxes = $commentContent.find(':checkbox');
$.get('@helpers.url(repository)/issue_comments/_data/' + commentId,
{
dataType : 'html'
},
$.get('@helpers.url(repository)/issue_comments/_data/' + commentId, { dataType : 'html' },
function(responseContent){
$.ajax({
url: '@helpers.url(repository)/issue_comments/edit/' + commentId,

View File

@@ -71,8 +71,19 @@
// Show reply comment form
var replyComment = $tr.prev().find('.reply-comment').closest('.not-diff').show();
replyComment.remove();
$tr.after(replyComment);
if(replyComment.length != 0){
replyComment.remove();
$tr.after(replyComment);
} else {
var $v = $('<div class="commit-comment-box reply-comment-box">')
.append($('<input type="text" class="form-control reply-comment" placeholder="Reply...">')
.data('filename', '@fileName')
.data('newline', @newLineNumber.getOrElse("undefined"))
.data('oldline', @oldLineNumber.getOrElse("undefined")));
var tmp = getInlineContainer();
tmp.children('td:last').html($v)
$tr.after(tmp);
}
$('#comment-list').append(data);
if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) {
@@ -82,6 +93,19 @@
$('.btn-inline-comment').removeAttr('disabled');
$('#error-content', $form).html($.parseJSON(req.responseText).content);
});
})
});
function getInlineContainer() {
console.log(window.viewType);
if (window.viewType == 0) {
if(@newLineNumber.isDefined){
return $('<tr class="not-diff"><td colspan="2"></td><td colspan="2" class="comment-box-container"></td></tr>');
}
if(@oldLineNumber.isDefined){
return $('<tr class="not-diff"><td colspan="2" class="comment-box-container"></td><td colspan="2"></td></tr>');
}
}
return $('<tr class="not-diff"><td colspan="3" class="comment-box-container"></td></tr>');
}
</script>
}

View File

@@ -149,7 +149,7 @@ $.extend(JsDiffRender.prototype,{
$('<tr>').append(
lineNum('old',o.base, o.change),
$('<td class="body">').html(o.base ? baseTextDom(o.base): "").addClass(o.change),
lineNum('old',o.head, o.change),
lineNum('new',o.head, o.change),
$('<td class="body">').html(o.head ? headTextDom(o.head): "").addClass(o.change)
).appendTo(tbody);
break;
@@ -158,7 +158,7 @@ $.extend(JsDiffRender.prototype,{
$('<tr>').append(
lineNum('old',o.base, 'delete'),
$('<td class="body">').append(ld.base).addClass('delete'),
lineNum('old',o.head, 'insert'),
lineNum('new',o.head, 'insert'),
$('<td class="body">').append(ld.head).addClass('insert')
).appendTo(tbody);
break;
@@ -379,7 +379,7 @@ function string_score(string, word) {
strLength = string.length,
lWord = word.toUpperCase(),
wordLength = word.length;
return calc(zero, 0, 0, 0, 0, []);
function calc(score, startAt, skip, runningScore, i, matchingPositions){
if( i < wordLength) {