Fixes flag note editing, deletion, and template update (#9581)

* Fixes flag note editing, deletion, and template update

Flag note datetime should be int.
Corrects argument order for note reloading.

* Chore: add missing radix

* fix: empty append bug

This line results in an error message popping up when clicking the flag notes text box, as the 'appendNote' case fires with no text. I can't tell that it serves any function.
v1.18.x
Mats 4 years ago committed by GitHub
parent 286644d0b8
commit c448ba6f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,7 +35,7 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'b
socket.emit('flags.appendNote', {
flagId: ajaxify.data.flagId,
note: noteEl.value,
datetime: noteEl.getAttribute('data-datetime'),
datetime: parseInt(noteEl.getAttribute('data-datetime'), 10),
}, function (err, payload) {
if (err) {
return app.alertError(err.message);
@ -44,7 +44,6 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'b
Detail.reloadNotes(payload.notes);
Detail.reloadHistory(payload.history);
noteEl.setAttribute('data-action', 'appendNote');
noteEl.removeAttribute('data-datetime');
});
break;
@ -82,7 +81,7 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'b
break;
case 'delete-note':
var datetime = this.closest('[data-datetime]').getAttribute('data-datetime');
var datetime = parseInt(this.closest('[data-datetime]').getAttribute('data-datetime'), 10);
bootbox.confirm('[[flags:delete-note-confirm]]', function (ok) {
if (ok) {
socket.emit('flags.deleteNote', {
@ -144,9 +143,9 @@ define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'b
Detail.reloadNotes = function (notes) {
ajaxify.data.notes = notes;
Benchpress.render('flags/detail', 'notes', {
Benchpress.render('flags/detail', {
notes: notes,
}).then(function (html) {
}, 'notes').then(function (html) {
var wrapperEl = components.get('flag/notes');
wrapperEl.empty();
wrapperEl.html(html);

Loading…
Cancel
Save