Set the last grouped comments to last events fired

This commit is contained in:
Jose Gonzalez 2021-11-29 16:12:15 +01:00
parent 5eb4a869cc
commit 7918b883aa
2 changed files with 13 additions and 17 deletions

View File

@ -1225,26 +1225,19 @@ if ($dialogue_event_response) {
}
}
if ($add_comment) {
$aviability_comment = true;
$comment = get_parameter('comment');
if ($add_comment === true) {
$comment = (string) get_parameter('comment');
$eventId = (int) get_parameter('event_id');
// Safe comments for hacks.
if (preg_match('/script/i', io_safe_output($comment))) {
$aviability_comment = false;
$return = false;
}
$event_id = get_parameter('event_id');
if ($aviability_comment !== false) {
$return = events_comment($event_id, $comment, 'Added comment', $meta, $history);
}
if ($return) {
echo 'comment_ok';
} else {
echo 'comment_error';
$return = events_comment($eventId, $comment, 'Added comment', $meta, $history);
}
echo ($return === true) ? 'comment_ok' : 'comment_error';
return;
}

View File

@ -576,7 +576,6 @@ function event_comment(current_event) {
return;
}
var event_id = event.id_evento;
var comment = $("#textarea_comment").val();
var meta = 0;
if ($("#hidden-meta").val() != undefined) {
@ -596,7 +595,11 @@ function event_comment(current_event) {
var params = [];
params.push("page=include/ajax/events");
params.push("add_comment=1");
params.push("event_id=" + event_id);
if (event.event_rep > 0) {
params.push("event_id=" + event.max_id_evento);
} else {
params.push("event_id=" + event.id_evento);
}
params.push("comment=" + comment);
params.push("meta=" + meta);
params.push("history=" + history);