Share repeated controller and service code
- AppController: joinUrl(), adminUrlFor(), setPollInterval() and protect() instead of copies in Admin-, Home-, Participate- and EmbedController. - PollMailer::sendSafely() replaces two try/catch blocks around mail sending. - Slide::optionIds() replaces five identical array_map() calls. - PollStateService: one pollPayload() for presenter and embed; the vote action passes the already loaded slide instead of loading it again. - ResultsService::forSlide() takes the answer/comment limit and the rating flag, so ReportService no longer queries answers, comments and the scale distribution twice and the export loads the slides only once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad537b9b34
commit
3e44ded107
14 files changed
+189
-137
No files matched your search
@@ -73,18 +73,6 @@ abstract class AdminAppController extends AppController
|
||||
$this->response = $this->protect($this->response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Cake\Http\Response $response Response
|
||||
* @return \Cake\Http\Response
|
||||
*/
|
||||
protected function protect(Response $response): Response
|
||||
{
|
||||
return $response
|
||||
->withHeader('Referrer-Policy', 'no-referrer')
|
||||
->withHeader('X-Robots-Tag', 'noindex, nofollow')
|
||||
->withHeader('Cache-Control', 'no-store, private');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user