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 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 ### 4.19.2 - 3 Dec 2017
- Fix routing bug in `CompositeScalatraFilter` - Fix routing bug in `CompositeScalatraFilter`

View File

@@ -3,7 +3,7 @@ import com.typesafe.sbt.pgp.PgpKeys._
val Organization = "io.github.gitbucket" val Organization = "io.github.gitbucket"
val Name = "gitbucket" val Name = "gitbucket"
val GitBucketVersion = "4.19.2" val GitBucketVersion = "4.19.3"
val ScalatraVersion = "2.6.1" val ScalatraVersion = "2.6.1"
val JettyVersion = "9.4.7.v20170914" 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.18.0"),
new Version("4.19.0"), new Version("4.19.0"),
new Version("4.19.1"), 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)) => case Some(file) if(mimeTypeChcker(file.name)) =>
defining(FileUtil.generateFileId){ fileId => defining(FileUtil.generateFileId){ fileId =>
f(file, fileId) f(file, fileId)
contentType = "text/plain"
Ok(fileId) Ok(fileId)
} }
case _ => BadRequest() case _ => BadRequest()

View File

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

View File

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

View File

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

View File

@@ -71,8 +71,19 @@
// Show reply comment form // Show reply comment form
var replyComment = $tr.prev().find('.reply-comment').closest('.not-diff').show(); var replyComment = $tr.prev().find('.reply-comment').closest('.not-diff').show();
replyComment.remove(); if(replyComment.length != 0){
$tr.after(replyComment); 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); $('#comment-list').append(data);
if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) { if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) {
@@ -82,6 +93,19 @@
$('.btn-inline-comment').removeAttr('disabled'); $('.btn-inline-comment').removeAttr('disabled');
$('#error-content', $form).html($.parseJSON(req.responseText).content); $('#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> </script>
} }

View File

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