Closed Bug 1321068 Opened 8 years ago Closed 7 years ago

"reviewed"/"not reviewed" controls disappeared

Categories

(MozReview Graveyard :: Review Board: DiffViewer, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Assigned: glob)

Details

Attachments

(2 files)

Waldo just noted that the controls to mark a file as reviewed/not reviewed are missing.  Seems likely that something that went out this week broke it, e.g. bug 1251286.
Assignee: nobody → glob
Component: General → Review Board: DiffViewer
ah; this worked by adding work items to the end of the 'diff_files' funcqueue, which is no longer processed.
Comment on attachment 8815618 [details]
mozreview: add 'reviewed' buttons via events (bug 1321068)

https://reviewboard.mozilla.org/r/96496/#review96812

::: pylib/mozreview/mozreview/static/mozreview/js/init_filediffreviewer.js:60
(Diff revision 1)
>        return 'not reviewed';
>      }
>    };
>  
> -  var renderDiffButton = function() {
> -    $.funcQueue('diff_files').add(function() {
> +  var renderDiffButton = function(fileDiffID) {
> +    fileDiffReviewerCollection.each(function(diffReviewable) {

Instead of an `each` with a few different conditions where we just `return`, what are your thoughts on using `filter`?

```js
var relevantDiffs = fileDiffReviewerCollection.filter(function(diffReviewable) {
  return diffReviewable.get('file_diff_id') == fileDiffID && document.getElementById('file' + fileDiffID);
});
```

That could cut down on the complexity within the `each` a bit.
Comment on attachment 8815618 [details]
mozreview: add 'reviewed' buttons via events (bug 1321068)

https://reviewboard.mozilla.org/r/96496/#review96812

> Instead of an `each` with a few different conditions where we just `return`, what are your thoughts on using `filter`?
> 
> ```js
> var relevantDiffs = fileDiffReviewerCollection.filter(function(diffReviewable) {
>   return diffReviewable.get('file_diff_id') == fileDiffID && document.getElementById('file' + fileDiffID);
> });
> ```
> 
> That could cut down on the complexity within the `each` a bit.

good idea.

i'll go a step further - we're selecting by id so we should be using .find to return a single diffReviewable object.
Comment on attachment 8815613 [details]
mozreview: trigger an event when a filediff is loaded (bug 1321068)

https://reviewboard.mozilla.org/r/96488/#review97742
Attachment #8815613 - Flags: review?(dwalsh) → review+
Comment on attachment 8815618 [details]
mozreview: add 'reviewed' buttons via events (bug 1321068)

https://reviewboard.mozilla.org/r/96496/#review100370

Worked wonderfully for me!
Attachment #8815618 - Flags: review?(dwalsh) → review+
Pushed by mcote@mozilla.com:
https://hg.mozilla.org/webtools/reviewboard/rev/8c09c3912c62
mozreview: trigger an event when a filediff is loaded r=davidwalsh
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Pushed by mcote@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/04b0741a1b88
mozreview: add 'reviewed' buttons via events r=davidwalsh
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: