Skip to content

Commit 0c9b2c0

Browse files
committed
fix api compatibility issue
1 parent 76b1350 commit 0c9b2c0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version = 1.0.1
2-
ideaVersion = IC-2018.3
2+
ideaVersion = IC-2019.1
33
customUtilBuild = 299.*
44
isEAP = false
55
pluginChannels = nightly

src/main/java/com/chuntung/plugin/gistsnippet/service/GistSnippetService.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright (c) 2020 Tony Ho. Some rights reserved.
3+
*/
4+
15
package com.chuntung.plugin.gistsnippet.service;
26

37
import com.chuntung.plugin.gistsnippet.dto.api.GistDTO;
@@ -153,11 +157,16 @@ public void deleteGist(GithubAccount account, List<String> gistIds) {
153157
GithubApiRequestExecutor executor = GithubApiRequestExecutorManager.getInstance().getExecutor(account);
154158
for (String gistId : gistIds) {
155159
String url = String.format(GIST_DETAIL_URL, gistId);
156-
// 2018.3
157-
GithubApiRequest.Delete delete = new GithubApiRequest.Delete(url);
160+
// since 2019.1
161+
GithubApiRequest.Delete.Json<String> delete = new GithubApiRequest.Delete.Json<>(url, null, String.class);
158162
executor.execute(delete);
159163
gistCache.remove(gistId);
160164
}
165+
String key = account.toString() + "#own";
166+
List<String> cacheList = scopeCache.get(key);
167+
if (cacheList != null) {
168+
cacheList.removeAll(gistIds);
169+
}
161170
} catch (IOException e) {
162171
logger.info("Failed to delete gist, error: " + e.getMessage());
163172
throw new GistException(e);

0 commit comments

Comments
 (0)