Using AccountCache#getIfPresent to check if an account exists is wrong:
1. It returns null for existing accounts that were not cached yet.
2. It returns an empty AccountState instance for missing accounts that
were requested from the cache before and that are still in the cache.
Change-Id: Ie25b44c53f92720053274cd56e68058e148d389e
Signed-off-by: Edwin Kempin <ekempin@google.com>
AccountCache#get returns an empty AccountState instance to represent a
missing account. Add a new AccountCache#getOrNull method that returns
null if an account is missing so that callers can special-case
non-existing accounts.
Change-Id: I51dcca79a4ec3ec71a09c9ec0da51fda03e19928
Signed-off-by: Edwin Kempin <ekempin@google.com>
Some callers make wrong assumptions about these methods. Documenting
these methods can help to avoid confusion.
Change-Id: I23b9f69c9e18c8de201f53d2a2db1f1e3aa7075c
Signed-off-by: Edwin Kempin <ekempin@google.com>
Before change I13f2d6ab94 AccountCache could be used out of the request
scope. Using Provider<ReviewDb> in ByNameReviewDbLoader class implicitly
add new constraint on AccountCache, namely it must be used in request
scope.
Injecting SchemaFactory<ReviewDb> instead of Provider fixes this
regression.
Change-Id: I398e02cb138302cd99a2fb68fadcc4d6c6176395
Signed-off-by: Dariusz Luksza <dluksza@collab.net>
Plugins need access to these methods if they want to use these
predicates in an internal query with
InternalAccountQuery#query(List<Predicate<AccountState>>).
Change-Id: Ie70cd35f35bde942cd377a1db1cac2388b565686
Signed-off-by: Edwin Kempin <ekempin@google.com>
After discussion it was agreed that this is not necessary.
This reverts commit 35b94328b400f5ca95f66de474b5b0a884f8c497.
Change-Id: Ibb4d956483c63f4431a2bc986d4f28a99fac0b25
Initial values setup resulted in label values (eg "+2") to be
numbers (ie 2), and was changing to strings by iron-select upon user
changing label value.
With this change, gr-label-score-row.selectedValue returns string or
null if not selected. This is needed for consistency of the plugin API.
Change-Id: Ia1ca49de498a9a0552740c6ad1aad8acd21c4f3b
* stable-2.14:
Introduce GlobalPluginConfig{s} annotations
Clarify usage of @GerritConfig#value() and #values()
Clarify usage of GerritConfig#name()
GerritServer: Split annotation sanity check to a separate method
Change-Id: I8c7e145ec4ddacd049f7d908fd74dcf0046c677e
The shared styles were not applied, so the hidden overriding style
was not applied.
Bug: Issue 6372
Change-Id: Ia3b0ff100b7431fa85595901216954f925068f2c
Throughout the admin section, there are (at least) three distinct list
views that behave very similarly. This change helps share code between
them:
Create a list-view element that handles the filtering and navigation,
and styles <content></content>, which is the same among lists.
Change-Id: I1037c43df7be58aa00843d29cae50495e089826d
The global * style in main.css took precedence over the padding applied
to :host. Instead add a wrapper div to apply padding there.
Bug: issue 6732
Change-Id: I57cec6b2a016d34a17993a0f2583e48a94dbc74e
This is a partial roll-forward of c/106190
This replaces all loads of iron-test-helpers with a load of a file
that wraps it, and adds that file to test files that do not currently
load iron-test-helpers.
A future CL will also install polymer-resin via common-test-helpers.html.
I tested by running
$ WCT_ARGS="-l chrome" ./polygerrit-ui/app/run_test.sh
Change-Id: Ifb3cd2c8db13d724f57e56e7e78045470d103a43
Previously, when a diff was reloaded, it would clear the diff content
(the previous diff) and open requests for the data regarding the new
diff. When the requests finished, it would cancel async processing and
start it again on the new data. In this arrangement, a narrow race
condition was present where the async rendering could emit a diff from
the previous diff after the diff table had been cleared, but before the
network requests resolved -- resulting is content form the previous diff
appearing in the new one.
With this change, the async processing is cancelled at the same time
that the diff content is cleared.
Bug: Issue 6170
Change-Id: Ie5a807082ab51156595f9eeb9ba6c958d41e890a
This is the one change edit operation that uses BatchUpdate, which
already takes care of reindexing.
Change-Id: Ic75c6e7197956362303bf7cc956ae6263d4c8c2e
GlobalPluginConfig and GlobalPluginConfigs can be used to annotate
test methods in plugin tests, to provide test configuration values
in $site/etc/plugin-name.config.
The annotations work in the same way as existing GerritConfig{s}, with
addition of "pluginName" parameter.
A limitation of these annotations is that they must be used together
with @UseLocalDisk, so that the plugin configuration files may be
written in the site's etc folder.
Change-Id: I11a66eac87bec5f849858d1a4f38d3f01976ff47
Publicize the accounts external ids cache so that plugins
can inject Gerrit's implementation and benefit from
a speedy and transparent access to user's external ids.
Change-Id: I437f7a3a429423f9442822cee8d16f29a628833c
If the value() is given, it takes precedence over values(), i.e.
values() is ignored if value() is specified.
Add Javadoc and a test to clarify this behavior.
Change-Id: I1bf8bd732f973a8d7106601d54680728ad1e0763
Add Javadoc to clarify that the name() parameter of the @GerritConfig
annotation can be used to specify settings like:
[section]
name = value
aswell as
[section "subsection"]
name = value
Also update the tests to use values that make this usage clearer, and
add extra tests to cover the subsection functionality.
Change-Id: Id06d811a26b0127c1bf0540514537b696c457a46
There were a few instances in the app where borders previously existed
that they don't now. For example, the projects filter, and the rebase
dialog.
Change-Id: I94b3271f7553e3afa095b8442165aa0a9678e573
This will be used for internal testing/usage of Shadow DOM, since there
will likely be many things that look mildly broken when running the app
with shadow dom.
Change-Id: I2cf5fafd7a5b00886df199a1bbf29cf284f43499
If no item is selected (and has no default), add 'No value selected'
text, so that the empty space doesn't look strange.
Bug: Issue 6306
Change-Id: I5c779416b7f330b2d683509a22b905ee8194557d