mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Add support for "Show/Hide outdated"
Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
		@@ -853,8 +853,13 @@ func fetchCodeCommentsByReview(e Engine, issue *Issue, currentUser *User, review
 | 
			
		||||
		IssueID:  issue.ID,
 | 
			
		||||
		ReviewID: review.ID,
 | 
			
		||||
	}
 | 
			
		||||
	conds := opts.toConds()
 | 
			
		||||
	if review.ID == 0 {
 | 
			
		||||
		conds.And(builder.Eq{"invalidated": false})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var comments []*Comment
 | 
			
		||||
	if err := e.Where(opts.toConds().And(builder.Eq{"invalidated": false})).
 | 
			
		||||
	if err := e.Where(conds).
 | 
			
		||||
		Asc("comment.created_unix").
 | 
			
		||||
		Asc("comment.id").
 | 
			
		||||
		Find(&comments); err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -764,6 +764,8 @@ issues.review.comment = "reviewed %s"
 | 
			
		||||
issues.review.reject = "rejected these changes %s"
 | 
			
		||||
issues.review.pending = Pending
 | 
			
		||||
issues.review.review = Review
 | 
			
		||||
issues.review.show_outdated = Show outdated
 | 
			
		||||
issues.review.hide_outdated = Hide outdated
 | 
			
		||||
 | 
			
		||||
pulls.desc = Enable merge requests and code reviews.
 | 
			
		||||
pulls.new = New Pull Request
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -762,6 +762,23 @@ function initRepository() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function initPullRequestReview() {
 | 
			
		||||
    $('.show-outdated').on('click', function (e) {
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
        var id = $(this).data('comment');
 | 
			
		||||
        $(this).addClass("hide");
 | 
			
		||||
        $("#code-comments-" + id).removeClass('hide');
 | 
			
		||||
        $("#code-preview-" + id).removeClass('hide');
 | 
			
		||||
        $("#hide-outdated-" + id).removeClass('hide');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('.hide-outdated').on('click', function (e) {
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
        var id = $(this).data('comment');
 | 
			
		||||
        $(this).addClass("hide");
 | 
			
		||||
        $("#code-comments-" + id).addClass('hide');
 | 
			
		||||
        $("#code-preview-" + id).addClass('hide');
 | 
			
		||||
        $("#show-outdated-" + id).removeClass('hide');
 | 
			
		||||
    });
 | 
			
		||||
    if ($('.repository.pull.diff').length == 0) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -442,7 +442,7 @@ footer {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.hide {
 | 
			
		||||
    display: none;
 | 
			
		||||
    display: none !important;
 | 
			
		||||
}
 | 
			
		||||
.center {
 | 
			
		||||
    text-align: center;
 | 
			
		||||
 
 | 
			
		||||
@@ -260,14 +260,20 @@
 | 
			
		||||
				{{range $line, $comms := $lines}}
 | 
			
		||||
						<div class="ui segments">
 | 
			
		||||
							<div class="ui segment">
 | 
			
		||||
							{{if (index $comms 0).Invalidated}}
 | 
			
		||||
								<button class="ui icon button">
 | 
			
		||||
									<i class="indend icon"></i>
 | 
			
		||||
								{{$invalid := (index $comms 0).Invalidated}}
 | 
			
		||||
							{{if $invalid}}
 | 
			
		||||
								<button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="ui compact right labeled button show-outdated">
 | 
			
		||||
									<i class="octicon octicon-fold"></i>
 | 
			
		||||
									{{$.i18n.Tr "repo.issues.review.show_outdated"}}
 | 
			
		||||
								</button>
 | 
			
		||||
								<button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="hide ui compact right labeled button hide-outdated">
 | 
			
		||||
									<i class="octicon octicon-fold"></i>
 | 
			
		||||
									{{$.i18n.Tr "repo.issues.review.hide_outdated"}}
 | 
			
		||||
								</button>
 | 
			
		||||
							{{end}}
 | 
			
		||||
								<code>{{$filename}}</code>
 | 
			
		||||
							</div>
 | 
			
		||||
							<div class="ui table segment">
 | 
			
		||||
							<div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $invalid}} hide{{end}}">
 | 
			
		||||
								<div class="diff-file-box diff-box file-content tab-size-8">
 | 
			
		||||
									<div class="file-body file-code code-view code-diff code-diff-unified">
 | 
			
		||||
										<table>
 | 
			
		||||
@@ -387,7 +393,7 @@
 | 
			
		||||
									</div>
 | 
			
		||||
								</div>
 | 
			
		||||
							</div>
 | 
			
		||||
							<div class="ui segment">
 | 
			
		||||
							<div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $invalid}} hide{{end}}">
 | 
			
		||||
								<div class="ui comments">
 | 
			
		||||
									{{range $comms}}
 | 
			
		||||
										{{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user