Skip to content

Commit a08e1a1

Browse files
author
Bruce Downs
committed
manual revert of unrelated
1 parent cac9a40 commit a08e1a1

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

bolt/src/main/java/com/slack/api/bolt/AppConfig.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ private EnvVariableName() {
7979
private static SlackHttpClient buildSlackHttpClient() {
8080
Map<String, String> userAgentCustomInfo = new HashMap<>();
8181
userAgentCustomInfo.put("bolt", BoltLibraryVersion.get());
82-
return new SlackHttpClient(SlackConfig.DEFAULT, userAgentCustomInfo);
82+
SlackHttpClient client = new SlackHttpClient(SlackConfig.DEFAULT, userAgentCustomInfo);
83+
return client;
8384
}
8485

8586
@Builder.Default
@@ -285,7 +286,7 @@ public String getOauthInstallPath() {
285286
String path = this.oauthInstallPath;
286287
String legacyPath = this.oauthStartPath;
287288
if (path != null
288-
&& !path.equals(DEFAULT_OAUTH_INSTALL_PATH)
289+
&& path.equals(DEFAULT_OAUTH_INSTALL_PATH) == false
289290
&& legacyPath.equals(DEFAULT_OAUTH_INSTALL_PATH)) {
290291
return path;
291292
} else {
@@ -329,7 +330,7 @@ public String getOauthRedirectUriPath() {
329330
String path = this.oauthRedirectUriPath;
330331
String legacyPath = this.oauthCallbackPath;
331332
if (path != null
332-
&& !path.equals(DEFAULT_OAUTH_REDIRECT_URI_PATH)
333+
&& path.equals(DEFAULT_OAUTH_REDIRECT_URI_PATH) == false
333334
&& legacyPath.equals(DEFAULT_OAUTH_REDIRECT_URI_PATH)) {
334335
return path;
335336
} else {
@@ -406,4 +407,4 @@ public void setOauthRedirectUriPath(String oauthRedirectUriPath) {
406407
@Builder.Default
407408
private boolean ignoringSelfAssistantMessageEventsEnabled = true;
408409

409-
}
410+
}

bolt/src/main/java/com/slack/api/bolt/context/SayUtility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ default ChatPostMessageResponse say(String text) throws IOException, SlackApiExc
2626
}
2727

2828
/**
29-
* Using `say(text, blocks)` instead is highly recommended for even better user experience.
29+
* Using `say(blocks, text)` instead is highly recommended for even better user experience.
3030
*/
3131
default ChatPostMessageResponse say(List<LayoutBlock> blocks) throws IOException, SlackApiException {
3232
return say(null, blocks);

bolt/src/main/java/com/slack/api/bolt/handler/builtin/DefaultTokensRevokedEventHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public Response apply(
4545
this.executorService.submit(() -> {
4646
TokensRevokedEvent.Tokens tokens = payload.getEvent().getTokens();
4747
if (tokens.getOauth() != null) { // user tokens
48-
for (String userId : tokens.getOauth()) {
48+
for (String userId : tokens. getOauth()) {
4949
Installer installer = installationService.findInstaller(enterpriseId, teamId, userId);
5050
if (installer != null) {
5151
try {
@@ -58,7 +58,7 @@ public Response apply(
5858
}
5959
}
6060
}
61-
if (tokens.getBot() != null && !tokens.getBot().isEmpty()) { // bots
61+
if (tokens.getBot() != null && tokens.getBot().size() > 0) { // bots
6262
// actually only one bot per app in a workspace
6363
Bot bot = installationService.findBot(enterpriseId, teamId);
6464
if (bot != null) {

bolt/src/main/java/com/slack/api/bolt/model/builtin/DefaultBot.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.slack.api.bolt.model.builtin;
22

33
import com.slack.api.bolt.model.Bot;
4-
import java.io.Serializable;
54
import lombok.Data;
65

76
/**
87
* The default data class for the Bot interface.
98
*/
109
@Data
11-
public class DefaultBot implements Bot, Serializable {
10+
public class DefaultBot implements Bot {
1211

1312
private String appId;
1413
private String enterpriseId;

bolt/src/main/java/com/slack/api/bolt/util/ListenerCodeSuggestion.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,86 +17,86 @@ private ListenerCodeSuggestion() {
1717
"\n" +
1818
"app.step(step);\n";
1919

20-
public static String viewSubmission(String callbackId) {
20+
public static final String viewSubmission(String callbackId) {
2121
return COMMON_PREFIX +
2222
"app.viewSubmission(\"" + callbackId + "\", (req, ctx) -> {\n" +
2323
" // Sent inputs: req.getPayload().getView().getState().getValues()\n" +
2424
" return ctx.ack();\n" +
2525
"});\n";
2626
}
2727

28-
public static String viewClosed(String callbackId) {
28+
public static final String viewClosed(String callbackId) {
2929
return COMMON_PREFIX +
3030
"app.viewClosed(\"" + callbackId + "\", (req, ctx) -> {\n" +
3131
" // Do something where\n" +
3232
" return ctx.ack();\n" +
3333
"});\n";
3434
}
3535

36-
public static String dialogSubmission(String callbackId) {
36+
public static final String dialogSubmission(String callbackId) {
3737
return COMMON_PREFIX +
3838
"app.dialogSubmission(\"" + callbackId + "\", (req, ctx) -> {\n" +
3939
" // Do something where\n" +
4040
" return ctx.ack();\n" +
4141
"});\n";
4242
}
4343

44-
public static String dialogSuggestion(String callbackId) {
44+
public static final String dialogSuggestion(String callbackId) {
4545
return COMMON_PREFIX +
4646
"app.dialogSubmission(\"" + callbackId + "\", (req, ctx) -> {\n" +
4747
" List<Option> options = Arrays.asList(Option.builder().label(\"label\").value(\"value\").build());\n" +
4848
" return ctx.ack(r -> r.options(options));\n" +
4949
"});\n";
5050
}
5151

52-
public static String dialogCancellation(String callbackId) {
52+
public static final String dialogCancellation(String callbackId) {
5353
return COMMON_PREFIX +
5454
"app.dialogCancellation(\"" + callbackId + "\", (req, ctx) -> {\n" +
5555
" // Do something where\n" +
5656
" return ctx.ack();\n" +
5757
"});\n";
5858
}
5959

60-
public static String command(String command) {
60+
public static final String command(String command) {
6161
return COMMON_PREFIX +
6262
"app.command(\"" + command + "\", (req, ctx) -> {\n" +
6363
" return ctx.ack();\n" +
6464
"});\n";
6565
}
6666

67-
public static String attachmentAction(String callbackId) {
67+
public static final String attachmentAction(String callbackId) {
6868
return COMMON_PREFIX +
6969
"app.attachmentAction(\"" + callbackId + "\", (req, ctx) -> {\n" +
7070
" // Do something where\n" +
7171
" return ctx.ack();\n" +
7272
"});\n";
7373
}
7474

75-
public static String blockAction(String actionId) {
75+
public static final String blockAction(String actionId) {
7676
return COMMON_PREFIX +
7777
"app.blockAction(\"" + actionId + "\", (req, ctx) -> {\n" +
7878
" // Do something where\n" +
7979
" return ctx.ack();\n" +
8080
"});\n";
8181
}
8282

83-
public static String blockSuggestion(String actionId) {
83+
public static final String blockSuggestion(String actionId) {
8484
return COMMON_PREFIX +
8585
"app.blockSuggestion(\"" + actionId + "\", (req, ctx) -> {\n" +
8686
" List<Option> options = Arrays.asList(Option.builder().text(plainText(\"label\")).value(\"v\").build());\n" +
8787
" return ctx.ack(r -> r.options(options));\n" +
8888
"});\n";
8989
}
9090

91-
public static String event(String eventTypeAndSubtype) {
91+
public static final String event(String eventTypeAndSubtype) {
9292
String className = toEventClassName(eventTypeAndSubtype);
9393
return COMMON_PREFIX +
9494
"app.event(" + className + ".class, (payload, ctx) -> {\n" +
9595
" return ctx.ack();\n" +
9696
"});\n";
9797
}
9898

99-
public static String toEventClassName(String eventTypeAndSubtype) {
99+
public static final String toEventClassName(String eventTypeAndSubtype) {
100100
String eventType = eventTypeAndSubtype;
101101
String[] elements = eventTypeAndSubtype.split(":");
102102
if (elements.length == 2) {
@@ -105,6 +105,9 @@ public static String toEventClassName(String eventTypeAndSubtype) {
105105
.replaceFirst("_message", "")
106106
.replaceFirst("message_", "");
107107
}
108+
if (eventType == null) {
109+
return "";
110+
}
108111
StringBuilder sb = new StringBuilder();
109112
char[] cs = eventType.toCharArray();
110113
for (int i = 0; i < cs.length; i++) {
@@ -118,18 +121,18 @@ public static String toEventClassName(String eventTypeAndSubtype) {
118121
sb.append(c);
119122
}
120123
}
121-
return sb + "Event";
124+
return sb.toString() + "Event";
122125
}
123126

124-
public static String globalShortcut(String callbackId) {
127+
public static final String globalShortcut(String callbackId) {
125128
return COMMON_PREFIX +
126129
"app.globalShortcut(\"" + callbackId + "\", (req, ctx) -> {\n" +
127130
" // Do something where\n" +
128131
" return ctx.ack();\n" +
129132
"});\n";
130133
}
131134

132-
public static String messageShortcut(String callbackId) {
135+
public static final String messageShortcut(String callbackId) {
133136
return COMMON_PREFIX +
134137
"app.messageShortcut(\"" + callbackId + "\", (req, ctx) -> {\n" +
135138
" // Do something where\n" +

0 commit comments

Comments
 (0)