57 Commits

Author SHA1 Message Date
Wyatt Allen
7a4aa8cc81 Save comment drafts locally if they are abandoned
If the user starts writing a diff comment, but discards it or navigates
away before saving it as a draft, then the text that had been entered
re-appears if the user starts a comment on the same line of the same
file of the same patch-set of the same change.

Achieves this by storing the comment text in localStorage along with a
timestamp whenever the textarea is edited by the user. The entry is
cleared from localStorage if the user saves the comment as a draft. When
a new comment is started, the gr-diff-comment checks localStorage to see
whether a relevant entry exists to use as the initial text.

Adds the gr-storage element as an interface for localStorage. This
element clears away stored comment drafts if they are more than a day
old.

Bug: Issue 3787
Change-Id: I11327a69d463a6a84a0cd8d59f4662a6a4c296a6
2016-05-23 11:04:25 -07:00
Andrew Bonventre
28165262dc Update reply counter when adding drafts to inline diffs
Also do a small cleanup of _boundScrollHandler in favor of
Polymer.{listen|unlisten}

Bug: Issue 4119
Change-Id: I16e0f74dd3f480f99b837cdf6664603a94dcc06f
2016-05-20 13:09:53 -07:00
Andrew Bonventre
8f2310717b Show network and server errors in a toast 🍞 notification
gr-error-manager is introduced to deal with error events
fired from gr-rest-api-interface. Currently it will display
the first error it sees for 5 seconds, ignoring others during
that time. If a response comes back as a 403, it prompts the
user to refresh the page and the alert remains on the screen
indefinitely.

Bug: Issue 3992
Bug: Issue 3953
Change-Id: I4a54eb1e865b88f9a5531e864e0b1d58d638a4cd
2016-05-05 11:37:31 -04: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
2aa22125b6 Move gr-diff-new to gr-diff
Change-Id: Ifaad016f806c31f3df43143b3238b757faa18b20
2016-03-25 17:56:08 -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
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