This reverts commit 39777363a63c603cfa68ca52d2f3c99eb04f2f46.
Reason for revert: the frontend part of this change doesn't work.
Change-Id: I53138e939a1b98578787457e48743fdc8abf658c
This adds a user preference such that we only send plaintext emails to
this user. It also adds docs and tests.
For the user, this comes at the cost of not being in the same email
thread as the users who receive HTML emails. We decided to send out
plaintext emails on a one-by-one basis instead of making one thread (as
we do with HTML) as this would just create more confusion.
When admins enable inbound email for Gerrit, the aforementioned caveat
isn't a problem anymore as users would email Gerrit anyway instead of
using a notification email as messaging thread.
Change-Id: I3d0fc920c9d81e1a7b707ae5f3f4600a62b8a93b
When changes are queried, we want to return the number of unresolved
comments with each change. This number should be pre-counted rather than
loading all the comments and counting each time.
We also add new search operators, which allow user to query by
"has:unresolved" and "unresolved:<RELATION><NUMBER>".
The 'unresolvedCommentCount' field of 'ChangeData' will be null if
'lazyLoad' is false.
Change-Id: I97c6aeb47db48f56f94c5d184dfa36c8d7868cc8
Also add a test for email deletion and add asserts for the addEmail()
test.
Bug: Issue 5385
Change-Id: I3e192638fdaac58d0cdaa535430bb968d7d32abb
Signed-off-by: Edwin Kempin <ekempin@google.com>
Having a standard tool for formatting saves reviewers' valuable time.
google-java-format is Google's standard formatter and is somewhat
inspired by gofmt[1]. This commit formats everything using
google-java-format version 1.2.
The downside of this one-off formatting is breaking blame. This can be
somewhat hacked around with a tool like git-hyper-blame[2], but it's
definitely not optimal until/unless this kind of feature makes its way
to git core.
Not in this change:
* Tool support, e.g. Eclipse. The command must be run manually [3].
* Documentation of best practice, e.g. new 100-column default.
[1] https://talks.golang.org/2015/gofmt-en.slide#3
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
[3] git ls-files | grep java$ | xargs google-java-format -i
Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Adds PutStatus.java and GetStatus.java for modification of the logged-in
user's status field.
Feature: Issue 4394
Change-Id: Id13241dcd98c46101cea2f2337c1fb731d0465a0
The REST endpoint is added as:
'POST /accounts/{account-id}/external.ids:delete'
The target external ids must be provided in the request body.
Change-Id: Ieef322d6bddc1f3659536081b3f3514474b7162a
For some reason, a Java API for change edits didn't exist previously
even though a detailed REST API has been available. Because of that,
tests needed to use internal classes when they interacted with change
edits. Using internal classes is fragile and impedes refactorings.
That's why we should avoid it.
If possible, the structure and behavior of the tests is kept. Some of
them might and should be improved but that's beyond the scope of this
change. Some of the tests are adapted a bit because the internal
classes allow change edits to be created for previous patch sets
which isn't possible when using the REST API (and hence the Java API).
As modifications to the mentioned internal classes are necessary to
properly implement the 'Apply fix' feature of robot comments, it is
crucial that none of the tests use the internal classes directly.
In addition, the tests which will be added for the 'Apply fix' feature
will also need to modify and query change edits, which will be much
easier with the Java API.
Change-Id: I6b455541d1bc1b7a05b5f0507911181b0451829a
Guava team recommends using the subinterfaces of Multimap, for the
same reasons they recommend using Set and List rather than Collection:
it documents expectations about ordering, uniqueness, and behavior of
equals. Do this across the board in Gerrit.
Mostly this is straightforward and I tried to exactly match existing
behavior where possible. However, there were a few wrinkles, where
different callers passed different subtypes to the same method.
The main one is arguments to ParameterParser#parse and
splitQueryString, where some callers used SetMultimaps (perhaps
semi-intentionally, or perhaps misunderstanding the nature of
HashMultimap). For the purposes of parameter parsing, a ListMultimap
makes more sense, because it preserves argument order and repetition.
Another instance is a couple places in ReceiveCommits and downstream
where there were SetMultimap<?, Ref>. Since Refs do not implement
equals, this is effectively the same thing as a ListMultimap, and
changing the interface no longer misleads readers into thinking there
might be some deduplication happening.
Finally, this change includes a breaking API change to the return
type of ExternalIncludedIn#getIncludedIn.
Change-Id: I5f1d15e27a32e534a6aaefe204e7a31815f4c8d7
Set the 'canDelete' field of external ids to be true if the external id
for the last login is null.
This is different from the old remote JSON service implementation, but it
seems reasonable because an external id should be deletable if the external
id is not a 'SCHEME_USERNAME' and it's not used to login.
And this change will make it much easier for us to test the get/delete
external ids REST API.
Change-Id: I0ab347bddf782b20a3be1826279df5a1ba88c5df
--query and --query2 on GET /groups/ are mutually exclusive. Using
both of these options at the same time already failed because the
QueryGroups REST endpoint was always returned when --query2 was
specified and QueryGroups was rejecting --query with:
"--query" is not a valid option
Change-Id: I89aa4ea8c7f5ed8e354e0cf42635b96aba7ed93e
Signed-off-by: Edwin Kempin <ekempin@google.com>
Add a new endpoint /accounts/{id}/external.ids which will return a
list of the external IDs for the given account. It is only allowed
to get this list for a user's own account.
To determine whether or not the user can delete an external ID, we
need to know if that ID was used to log into the current session.
The WebSession is not available outside of gerrit-httpd, so pass the
external ID through a property on the current user.
Change-Id: Iab7ef2ffa06c3a8d9f22472308051b4b73668f82
* changes:
Index groups that are created during init
Implement group index for ElasticSearch
Add REST endpoint to reindex a single group
Support default query for groups
Add query operator that matches groups that are visible to all users
Add group query operator to match groups by owner
Add group query operator to match groups by description
Support querying groups by name and name part
Set '_more_groups' on last group of query result
Add tests for group index
Groups API: Add query methods
Support arbitrary group queries via REST
Add new optional interface for REST collections to get request params
Add GroupQueryProcessor
IsVisibleToPredicate: Move describe method into base class
Index group on creation and whenever a group is evicted from cache
Initial implementation of group index in Lucene
Add initial GroupQueryBuilder and define key predicate for group index
Add schema and index definitions for groups index
This may become handy to fix single groups that are stale in the
index.
Change-Id: Iab3711f343fe1da9bba4979792edc83c76d75a09
Signed-off-by: Edwin Kempin <ekempin@google.com>
This adds two query operators for group queries:
1. name:
Exact match on the group name (case-insensitive)
2. inname:
Prefix match on a group name part (case-insensitive)
Change-Id: Iedec2574690881470ba7f0ff7cd12263e466352f
Signed-off-by: Edwin Kempin <ekempin@google.com>
If the number of groups matching the query exceeds the limit the
last group has a '_more_groups: true' JSON field set.
Change-Id: I6f1fcda58813e2c7b5dc788d88b989c377afec7e
Signed-off-by: Edwin Kempin <ekempin@google.com>
REST collections decide which REST endpoint is used to handle GET
requests on the collection by returning the implementation of this
REST endpoint from the list() method. Sometimes depending on the
presence of certain URL parameters it makes sense to let different
REST endpoints handle the listing. For this the REST collection needs
to know which URL parameters were specified. By implementing the new
NeedsParams interface the REST collection can now get to know the URL
parameters.
Change-Id: I78a7b7a26324c63bc7ee24e7f0928f907146981d
Signed-off-by: Edwin Kempin <ekempin@google.com>
With this change, the unresolved field of a comment is now set by the
value supplied in the request body. If no value is supplied, the value
of the parent is used, and if no parent exists then comments default to
unresolved=false.
Change-Id: I4d2e16e42a78473b78b4e5b044687df4c5554963
Right now deleting a vote is done by:
'DELETE /changes/{change-id}/reviewers/{account-id}/votes/{label-id}'
A new REST endpoint is added as:
'DELETE /changes/{change-id}/revisions/{revision-id}/reviewers/{account-id}/votes/{label-id}'
This new endpoint can help prevent deleting the vote (with same label)
from a newer patch set by mistake.
'List Revision Reviewers' and 'List Revision Votes' endpoints are also
added as by-products. All of the three endpoints are limited on current
revision.
Change-Id: I85fac04db986c2133cd39d2d06648d1dad8c3b4c
Highlights include:
- New themes duotone-light and duotone-dark
- Various small fixes to language modes
Change-Id: I632cc2dd3815767293ea9638b0551f7a98f330b2
Up to now, the file path was implicitly limited to the file on which
the robot comment was placed. This restriction will be relaxed in the
future. In order to not break systems which use the fix suggestions at
that (later) point in time, the mandatory field 'path' is introduced
with this change.
Change-Id: I73875b97bf844dee927720765046161bbd888c02
Adds a general preference setting for expanding diff views inline from
the change view rather than opening the diff view as a new page. Also
updates documentation that was missed prior for change table columns.
Feature: Issue 5115
Change-Id: I0055961e7b79d74afc3a85de441b53a38f8de4a3
The server doesn't need to handle resolvedness of a thread; the plan is
for it to be an entirely client-side implementation. Whatever value the
most recent comment has for 'unresolved' is the value that will
determine whether the thread is resolved, but each individual comment
will still have that value populated so as to keep a log of when it was
changed and who it was changed by.
Change-Id: If45057935f4f30bb6babbe5e80223b8da3fa694f
Support for parent weblinks was removed in change I8508dcaf3. This is a
regression for some users who rely on that information being present.
On the other hand, not all users want to have these links going to the
same external service as the patch set revision links, so we can't just
add it back as it was.
Instead, add a new plugin web link interface for the parent revisions.
If a plugin provides an implementation of ParentWebLink, the links will
be displayed beside the parent revisions on the change screen.
For the built-in gitweb support, provide the parent links using the same
template as the patch set links, so they will always appear when the
gitweb config defines the 'revision' setting.
Bug: Issue 4908
Change-Id: Icdf0f997f939128717ee4edc2c147a26eeaebad6
In order to use the RangeSubject within gerrit-extension-api as well
as gerrit-acceptance-tests, a new Bazel/Buck package is introduced.
The purpose of this package is to bundle test helper classes which are
shared by different packages.
Change-Id: I59aa42d89c06f4de60a2a05d41a72653eba268de
For the PreviewSubmit call plain tar as well as zip works fine, but
formats like tbz2, tgz and txz are broken.
This bug comes from not knowing the size of the bundles before writing
them, such that it was assumed to 0. Plain tar as well as zip worked
just fine as the tools ignored the wrong size.
Fix the bug by creating the bundle in memory and then correctly use
JGits ArchiveCommand for different formats.
To demonstrate the bug is fixed, add a test that just lists files
in the return of a call of preview submit call with tgz format
specificed.
By this change a bundle cannot be streamed any more, but needs to
be kept in memory. As bundles may become large, introduce a new
config option to set an upper bound for a bundle that is build up
in memory.
A slightly unrelated change is the wrapping of the
ArchiveOutputStream in a try-with-resource block as it implements
AutoCloseable. (Before it was not closed explicitly but just
finish()ed.)
Change-Id: I587c0e81ed79be94d7abf2a19ad2086c005933d9
Signed-off-by: Stefan Beller <sbeller@google.com>
* submodules:
* Update plugins/replication from branch 'master'
- Remove test prefix from test methods in replication plugin
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.
Change-Id: I42e6191ece7872f4647e425e3ca0acf8c6452412
With this change, suggestions for fixes can be provided with a robot
comment. At the moment, those suggestions are implicitly limited to the
file to which the robot comment was attached.
Change-Id: I69cf3fc4bdc66d69a5831b1e6c78937b8e945a72
Reformat the Bazel build files with the buildifier tool [1].
The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.
[1] https://github.com/bazelbuild/buildifier
Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.
Change-Id: I229a36751adc6a87fbae8d6f373671e141529496