feat(log action): Show poll (create, finish, edit, delete) actions

This commit is contained in:
Roman Kelesidis 2025-08-20 13:34:21 +03:00
commit 998ffd9d8a
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4

View file

@ -103,6 +103,13 @@ switch ($mode) {
bb_die($lang['POST_HAS_NO_POLL']);
}
// Log action
$log_action->mod('topic_poll_started', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $t_data['topic_title'],
]);
// Starting the poll
DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = 1 WHERE topic_id = $topic_id");
bb_die($lang['NEW_POLL_START']);
@ -113,6 +120,13 @@ switch ($mode) {
bb_die($lang['POST_HAS_NO_POLL']);
}
// Log action
$log_action->mod('topic_poll_finish', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $t_data['topic_title'],
]);
// Finishing the poll
DB()->query("UPDATE " . BB_TOPICS . " SET topic_vote = " . POLL_FINISHED . " WHERE topic_id = $topic_id");
bb_die($lang['NEW_POLL_END']);
@ -123,6 +137,13 @@ switch ($mode) {
bb_die($lang['POST_HAS_NO_POLL']);
}
// Log action
$log_action->mod('topic_poll_deleted', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $t_data['topic_title'],
]);
// Removing poll from database
$poll->delete_poll($topic_id);
bb_die($lang['NEW_POLL_DELETE']);
@ -141,6 +162,13 @@ switch ($mode) {
bb_die($poll->err_msg);
}
// Log action
$log_action->mod('topic_poll_added', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $t_data['topic_title'],
]);
// Adding poll info to the database
$poll->insert_votes_into_db($topic_id);
bb_die($lang['NEW_POLL_ADDED']);
@ -159,6 +187,13 @@ switch ($mode) {
bb_die($poll->err_msg);
}
// Log action
$log_action->mod('topic_poll_edited', [
'forum_id' => $forum_id,
'topic_id' => $topic_id,
'topic_title' => $t_data['topic_title'],
]);
// Updating poll info to the database
$poll->insert_votes_into_db($topic_id);
CACHE('bb_poll_data')->rm("poll_$topic_id");