MozReview: Don't open issues by default whe comment is a reply. (
Bug 1326043) r=mars,mcote
MozReview-Commit-ID: do8UJJCpJs
--- a/reviewboard/reviewboard/static/rb/js/models/commentEditorModel.js
+++ b/reviewboard/reviewboard/static/rb/js/models/commentEditorModel.js
@@ -14,16 +14,17 @@ RB.CommentEditor = Backbone.Model.extend
return {
canDelete: false,
canEdit: undefined,
canSave: false,
editing: false,
extraData: {},
comment: null,
dirty: false,
+ isReply: false,
openIssue: userSession.get('commentsOpenAnIssue'),
publishedComments: [],
publishedCommentsType: null,
reviewRequest: null,
richText: userSession.get('defaultUseRichText'),
text: ''
};
},
@@ -239,17 +240,17 @@ RB.CommentEditor = Backbone.Model.extend
* value if it's true, and we'll fall back on the comment's value
* if false. This is so that we can keep a consistent experience
* when the "Always edit Markdown by default" value is set.
*/
this.set({
dirty: false,
extraData: comment.get('extraData'),
openIssue: comment.get('issueOpened') === null
- ? this.defaults().openIssue
+ ? (this.get('isReply') ? false : this.defaults().openIssue)
: comment.get('issueOpened'),
richText: defaultRichText || !!comment.get('richText')
});
/*
* We'll try to set the one from the appropriate text fields, if it
* exists and is not empty. If we have this, then it came from a
* previous save. If we don't have it, we'll fall back to "text",
--- a/reviewboard/reviewboard/static/rb/js/views/commentDialogView_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/views/commentDialogView_mozreview.js
@@ -605,16 +605,17 @@ RB.CommentDialogView = Backbone.View.ext
reviewRequestEditor =
options.reviewRequestEditor ||
RB.PageManager.getPage().reviewRequestEditor,
commentIssueManager =
options.commentIssueManager ||
reviewRequestEditor.get('commentIssueManager'),
beside,
dlg,
+ publishedComments,
x,
y;
function showCommentDlg() {
try {
dlg.open();
} catch(e) {
dlg.close();
@@ -622,27 +623,29 @@ RB.CommentDialogView = Backbone.View.ext
}
RB.CommentDialogView._instance = dlg;
}
console.assert(options.comment, 'A comment must be specified');
options = options || {};
+ publishedComments = options.publishedComments;
dlg = new RB.CommentDialogView({
animate: options.animate,
commentIssueManager: commentIssueManager,
model: new RB.CommentEditor({
comment: options.comment,
reviewRequest: reviewRequestEditor.get('reviewRequest'),
reviewRequestEditor: reviewRequestEditor,
- publishedComments: options.publishedComments || undefined,
+ publishedComments: publishedComments || undefined,
publishedCommentsType: options.publishedCommentsType ||
- undefined
+ undefined,
+ isReply: publishedComments && publishedComments.length > 0
})
});
dlg.render().$el
.css('z-index', 999) // XXX Use classes for z-indexes.
.appendTo(options.container || document.body);
options.position = options.position || {};