Skip to content

Commit 8bffaa1

Browse files
committed
Add interface ResponseData
1 parent 4f3d659 commit 8bffaa1

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

ts/WoltLabSuite/Core/Conversation/Clipboard.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ interface ConversationData {
1414
isClosed: boolean;
1515
}
1616

17+
interface ResponseData {
18+
returnValues: {
19+
conversationData: {
20+
[key: string]: ConversationData;
21+
};
22+
};
23+
}
24+
1725
interface EventData {
1826
data: ClipboardActionData;
19-
responseData:
20-
| null
21-
| (AjaxResponse & {
22-
returnValues: {
23-
conversationData: {
24-
[key: string]: ConversationData;
25-
};
26-
};
27-
});
27+
responseData: null | (ResponseData & AjaxResponse);
2828
}
2929

3030
// TODO add types for editorHandler
@@ -46,7 +46,7 @@ function execute(editorHandler, actionName: string, parameters) {
4646
}
4747
}
4848

49-
function evaluateResponse(editorHandler, actionName: string, data) {
49+
function evaluateResponse(editorHandler, actionName: string, data: ResponseData) {
5050
switch (actionName) {
5151
case "com.woltlab.wcf.conversation.conversation.leave":
5252
case "com.woltlab.wcf.conversation.conversation.leavePermanently":
@@ -57,11 +57,9 @@ function evaluateResponse(editorHandler, actionName: string, data) {
5757

5858
case "com.woltlab.wcf.conversation.conversation.close":
5959
case "com.woltlab.wcf.conversation.conversation.open":
60-
Object.entries(data.returnValues.conversationData).forEach(
61-
([conversationId, conversationData]: [string, ConversationData]) => {
62-
editorHandler.update(conversationId, conversationData.isClosed ? "close" : "open", conversationData);
63-
},
64-
);
60+
Object.entries(data.returnValues.conversationData).forEach(([conversationId, conversationData]) => {
61+
editorHandler.update(conversationId, conversationData.isClosed ? "close" : "open", conversationData);
62+
});
6563
break;
6664
}
6765
}

0 commit comments

Comments
 (0)