File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
server/src/main/java/com/objectcomputing/checkins/services/slack Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 11package com .objectcomputing .checkins .services .slack ;
22
33import com .objectcomputing .checkins .configuration .CheckInsConfiguration ;
4+ import com .slack .api .methods .request .conversations .ConversationsInfoRequest ;
5+ import com .slack .api .methods .response .conversations .ConversationsInfoResponse ;
46import com .slack .api .model .block .LayoutBlock ;
57import com .slack .api .Slack ;
68import com .slack .api .methods .MethodsClient ;
@@ -63,17 +65,12 @@ public String findChannelName(String channelId) {
6365 if (token != null ) {
6466 try {
6567 MethodsClient client = Slack .getInstance ().methods (token );
66- ConversationsListResponse response = client .conversationsList (
67- ConversationsListRequest .builder ().build ()
68- );
68+ ConversationsInfoResponse conversationsInfoResponse = client .conversationsInfo (ConversationsInfoRequest .builder ().channel (channelId ).build ());
6969
70- if (response .isOk ()) {
71- for (Conversation conversation : response .getChannels ()) {
72- LOG .trace ("Found conversation: {}" , conversation );
73- if (conversation .getId ().equals (channelId )) {
74- return conversation .getName ();
75- }
76- }
70+ if (conversationsInfoResponse .isOk ()) {
71+ Conversation channel = conversationsInfoResponse .getChannel ();
72+ LOG .trace ("Found conversation: {}" , channel );
73+ return channel .getName ();
7774 }
7875 } catch (IOException e ) {
7976 LOG .error ("SlackSearch.findChannelName: " + e .toString ());
You can’t perform that action at this time.
0 commit comments