Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/cdash/public/ajax/buildnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@
=========================================================================*/
require_once 'include/pdo.php';
require_once 'include/common.php';
require_once 'include/api_common.php';

use App\Models\User;
use CDash\Database;

if (!isset($buildid) || !is_numeric($buildid)) {
$build = get_request_build();

if ($build === null || !can_administrate_project($build->ProjectId)) {
echo 'Not a valid buildid!';
return;
}
$buildid = intval($buildid);
$buildid = intval($build->Id);

$db = Database::getInstance();

// Find the notes
$note = $db->executePrepared('SELECT * FROM buildnote WHERE buildid=? ORDER BY timestamp ASC', [$buildid]);
foreach ($note as $note_array) {
$user = User::where('id', intval($note_array['userid']));
/** @var User $user */
$user = User::where('id', intval($note_array['userid']))->first();
$timestamp = strtotime($note_array['timestamp'] . ' UTC');
switch (intval($note_array['status'])) {
case 0:
Expand All @@ -43,6 +47,6 @@
echo '<b>[fixed] </b>';
break;
}
echo 'by <b>' . $user->firstname . ' ' . $user->lastname . '</b>' . ' (' . date('H:i:s T', $timestamp) . ')';
echo 'by <b>' . htmlspecialchars($user->getFullNameAttribute()) . '</b>' . ' (' . date('H:i:s T', $timestamp) . ')';
echo '<pre>' . substr($note_array['note'], 0, 100) . '</pre>'; // limit 100 chars
}
2 changes: 1 addition & 1 deletion app/cdash/public/views/partials/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<!-- Display the note icon -->
<a name="Build Notes" id="buildnote_{{::build.id}}"
ng-if="::build.buildnotes > 0"
ng-href="ajax/buildnote.php?buildid={{::build.id}}&width=350&link=build%2F{{::build.id}}">
ng-href="ajax/buildnote.php?buildid={{::build.id}}">
<img src="img/note.png" alt="note" class="icon"></img>
</a>

Expand Down
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -16420,16 +16420,6 @@ parameters:
count: 2
path: app/cdash/public/ajax/buildinfogroup.php

-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Builder\\<App\\\\Models\\\\User\\>\\:\\:\\$firstname\\.$#"
count: 1
path: app/cdash/public/ajax/buildnote.php

-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Builder\\<App\\\\Models\\\\User\\>\\:\\:\\$lastname\\.$#"
count: 1
path: app/cdash/public/ajax/buildnote.php

-
message: """
#^Call to deprecated method executePrepared\\(\\) of class CDash\\\\Database\\:
Expand Down