OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // https://codereview.chromium.org/api/148223004/?messages=true | 7 // https://codereview.chromium.org/api/148223004/?messages=true |
8 // TODO(esprehn): support loading all drafts by parsing /publish and then doing
PatchFile.loadDrafts() | 8 // TODO(esprehn): support loading all drafts by parsing /publish and then doing
PatchFile.loadDrafts() |
9 function Issue(id) | 9 function Issue(id) |
10 { | 10 { |
11 this.description = ""; | 11 this.description = ""; |
12 this.cc = []; // Array<User> | 12 this.cc = []; // Array<User> |
13 this.reviewers = []; // Array<User> | 13 this.reviewers = []; // Array<User> |
14 this.messages = []; // Array<IssueMessage> | 14 this.messages = []; // Array<IssueMessage> |
15 this.messageCount = 0; | 15 this.messageCount = 0; |
16 this.draftCount = 0; | 16 this.draftCount = 0; |
17 this.owner = null; // User | 17 this.owner = null; // User |
18 this.private = false; | 18 this.private = false; |
19 this.baseUrl = ""; | 19 this.baseUrl = ""; |
| 20 this.targetRef = ""; |
20 this.subject = ""; | 21 this.subject = ""; |
21 this.created = ""; // Date | 22 this.created = ""; // Date |
22 this.patchsets = []; // Array<PatchSet> | 23 this.patchsets = []; // Array<PatchSet> |
23 this.draftPatchsets = []; // Array<DraftPatchSet> | 24 this.draftPatchsets = []; // Array<DraftPatchSet> |
24 this.lastModified = ""; // Date | 25 this.lastModified = ""; // Date |
25 this.closed = false; | 26 this.closed = false; |
26 this.commit = false; | 27 this.commit = false; |
27 this.id = id || 0; | 28 this.id = id || 0; |
28 this.scores = {}; // Map<email, (-1, 1)> | 29 this.scores = {}; // Map<email, (-1, 1)> |
29 this.approvalCount = 0; | 30 this.approvalCount = 0; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return issue; | 91 return issue; |
91 }); | 92 }); |
92 }; | 93 }; |
93 | 94 |
94 Issue.prototype.parseData = function(data) | 95 Issue.prototype.parseData = function(data) |
95 { | 96 { |
96 var issue = this; | 97 var issue = this; |
97 if (this.id !== data.issue) | 98 if (this.id !== data.issue) |
98 throw new Error("Incorrect issue loaded " + this.id + " != " + data.issu
e); | 99 throw new Error("Incorrect issue loaded " + this.id + " != " + data.issu
e); |
99 this.baseUrl = data.base_url || ""; | 100 this.baseUrl = data.base_url || ""; |
| 101 this.targetRef = data.target_ref || ""; |
100 this.closed = data.closed || false; | 102 this.closed = data.closed || false; |
101 this.commit = data.commit || false; | 103 this.commit = data.commit || false; |
102 this.created = Date.utc.create(data.created); | 104 this.created = Date.utc.create(data.created); |
103 this.description = data.description || ""; | 105 this.description = data.description || ""; |
104 this.lastModified = Date.utc.create(data.modified); | 106 this.lastModified = Date.utc.create(data.modified); |
105 this.owner = User.forName(data.owner, data.owner_email); | 107 this.owner = User.forName(data.owner, data.owner_email); |
106 this.private = data.private; | 108 this.private = data.private; |
107 this.subject = data.subject || ""; | 109 this.subject = data.subject || ""; |
108 this.cc = (data.cc || []).map(function(email) { | 110 this.cc = (data.cc || []).map(function(email) { |
109 return User.forMailingListEmail(email); | 111 return User.forMailingListEmail(email); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 }); | 333 }); |
332 this.draftPatchsets = []; | 334 this.draftPatchsets = []; |
333 this.patchsets.forEach(function(patchset) { | 335 this.patchsets.forEach(function(patchset) { |
334 if (!patchset.draftCount) | 336 if (!patchset.draftCount) |
335 return; | 337 return; |
336 var draftPatchset = draftPatchsets[patchset.sequence] || new DraftPatchS
et(patchset); | 338 var draftPatchset = draftPatchsets[patchset.sequence] || new DraftPatchS
et(patchset); |
337 draftPatchset.updateFiles(); | 339 draftPatchset.updateFiles(); |
338 this.draftPatchsets.push(draftPatchset); | 340 this.draftPatchsets.push(draftPatchset); |
339 }, this); | 341 }, this); |
340 }; | 342 }; |
OLD | NEW |