Skip to content

Commit

Permalink
feat: carbon v3
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Aug 6, 2024
1 parent 41fba2f commit 78f99a8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion extensions/tags/src/Access/DiscussionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function tag(User $actor, Discussion $discussion): ?string
if (
$allowEditTags === '-1'
|| ($allowEditTags === 'reply' && $discussion->participant_count <= 1)
|| (is_numeric($allowEditTags) && $discussion->created_at->diffInMinutes(new Carbon) < $allowEditTags)
|| (is_numeric($allowEditTags) && $discussion->created_at->diffInMinutes(new Carbon, true) < $allowEditTags)
) {
return $this->allow();
}
Expand Down
2 changes: 1 addition & 1 deletion framework/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"middlewares/base-path-router": "^2.0.1",
"middlewares/request-handler": "^2.0.2",
"monolog/monolog": "^3.0",
"nesbot/carbon": "^2.0",
"nesbot/carbon": "^3.0",
"nikic/fast-route": "^1.3",
"psr/http-message": "^1.1",
"psr/http-server-handler": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Discussion/Access/DiscussionPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function rename(User $actor, Discussion $discussion): ?string

if ($allowRenaming === '-1'
|| ($allowRenaming === 'reply' && $discussion->participant_count <= 1)
|| (is_numeric($allowRenaming) && $discussion->created_at->diffInMinutes() < $allowRenaming)) {
|| (is_numeric($allowRenaming) && $discussion->created_at->diffInMinutes(null, true) < $allowRenaming)) {
return $this->allow();
}
}
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Http/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function touch($attribute = null, ServerRequestInterface $request = null)
{
$now = Carbon::now();

if ($this->last_activity_at === null || $this->last_activity_at->diffInSeconds($now) > AccessToken::LAST_ACTIVITY_UPDATE_DIFF) {
if ($this->last_activity_at === null || $this->last_activity_at->diffInSeconds($now, true) > AccessToken::LAST_ACTIVITY_UPDATE_DIFF) {
$this->last_activity_at = $now;
}

Expand Down
4 changes: 2 additions & 2 deletions framework/core/src/Post/Access/PostPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function edit(User $actor, Post $post): ?string

if ($allowEditing === '-1'
|| ($allowEditing === 'reply' && $post->number >= $post->discussion->last_post_number)
|| (is_numeric($allowEditing) && $post->created_at->diffInMinutes(new Carbon) < $allowEditing)) {
|| (is_numeric($allowEditing) && $post->created_at->diffInMinutes(new Carbon, true) < $allowEditing)) {
return $this->allow();
}
}
Expand All @@ -56,7 +56,7 @@ public function hide(User $actor, Post $post): ?string

if ($allowHiding === '-1'
|| ($allowHiding === 'reply' && $post->number >= $post->discussion->last_post_number)
|| (is_numeric($allowHiding) && $post->created_at->diffInMinutes(new Carbon) < $allowHiding)) {
|| (is_numeric($allowHiding) && $post->created_at->diffInMinutes(new Carbon, true) < $allowHiding)) {
return $this->allow();
}
}
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/User/EmailToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function scopeValidOrFail(Builder $query, string $id): static
/** @var static|null $token */
$token = $query->find($id);

if (! $token || $token->created_at->diffInDays() >= 1) {
if (! $token || $token->created_at->diffInDays(null, true) >= 1) {
throw new InvalidConfirmationTokenException;
}

Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function updateLastSeen(): static
{
$now = Carbon::now();

if ($this->last_seen_at === null || $this->last_seen_at->diffInSeconds($now) > User::LAST_SEEN_UPDATE_DIFF) {
if ($this->last_seen_at === null || $this->last_seen_at->diffInSeconds($now, true) > User::LAST_SEEN_UPDATE_DIFF) {
$this->last_seen_at = $now;
}

Expand Down

0 comments on commit 78f99a8

Please sign in to comment.