-
Notifications
You must be signed in to change notification settings - Fork 269
Update review list right after user posting/revoking #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c559b7d
5525f1b
6fe5bd9
f816b46
bd5ae3d
a6a9e61
4b5e150
2c73daf
7bd25b6
30dbfef
4544beb
0862c24
a9d453d
13594aa
8845246
24336c7
7ff8e30
2e7e8e1
7a16ecb
03fb490
dd9735b
9141379
5680c22
03a5d03
326f2e3
55810ad
0e55bca
8794eb8
af01986
17b966c
8f1319c
5458a8e
06234ce
fd51cc0
e590b64
6d7d0a9
0a6dc3c
61e1ec6
925711a
29babd5
7c2b79e
fbc1d8e
07db44b
ec78245
082d053
a91d06e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,9 @@ public ExtensionJson getExtension(String namespace, String extensionName, String | |
| public ExtensionJson getExtension(String namespace, String extensionName, String targetPlatform, String version) { | ||
| var extVersion = findExtensionVersion(namespace, extensionName, targetPlatform, version); | ||
| var json = toExtensionVersionJson(extVersion, targetPlatform, true, false); | ||
| var extension = repositories.findExtension(extensionName, namespace); | ||
| json.downloads = getDownloads(extVersion.getExtension(), targetPlatform, extVersion.getVersion()); | ||
| json.averageRating = extension.getAverageRating(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this statement, because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @amvanbaren , thanks for your comment!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see what you mean. I went through the code to find out how this could happen. The This has been fixed in You can sync the After syncing your fork you can rebase by opening a terminal in your openvsx directory and following these steps:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @amvanbaren , thanks for your suggestion!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @yiningwang11, it looks like you merged A rebase changes the base of the branch, but the changes you've made stay on top. This article explains it in further detail: https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase. The example under the Usage heading describes what we try to do here. Are the top 5 commits for this feature or were there more commits?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @amvanbaren , thanks for your comment! I went over the article you recommended. Is this because I should have sync my The top 5 commits in the screenshot you shared were for this feature, there aren't any more commits yet. (I'm still working on adding the Thank you :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, it is so that this feature is current with
Yes, you can use Next, do an interactive rebase on your You get a list of commits. You need to keep the first 5 commits and if you've added extra commits since this PR you want to keep those too. All the other commits in between you want to drop. When you're 100% sure (you can't undo this operation) which commits to keep and which to drop, close the editor. The rebase is applied and the commits from the merge with Force push If you used |
||
| return json; | ||
| } | ||
|
|
||
|
|
@@ -772,6 +774,7 @@ private List<SearchEntryJson> toSearchEntries(SearchHits<ExtensionSearch> search | |
| .map(e -> { | ||
| var entry = e.getValue().toSearchEntryJson(); | ||
| entry.url = createApiUrl(serverUrl, "api", entry.namespace, entry.name); | ||
| entry.averageRating = repositories.findExtension(entry.name, entry.namespace).getAverageRating(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this statement, because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this statement due to the same reason. I found |
||
| return new AbstractMap.SimpleEntry<>(e.getKey(), entry); | ||
| }) | ||
| .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -627,7 +627,7 @@ public ResponseEntity<ReviewListJson> getReviews( | |
| for (var registry : getRegistries()) { | ||
| try { | ||
| return ResponseEntity.ok() | ||
| .cacheControl(CacheControl.maxAge(10, TimeUnit.MINUTES).cachePublic()) | ||
| .cacheControl(CacheControl.noCache().cachePublic()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yiningwang11 Can you also make
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amvanbaren I'll take a look into this. Thank you! |
||
| .body(registry.getReviews(namespace, extension)); | ||
| } catch (NotFoundException exc) { | ||
| // Try the next registry | ||
|
|
@@ -745,7 +745,7 @@ public ResponseEntity<SearchResultJson> search( | |
| } | ||
|
|
||
| return ResponseEntity.ok() | ||
| .cacheControl(CacheControl.maxAge(10, TimeUnit.MINUTES).cachePublic()) | ||
| .cacheControl(CacheControl.noCache().cachePublic()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if there is a better way of replacing the cache instead of disabling it altogether? cc @amvanbaren Otherwise I'm good with the changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, a combination of server caching and generating an ETag for the response. If the request contains the |
||
| .body(result); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,16 +16,12 @@ public class ShallowEtagHeaderFilter extends org.springframework.web.filter.Shal | |
|
|
||
| protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException { | ||
| // limit the filter to /api/{namespace}/{extension}, /api/{namespace}/details | ||
| // and /api/{namespace}/{extension}/{version} endpoints | ||
| // and /api/{namespace}/{extension}/{version}, and /api/-/search endpoints | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yiningwang11 Why generate an ETag for the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, @amvanbaren thanks for the review!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yiningwang11 Ok, that's true. The downside is that the search is fully processed. Only at the end the On the other hand #542 caches search results on the server side, so this approach will work. I'll test #542 and merge it in. |
||
| var path = request.getRequestURI().substring(1).split("/"); | ||
| var applyFilter = path.length == 3 || path.length == 4; | ||
| if(applyFilter) { | ||
| applyFilter = path[0].equals("api") && !path[1].equals("-"); | ||
| var applyFilter = (path.length == 3 || path.length == 4) && path[0].equals("api"); | ||
| if(applyFilter && path[1].equals("-")) { | ||
| applyFilter = path[2].contains("search"); | ||
| } | ||
| if(applyFilter && path.length == 4) { | ||
| applyFilter = !(path[3].equals("review") || path[3].equals("reviews")); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep |
||
| } | ||
|
|
||
| return !applyFilter; | ||
| } | ||
| } | ||




There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this statement, because you don't have to set
averageRatinghere.