11 Commits

Author SHA1 Message Date
Becky Siegel
21ad8d38c7 Update gr-comment-api to get comments grouped by thread
Change-Id: Id6f1ca24b17137ea89a7f6ba24f62179f0aecb30
2018-02-02 11:07:07 -08:00
Wyatt Allen
d43a506086 Follow up to I42b2afe013
Change-Id: I47ee07fa5d759e8c7633c63aa0c1a218df891209
2017-11-14 15:38:16 -08:00
Wyatt Allen
e000536c38 Involve parent in base patch comment filter
In merge changes, comments on a specific parent should not appear in the
non-specific auto-merge base patch. The CommentInfo field that indicates
this was formerly not taken into consideration.

Change-Id: I42b2afe013c0fc3a04dd1583d7677c6825e2c8af
2017-11-14 18:14:45 +00:00
Becky Siegel
a0764826eb Merge "Add more helper functions to gr-comment-api" 2017-11-10 23:22:42 +00:00
Becky Siegel
57e4fb3b8a Add more helper functions to gr-comment-api
These will be consumed by the file list, patch range dropdown, and diff
file selector.

Change-Id: Icec8baf9c44abedfe3128157e15d5bd46ff3259a
2017-11-10 13:59:38 -08:00
Becky Siegel
2033dfd1ec Add reloadDrafts function in gr-comment-api
This function also re-initializes a ChangeComment object, but uses the
old values for comments and robot comments, and only makes a request for
new drafts.

It's response is identical to loadAll for the purposes of elements using
these functions, but will reduce unneeded API calls.

Change-Id: I3c0872b86a0e24c9c378acf3311fe8cc3e078eda
2017-11-09 14:45:13 -08:00
Becky Siegel
26b9c4966a Fix draft comments not showing up on reply dialog
This was overlooked here:
https://gerrit-review.googlesource.com/c/gerrit/+/138190/19/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js#b1070

As drafts were retrieved but not populated into _diffDrafts as expected
for the reply dialog. This change fixes the issue by setting diffDrafts
when all comments are loaded/reloaded.

Bug: Issue 7695
Change-Id: I9756e93d44dceb7c1fb8f66a6998fefd409ae9a0
2017-11-08 10:58:38 -08:00
Becky Siegel
c7f07dca19 Update gr-comment-api
Previously, nested components (that are never standalone) were making
their own requests for comments, creating unecessary duplicate API
requests.

Some requests were made to the rest API directly (for example,
gr-change-view requested comments this way), and some were through the
gr-comment-api, which also helped handle comment manipulation and
reorganization.

Instead of ad-hoc comment requesting, move all comment requests to the
top level (standalone) component, and use an object prototype to
generate _changeComments as a property on gr-comment-api. This is an
immutable object that can be passed to the inner components
(file list, etc), and includes the methods needed to manipulate
comments into the forms
necessary.

When a child component needs to trigger a refresh of the comments, fire
an event that the parent event handles (see gr-file-list l.867).

Bug: Issue 6953
Change-Id: Ic4b6cf16520baae65d8cf956c311a60f2a70a2e1
2017-11-06 14:31:59 -08:00
Becky Siegel
8d92d53db5 Annotation updates
Change-Id: I146f76b9dcc1a92e18acec01481ad280fb431868
2017-08-12 11:49:52 -07:00
Wyatt Allen
c61ba25b11 Coalesce request for drafts with login check
Because requests for a user's draft diff comments is always nested
within a check for whether a user is logged in, these can be combined
into the same REST API interface call. The updated call is given a JSDoc
to describe the additional functionality and call sites are simplified.

Change-Id: Idc0cc6298c7287579ba76e7cc35701e62142bca3
2017-08-01 14:18:39 -07:00
Wyatt Allen
dc8782d762 Centralized comment requests
Formerly, gr-diff would make its own REST calls for diff comments in the
patch range and path being viewed. However, these calls by the diff view
were redundant to the more general comment requests made by either
gr-diff-view (which requests all comments to support skipping to the
next file with comments) or gr-change-view (which requests comments
individually for each inline diff).

With this change, the diff component no longer loads comments for
itself, but is rather provided the comments from its host view via a
public property. In this way the host view can load the more-general
comment data, and filter it down for the diff view's params.

Introduces the gr-comment-api component to simplify loading and
filtering diff comments for use by diff views. By using this new
component:
* The diff view makes only one request for comments (including drafts
  and robot comments) to support skipping to the next comment and
  displaying comments in the diff view.
* The change view makes only one request for comments for all inline
  diffs.

Bug: Issue 5299
Change-Id: Ia14a01619f1f9881aa0d253fd3f49af9a17f3dce
2017-08-01 14:15:38 -07:00