rename node

This commit is contained in:
aikitori 2022-03-13 10:58:17 +01:00
parent d826c58b51
commit 050be29d64
3 changed files with 18 additions and 17 deletions

View File

@ -17,7 +17,7 @@
"matrix-server-config": "src/matrix-server-config.js",
"matrix-receive": "src/matrix-receive.js",
"matrix-send-message": "src/matrix-send-message.js",
"matrix-send-message": "src/matrix-delete-message.js",
"matrix-delete-event": "src/matrix-delete-event.js",
"matrix-send-file": "src/matrix-send-file.js",
"matrix-send-image": "src/matrix-send-image.js",
"matrix-react": "src/matrix-react.js",

View File

@ -1,5 +1,5 @@
<script type="text/javascript">
RED.nodes.registerType('matrix-delete-message',{
RED.nodes.registerType('matrix-delete-event',{
category: 'matrix',
color: '#00b7ca',
icon: "matrix.png",
@ -13,13 +13,13 @@
reason: {value:""},
},
label: function() {
return this.name||"Delete Message";
return this.name||"Delete Event";
},
paletteLabel: 'Delete Message'
paletteLabel: 'Delete Event'
});
</script>
<script type="text/html" data-template-name="matrix-delete-message">
<script type="text/html" data-template-name="matrix-delete-event">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
@ -33,29 +33,29 @@
<input type="text" id="node-input-roomId" placeholder="msg.topic">
</div>
<div class="form-row">
<label for="node-input-reason"><i class="fa fa-user"></i> Reason</label>
<label for="node-input-reason"><i class="fa fa-sticky-note"></i> Reason</label>
<input type="text" id="node-input-reason" placeholder="msg.reason">
</div>
</script>
<script type="text/html" data-help-name="matrix-delete-message">
<script type="text/html" data-help-name="matrix-delete-event">
<h3>Details</h3>
<p>Delete a Message in a room</p>
<p>Delete an event in a room</p>
<dl class="message-properties">
<dt>msg.topic
<span class="property-type">string</span>
</dt>
<dd> Room ID from where the Message should be deleted from. Optional if configured on the node. If configured on the node this input will be overridden.</dd>
<dd> Room ID from where the event should be deleted from. Optional if configured on the node. If configured on the node this input will be overridden.</dd>
<dt>msg.eventId
<span class="property-type">string</span>
</dt>
<dd>Messege ID of the message which should be deleted.</dd>
<dd>Event ID of the Event which should be deleted.</dd>
<dt>msg.reason
<span class="property-type">string</span>
</dt>
<dd>Reason why the Message is deleted. Default an empty string</dd>
<dd>Reason why the event is deleted. Default an empty string</dd>
</dl>
<h3>Outputs</h3>
@ -63,11 +63,11 @@
<li>Success
<dl class="message-properties">
<dt>msg.eventId <span class="property-type">string</span></dt>
<dd>the eventId from the deleted message.</dd>
<dd>the eventId from the deleted event.</dd>
</dl>
<dl class="message-properties">
<dt>msg.deleted <span class="property-type">boolean</span></dt>
<dd>True, if the message is deleted</dd>
<dd>True, if the event is deleted</dd>
</dl>
</li>
<li>Error
@ -76,7 +76,7 @@
<dd>the error that occurred.</dd>
<dl class="message-properties">
<dt>msg.deleted <span class="property-type">boolean</span></dt>
<dd>False, if the message is not deleted</dd>
<dd>False, if the event is not deleted</dd>
</dl>
</dl>
</li>

View File

@ -1,5 +1,5 @@
module.exports = function(RED) {
function MatrixDeleteMessage(n) {
function MatrixDeleteEvent(n) {
RED.nodes.createNode(this,n);
var node = this;
@ -28,6 +28,7 @@ module.exports = function(RED) {
if(!msg.eventId) {
node.error("eventId is missing");
node.send([null, msg])
return;
}
@ -63,12 +64,12 @@ module.exports = function(RED) {
node.send([msg, null]);
})
.catch(function(e){
node.warn("Error sending message " + e);
node.warn("Error deleting event " + e);
msg.error = e;
msg.deleted = false
node.send([null, msg]);
});
});
}
RED.nodes.registerType("matrix-delete-message",MatrixDeleteMessage);
RED.nodes.registerType("matrix-delete-event",MatrixDeleteEvent);
}