mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
fix: intensify on last day
This commit is contained in:
parent
2a47d351b8
commit
c940fba01a
@ -7,16 +7,13 @@ import type {Event} from "../api"
|
|||||||
import {t} from "ttag"
|
import {t} from "ttag"
|
||||||
|
|
||||||
export function DomainToTag({domain}: { domain: { ldhName: string, deleted: boolean, status: string[], events?: Event[] } }) {
|
export function DomainToTag({domain}: { domain: { ldhName: string, deleted: boolean, status: string[], events?: Event[] } }) {
|
||||||
|
return (
|
||||||
const lastChangedEvent = domain.events?.find(e =>
|
<Link to={'/search/domain/' + domain.ldhName}>
|
||||||
|
<Badge dot={domain.events?.find(e =>
|
||||||
e.action === 'last changed' &&
|
e.action === 'last changed' &&
|
||||||
!e.deleted &&
|
!e.deleted &&
|
||||||
((new Date().getTime() - new Date(e.date).getTime()) < 7*24*60*60*1e3)
|
((new Date().getTime() - new Date(e.date).getTime()) < 7*24*60*60*1e3)
|
||||||
)
|
) !== undefined} color='blue' title={t`The domain name was updated less than a week ago.`}>
|
||||||
|
|
||||||
return (
|
|
||||||
<Link to={'/search/domain/' + domain.ldhName}>
|
|
||||||
<Badge dot={lastChangedEvent !== undefined} color='blue' title={t`The domain name was updated less than a week ago.`}>
|
|
||||||
<Tag
|
<Tag
|
||||||
color={
|
color={
|
||||||
domain.deleted
|
domain.deleted
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class RegisterDomainCommand extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (null !== $domain && !$force) {
|
if (null !== $domain && !$force) {
|
||||||
if (!$domain->isToBeUpdated()) {
|
if (!$domain->isToBeUpdated(true, true)) {
|
||||||
$io->warning('The domain name is already present in the database and does not need to be updated at this time.');
|
$io->warning('The domain name is already present in the database and does not need to be updated at this time.');
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class DomainRefreshController extends AbstractController
|
|||||||
// If the domain name exists in the database, recently updated and not important, we return the stored Domain
|
// If the domain name exists in the database, recently updated and not important, we return the stored Domain
|
||||||
if (null !== $domain
|
if (null !== $domain
|
||||||
&& !$domain->getDeleted()
|
&& !$domain->getDeleted()
|
||||||
&& !$domain->isToBeUpdated()
|
&& !$domain->isToBeUpdated(true, true)
|
||||||
&& !$this->kernel->isDebug()
|
&& !$this->kernel->isDebug()
|
||||||
&& true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN)
|
&& true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -379,7 +379,7 @@ class Domain
|
|||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function isToBeUpdated(bool $fromUser = true): bool
|
public function isToBeUpdated(bool $fromUser = true, bool $intensifyLastDay = false): bool
|
||||||
{
|
{
|
||||||
$updatedAtDiff = $this->getUpdatedAt()->diff(new \DateTimeImmutable());
|
$updatedAtDiff = $this->getUpdatedAt()->diff(new \DateTimeImmutable());
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ class Domain
|
|||||||
|
|
||||||
$expiresIn = $this->getExpiresInDays();
|
$expiresIn = $this->getExpiresInDays();
|
||||||
|
|
||||||
if (0 === $expiresIn || 1 === $expiresIn) {
|
if ($intensifyLastDay && (0 === $expiresIn || 1 === $expiresIn)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** @var Domain $domain */
|
/** @var Domain $domain */
|
||||||
foreach ($watchList->getDomains()->filter(fn ($domain) => $domain->isToBeUpdated(false)) as $domain
|
foreach ($watchList->getDomains()->filter(fn ($domain) => $domain->isToBeUpdated(false, null !== $watchList->getConnector())) as $domain
|
||||||
) {
|
) {
|
||||||
$updatedAt = $domain->getUpdatedAt();
|
$updatedAt = $domain->getUpdatedAt();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user