Skip to content

Commit 230e08b

Browse files
karlitschekCarlSchwan
authored andcommitted
fix(stream): satisfy the docblock alignment rule on getDailyCounts
php-cs-fixer wants a multi-line @return description aligned under the description column, which for this signature meant indenting the wrap to column 68. The description belongs in the docblock body instead, so the @return line stays a single type and there is nothing to align. Reproduced and verified with php-cs-fixer 3.95.15, the version CI pins: 1 of 97 files before, 0 of 97 after. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Frank Karlitschek <karlitschek@users.noreply.github.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent 89a7144 commit 230e08b

6 files changed

Lines changed: 16 additions & 9 deletions

File tree

js/activity-app.mjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

js/activity-app.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Controller/APIv2Controller.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ public function getHistogram(
186186
} catch (InvalidSearchCriteriaException $e) {
187187
return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
188188
}
189+
if (($object_type !== '' && $object_id === 0) || ($object_type === '' && $object_id !== 0)) {
190+
// Only allowed together (mirrors validateParameters())
191+
$object_type = '';
192+
$object_id = 0;
193+
}
189194

190195
// Window boundaries are resolved in the viewer's timezone so the last
191196
// column is their today, not UTC's

lib/Data.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,14 @@ private function applyStreamConditions(
404404
* `affecteduser` and a timestamp range, which is exactly the
405405
* `activity_user_time` index.
406406
*
407+
* `counts` is keyed by `Y-m-d` and omits days with no activity, so its size
408+
* tracks real activity rather than the length of the window. `partialBefore`
409+
* is the date from which counts are known to be incomplete, or null.
410+
*
407411
* @param int $from Start of the window as a Unix timestamp, inclusive
408412
* @param int $to End of the window as a Unix timestamp, inclusive
409413
*
410-
* @return array{counts: array<string, int>, partialBefore: ?string} Counts
411-
* keyed by `Y-m-d`, omitting days with no activity, plus the date
412-
* from which counts are known to be incomplete, if any
414+
* @return array{counts: array<string, int>, partialBefore: ?string}
413415
*/
414416
public function getDailyCounts(
415417
UserSettings $userSettings,

src/components/ActivityHeatmap.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function select(from: string, to: string): void {
330330
}
331331
332332
/**
333-
*
333+
* Clear the current selection, emitting null for both bounds.
334334
*/
335335
function clearSelection(): void {
336336
emit('update:from', null)
@@ -462,7 +462,7 @@ async function loadHistogram(): Promise<void> {
462462
// the grid to exist before scrolling it.
463463
await nextTick()
464464
const element = scroller.value
465-
if (element !== undefined) {
465+
if (element) {
466466
element.scrollLeft = element.scrollWidth
467467
}
468468
} catch (error) {

tests/Controller/APIv2ControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ public function testGetHistogramWindowEndsTodayAndSpansTheRequestedDays(): void
479479
return ['counts' => [], 'partialBefore' => null];
480480
});
481481

482+
$today = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
482483
$data = $this->controller->getHistogram('all', 7)->getData();
483484

484-
$today = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
485485
$this->assertSame($today->format('Y-m-d'), $data['to']);
486486
$this->assertSame($today->modify('-6 days')->format('Y-m-d'), $data['from']);
487487
// 7 days inclusive, from the first second to the last

0 commit comments

Comments
 (0)