21 Commits

Author SHA1 Message Date
Becky Siegel
1074e868b7 Get unresolved state from thread when it exists for new reply
Currently, when a response is created via keyboard shortcut 'c' or
clicking a line number, the comment is not created with the unresolved
state of the last comment in the thread.

This change checks for the previous state and adds that to the new
draft.

Bug: Issue 5408
Change-Id: I20eb039864120d5175cc016bfc695da564bc174d
2017-02-09 08:02:22 -08:00
Wyatt Allen
23929fc5ff Add null/undefined checks for comment ranges
Change-Id: Ia66529e44b047ca8938708110d75e7bf910e73ae
2017-02-08 10:29:04 -08:00
Becky Siegel
41bdc04cb8 Don't merge threads on same line left/right
Goes along with c/95273/. Adds commentSide attribute to comments to see
which side of the diff view they belong on. This is also used as part
of the locationRange for the gr-diff-comment-thread-group, so that two
thread groups can be on the same line or range for the unified group (
one for the right, one for the left).

Note: there is already a 'side' attribute on the gr-diff-comment, which
is confusing. This side actually references 'PARENT' or 'REVISION', to
identify whether the comment belongs to the parent or any revision. On
diffs where two revisions are compared to each other, this cannot be
used to determine left/right. However, because 'side' is part of
the CommentInfo entity[1], it is difficult to change the name and make
more sense out of that.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info

Bug: Issue 5114
Change-Id: I5cc4c17d4bb134e31e5cc07ff9b08ed349488c97
2017-02-07 21:00:52 +00:00
Kasper Nilsson
87cb82f5a1 Expand unresolved comment threads in diff view by default
This change leverages the unresolved flag to automatically expand only
the last UNRESOLVED_EXPAND_COUNT comments in unresolved threads.

Feature: Issue 4752
Change-Id: Ia23920e1a210246838645d56a6bc81d0dff7da07
2017-01-10 18:42:37 +00:00
Kasper Nilsson
8d1ac7e824 Display comment resolve state
This change tracks and exposes the resolved state of a comment thread
without exposing the UI for modifying that state. This enables features
to be built out while the API request does not exist in the backend.

Feature: Issue 4879
Change-Id: If002035024920a7762519cedf5a869221bbbc3c8
2017-01-09 20:21:48 +00:00
Viktar Donich
d24fa4c371 Merge "Fixes comment issues with multiple editing comments" 2017-01-03 23:15:47 +00:00
Becky Siegel
43c5ed8045 Fixes comment issues with multiple editing comments
This change addresses a few issues that existed due to multiple comments
in an editing state at the same time.

1) Fixes issue where if you create two replies and add text to the
second reply, then delete the first one, the text in the second textarea
gets removed.

2) Fixes issue where if you reply and add text, then reply again with
the first draft still editing, the second draft gets populated with the
message from the first comment.

3) Fixes issue where if you have multiple replies and delete one of
them, local storage gets erased. This change sets local storage to the
value of the first editing message found after deleting the other one
(if it exists).

Bug: Issue 4409
Change-Id: Ib5913a34a79783a4a87b4a298e25b02fc587b8dd
2016-12-28 20:18:41 +00:00
Kasper Nilsson
9e8548b480 Populate in_reply_to field with most recent comment
This change fully removes threading from the PG UI's comments. This is
a side effect of the implementation of resolvable comments.

Change-Id: I67e2a8f896726787857c35552fa8c0a9f629c2ba
2016-12-27 17:48:38 -05:00
Kasper Nilsson
cc518249be Remove threading in comment UI
Sort inline comments in the order that the comments were written.
Formerly comments were sorted in tree order so that reply comments would
appear after their parent. However, this sorting could be confusing
because there would be no other indication that the comments were
associated to a parent. When comments are sorted chronologically, they
appear in the thread position a user would expect.

Change-Id: I4d0722e4511eb53b9b8ab1d61a922d1b142e09ad
2016-12-19 12:03:09 -08:00
Becky Siegel
35a7682262 Add robot comments to PolyGerrit
This change adds an API request to get robot comments for displaying
inline in the diff view. They are styled in a different color, contain
build and robotId information, and a "please fix" action rather than the
standard set of actions.

Feature: Issue 5089
Change-Id: I1f5954a2ed01920bb7c3dc897e3285687ff7d3ca
2016-12-15 11:20:25 -08:00
Aaron Gable
5be3252ead Add an 'Ack' button next to the 'Done' button
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=622838
Change-Id: Ie7db71615e2c657bbf24847cd8e6e2fc7606f5a9
2016-11-30 09:46:48 -08:00
Andrew Bonventre
4d22c7e835 Cleanup: use iron-a11y-keys-behavior for keyboard shortcuts
+ This does not cover on-keydown handlers within elements.
  A follow-up change will account for those.
+ Keyboard shortcuts are disabled within gr-overlay, input,
  and textarea elements.
+ Added tests for new behavior (plus some missing ones covering
  broken behavior).
+ Removed blur hacks used on elements to placate the kb
  shortcuts due to restrictions that have been removed.

Bug: Issue 4198
Change-Id: Ide8009a3bfc340a35a8ec8b9189a85b49c8a95aa
2016-11-17 15:27:59 -08:00
Kasper Nilsson
682895271f Remove one space from indentation in comment quote
In GWTUI, quoted comments are prepended with ' > ' on each line. This
was causing strange formatting issues due to strings being trimmed on
the backend (see issue for more details), and also didn't really make
sense (who prefers 3 space tabs over 2 or 4?). This change removes the
leading space and denotes quote levels with '> '.

Bug: Issue 4811
Change-Id: Iee1a85b5b2f1a4ab46a35110be65a6b4f156eb6a
2016-11-10 10:31:14 -08:00
Becky Siegel
eb4ea184f7 Keyboard shortcuts to expand and collapse all comments
This change adds keyboard shortcuts to the "gr-diff-comment-thread"
expand all comments when 'e' is pressed and collapse all comments when
'shift + e' is pressed. Note that the keyboard event is detected on the
thread instead of the comment to minimize the number of events getting
triggered.

Feature: Issue 4738
Change-Id: Iab77349bd1527d7af5e05a827919a78a86909835
2016-10-12 11:13:56 -07:00
Urs Wolfer
33df005810 Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ic1437333fcf82473ac57f8bdea25ee8188ddbfee
2016-07-15 20:32:27 +02:00
Viktar Donich
a8df3ec075 Add orphan comments as top-level comments
Add comments that are replies to ones missing from comment thread as
top-level comments to the thread instead of discarding.

Change-Id: Ib93fa1c74f1ca004ee2361e017dc1210c42ec399
2016-06-15 16:34:15 -07:00
Viktar Donich
815e82d3c3 Update comment thread model on comment update
Update comments collection in gr-diff-comment-thread when its child
comment changes. Child comment is expected to send comment-update
event.

Change-Id: I8116820679b29b7511719f95ae73b48e2345102c
2016-06-15 09:07:17 -07:00
Andrew Bonventre
180693c180 gr-request/gr-ajax cleanup (gr-diff-comment)
Bug: Issue 3988
Change-Id: I0c100a0b77a256c1eb34f94e8fff0515add5dea1
2016-05-04 12:25:15 -04:00
Andrew Bonventre
6a9312f7b1 Properly remove discarded comments from model in gr-new-diff
Change-Id: Icb5d3ba1edd2cd3a75aa6568a152bacc5e0babda
2016-03-25 16:17:06 +00:00
Andrew Bonventre
02f71327cf Add comments/drafts to gr-new-diff
Change-Id: I8110b521ab83a31be5db7e3d65268186485db04d
2016-03-22 11:55:03 -04:00
Andrew Bonventre
78792e8e98 Refactor directory structure of components
There is no change in functionality. Only moving things around.

+ Separate html from the js.
+ Place the unit test for a component within the same folder.
+ Organize the components in subfolders.

Change-Id: I51fdc510db75fc1b33f040ca63decbbdfd4d5513
2016-03-04 18:02:24 -05:00