Skip to content

Commit

Permalink
feat: Added "Mark all chat messages as read" operation
Browse files Browse the repository at this point in the history
  • Loading branch information
umanamente committed Apr 13, 2023
1 parent ddcb579 commit 3d30928
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nodes/Habitica/operations/chat_messages/Header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getGroupChatMessagesOperation, getGroupChatMessagesParameters } from ".
import { resourceChatMessage } from "./ResourceName";
import { postChatMessageIntoGroupOperation, postChatMessageIntoGroupParameters } from "./functions/ChatMessagePostIntoGroup";
import { IResourceDef } from "../common/CommonDefinitions";
import { markAllAsReadOperation, markAllAsReadParameters } from "./functions/ChatMessageMarkAllAsRead";

export const chatMessagesResourceDefinitions: IResourceDef = {
resource: resourceChatMessage,
Expand All @@ -14,6 +15,10 @@ export const chatMessagesResourceDefinitions: IResourceDef = {
operation: postChatMessageIntoGroupOperation,
parameters: postChatMessageIntoGroupParameters,
},
{
operation: markAllAsReadOperation,
parameters: markAllAsReadParameters,
}
],
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { INodeProperties, INodePropertyOptions } from "n8n-workflow";
import { parameterSelectGroup } from "../../../parameters/ParameterSelectGroup";

export const markAllAsReadOperation: INodePropertyOptions =
{
name: 'Mark All As Read',
value: 'markAllAsRead',
action: 'Mark all as read',
description: 'Mark all chat messages as read',
routing: {
request: {
method: 'POST',
url: '=groups/{{$parameter.groupId}}/chat/seen',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
],
},
},
};

export const markAllAsReadParameters : INodeProperties[] = [
// select group
{
...parameterSelectGroup,
displayOptions: {
show: {
operation: [
markAllAsReadOperation.value,
],
},
},
},
];

0 comments on commit 3d30928

Please sign in to comment.