prevent message correction for files
This commit is contained in:
parent
cf94a2c02f
commit
2d44144b69
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 5.0.5
|
||||||
|
|
||||||
|
- Prevent editing of sent file uploads.
|
||||||
|
|
||||||
## 5.0.4 (2019-10-08)
|
## 5.0.4 (2019-10-08)
|
||||||
|
|
||||||
- New config option [allow_message_corrections](https://conversejs.org/docs/html/configuration.html#allow_message_corrections)
|
- New config option [allow_message_corrections](https://conversejs.org/docs/html/configuration.html#allow_message_corrections)
|
||||||
|
|
|
@ -954,7 +954,7 @@ converse.plugins.add('converse-chatview', {
|
||||||
while (idx < this.model.messages.length-1) {
|
while (idx < this.model.messages.length-1) {
|
||||||
idx += 1;
|
idx += 1;
|
||||||
const candidate = this.model.messages.at(idx);
|
const candidate = this.model.messages.at(idx);
|
||||||
if (candidate.get('sender') === 'me' && candidate.get('message')) {
|
if (candidate.get('editable')) {
|
||||||
message = candidate;
|
message = candidate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ converse.plugins.add('converse-chatview', {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message = message || this.getOwnMessages().reverse().find(m => m.get('message'));
|
message = message || this.getOwnMessages().reverse().find(m => m.get('editable'));
|
||||||
if (message) {
|
if (message) {
|
||||||
this.insertIntoTextArea(message.get('message'), true, true);
|
this.insertIntoTextArea(message.get('message'), true, true);
|
||||||
message.save('correcting', true);
|
message.save('correcting', true);
|
||||||
|
|
|
@ -785,7 +785,7 @@ converse.plugins.add('converse-chatboxes', {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_converse.allow_message_corrections === 'all') {
|
if (_converse.allow_message_corrections === 'all') {
|
||||||
attrs.editable = true;
|
attrs.editable = !(attrs.file || 'oob_url' in attrs);
|
||||||
} else if ((_converse.allow_message_corrections === 'last') &&
|
} else if ((_converse.allow_message_corrections === 'last') &&
|
||||||
(send_time > this.get('time_sent'))) {
|
(send_time > this.get('time_sent'))) {
|
||||||
this.set({'time_sent': send_time});
|
this.set({'time_sent': send_time});
|
||||||
|
@ -793,7 +793,7 @@ converse.plugins.add('converse-chatboxes', {
|
||||||
if (msg) {
|
if (msg) {
|
||||||
msg.save({'editable': false});
|
msg.save({'editable': false});
|
||||||
}
|
}
|
||||||
attrs.editable = true;
|
attrs.editable = !(attrs.file || 'oob_url' in attrs);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -889,14 +889,14 @@ converse.plugins.add('converse-chatboxes', {
|
||||||
'ephemeral': true
|
'ephemeral': true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const message = this.messages.create(
|
const attrs = Object.assign(
|
||||||
Object.assign(
|
this.getOutgoingMessageAttributes(), {
|
||||||
this.getOutgoingMessageAttributes(), {
|
'file': true,
|
||||||
'file': true,
|
'progress': 0,
|
||||||
'progress': 0,
|
'slot_request_url': slot_request_url
|
||||||
'slot_request_url': slot_request_url
|
});
|
||||||
}), {'silent': true}
|
this.setEditable(attrs, (new Date()).toISOString());
|
||||||
);
|
const message = this.messages.create(attrs, {'silent': true});
|
||||||
message.file = file;
|
message.file = file;
|
||||||
this.messages.trigger('add', message);
|
this.messages.trigger('add', message);
|
||||||
message.getRequestSlotURL();
|
message.getRequestSlotURL();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user