Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 20240512-typesense
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Nov 14, 2024
2 parents ab8da7a + a809ecb commit 47efde6
Show file tree
Hide file tree
Showing 602 changed files with 6,807 additions and 5,469 deletions.
47 changes: 47 additions & 0 deletions .env.example.sail
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Example configuration file to use with Laravel sail
# Copy this file to .env and adjust the values to your needs

# Initial setup:
# cp .env.example.sail .env
# docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/var/www/html" -w /var/www/html laravelsail/php83-composer:latest composer install --ignore-platform-reqs
# ./vendor/bin/sail up -d

APP_NAME=Monica
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=mariadb
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=monica
DB_USERNAME=monica
DB_PASSWORD=password

LOG_CHANNEL=stack

CACHE_STORE=memcached
QUEUE_CONNECTION=redis
SESSION_DRIVER=database

REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
[email protected]
MAIL_REPLY_TO_NAME="${APP_NAME}"

SCOUT_DRIVER=meilisearch
SCOUT_QUEUE=true
MEILISEARCH_HOST=http://meilisearch:7700
MEILISEARCH_KEY=
MEILISEARCH_NO_ANALYTICS=false
19 changes: 16 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ jobs:

strategy:
fail-fast: false
matrix:
flavor:
- name: apache
file: scripts/docker/Dockerfile
tag: main
suffix:
- name: fpm
file: scripts/docker/Dockerfile-fpm
tag: main-fpm
suffix: -fpm

permissions:
contents: read
Expand Down Expand Up @@ -54,6 +64,9 @@ jobs:
org.opencontainers.image.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you."
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager"
org.opencontainers.image.vendor="Monica"
flavor: |
latest=${{ matrix.flavor.tag == 'main' && 'auto' || 'false' }}
suffix=${{ matrix.flavor.suffix }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -72,13 +85,13 @@ jobs:
# Build docker
- name: Docker build
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=registry,ref=${{ env.registry }}/${{ github.repository_owner }}/${{ env.package-name }}:main
cache-from: type=registry,ref=${{ env.registry }}/${{ github.repository_owner }}/${{ env.package-name }}:${{ matrix.flavor.tag }}
labels: ${{ steps.docker_meta.outputs.labels }}
file: scripts/docker/Dockerfile
file: ${{ matrix.flavor.file }}
context: .
platforms: ${{ (github.event_name != 'pull_request') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=This is MonicaHQ your personal memory! MonicaHQ is like a CRM but for the friends family and acquaintances around you.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ npm-debug.log
.phpunit.result.cache
yarn-error.log
monica.db
sail
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ storage
vendor
node_modules
composer.lock
.yarn/*
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.1.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ checksumBehavior: update

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
3 changes: 1 addition & 2 deletions app/Actions/AttemptToAuthenticateSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class AttemptToAuthenticateSocialite
public function __construct(
protected StatefulGuard $guard,
protected LoginRateLimiter $limiter
) {
}
) {}

/**
* Handle the incoming request.
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/AttemptToAuthenticateWebauthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class AttemptToAuthenticateWebauthn
public function __construct(
protected StatefulGuard $guard,
protected LoginRateLimiter $limiter
) {
}
) {}

/**
* Handle the incoming request.
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class RedirectIfTwoFactorAuthenticatable
public function __construct(
protected StatefulGuard $guard,
protected LoginRateLimiter $limiter
) {
}
) {}

/**
* Handle the incoming request.
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Local/MonicaLocalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MonicaLocalize extends Command
*/
public function handle(): void
{
$this->googleTranslate = (new GoogleTranslate())->setSource('en');
$this->googleTranslate = (new GoogleTranslate)->setSource('en');

$locales = $langs = config('localizer.supported_locales');

Expand Down
18 changes: 9 additions & 9 deletions app/Console/Commands/Local/SetupDummyAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private function createVaults(): void
$this->info('☐ Create vaults');

for ($i = 0; $i < rand(3, 5); $i++) {
(new CreateVault())->execute([
(new CreateVault)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'type' => Vault::TYPE_PERSONAL,
Expand All @@ -155,7 +155,7 @@ private function createContacts(): void
$date = $this->faker->dateTimeThisCentury();
$birthDate = Carbon::parse($date);

$contact = (new CreateContact())->execute([
$contact = (new CreateContact)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $vault->id,
Expand All @@ -167,7 +167,7 @@ private function createContacts(): void
'listed' => true,
]);

(new CreateContactImportantDate())->execute([
(new CreateContactImportantDate)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $vault->id,
Expand All @@ -188,7 +188,7 @@ private function createNotes(): void

foreach (Contact::all() as $contact) {
for ($i = 0; $i < 4; $i++) {
(new CreateNote())->execute([
(new CreateNote)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $contact->vault_id,
Expand All @@ -206,7 +206,7 @@ private function createTasks(): void

foreach (Contact::all() as $contact) {
for ($i = 0; $i < 4; $i++) {
(new CreateContactTask())->execute([
(new CreateContactTask)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $contact->vault_id,
Expand All @@ -231,7 +231,7 @@ private function createGoals(): void

foreach (Contact::all() as $contact) {
foreach ($goals->take(rand(1, 4)) as $goal) {
$goal = (new CreateGoal())->execute([
$goal = (new CreateGoal)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $contact->vault_id,
Expand All @@ -245,7 +245,7 @@ private function createGoals(): void
$date = $date->addDays(rand(1, 3));

try {
(new ToggleStreak())->execute([
(new ToggleStreak)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $contact->vault_id,
Expand Down Expand Up @@ -275,7 +275,7 @@ private function createJournals(): void

foreach (Vault::all() as $vault) {
foreach ($journals->take(rand(1, 4)) as $journal) {
$journal = (new CreateJournal())->execute([
$journal = (new CreateJournal)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $vault->id,
Expand All @@ -284,7 +284,7 @@ private function createJournals(): void
]);

for ($j = 0; $j < rand(1, 20); $j++) {
(new CreatePost())->execute([
(new CreatePost)->execute([
'account_id' => $this->firstUser->account_id,
'author_id' => $this->firstUser->id,
'vault_id' => $vault->id,
Expand Down
10 changes: 4 additions & 6 deletions app/Console/Commands/TestReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,14 @@ public function handle(): void
$contactName = NameHelper::formatContactName($channel->user, $contact);

Notification::route('mail', $channel->content)
->notify(new ReminderTriggered($channel, $contactReminder->label, $contactName));
}

if ($channel->type === UserNotificationChannel::TYPE_TELEGRAM) {
->notify((new ReminderTriggered($channel, $contactReminder->label, $contactName))->locale($channel->user->locale));
} elseif ($channel->type === UserNotificationChannel::TYPE_TELEGRAM) {
Notification::route('telegram', $channel->content)
->notify(new ReminderTriggered($channel, $contactReminder->label, ''));
->notify((new ReminderTriggered($channel, $contactReminder->label, ''))->locale($channel->user->locale));
}

try {
(new RescheduleContactReminderForChannel())->execute([
(new RescheduleContactReminderForChannel)->execute([
'contact_reminder_id' => $scheduledReminder->contact_reminder_id,
'user_notification_channel_id' => $scheduledReminder->user_notification_channel_id,
'contact_reminder_scheduled_id' => $scheduledReminder->id,
Expand Down
3 changes: 1 addition & 2 deletions app/Domains/Contact/Dav/Event/TokenDeleteEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ class TokenDeleteEvent
*/
public function __construct(
public SyncToken $token
) {
}
) {}
}
4 changes: 1 addition & 3 deletions app/Domains/Contact/Dav/ImportResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace App\Domains\Contact\Dav;

interface ImportResource
{
}
interface ImportResource {}
3 changes: 1 addition & 2 deletions app/Domains/Contact/Dav/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class Order
{
public function __construct(
public int $order,
) {
}
) {}

/**
* Get order value from a reflection class.
Expand Down
4 changes: 2 additions & 2 deletions app/Domains/Contact/Dav/Services/ExportVCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function execute(array $data): VCard
} elseif (isset($data['group_id'])) {
$obj = $this->group;
} else {
throw new ModelNotFoundException();
throw new ModelNotFoundException;
}

$vcard = $this->export($obj);
Expand Down Expand Up @@ -123,7 +123,7 @@ private function getSource(VCardResource $vcard): string
'group' => $vcard,
]);
} else {
throw new ModelNotFoundException();
throw new ModelNotFoundException;
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/Domains/Contact/Dav/Services/GetEtag.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function execute(array $data): string
$entry = $data['entry'];

if ($entry->vault_id !== $this->vault->id) {
throw new ModelNotFoundException();
throw new ModelNotFoundException;
}

return $entry->distant_etag ?? '"'.hash('sha256', $entry->vcard).'"';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function getObjectUuid(?string $collectionId, string $uuid): ?VCardResour
->find($collectionId);

if (! $vault) {
throw new NotEnoughPermissionException();
throw new NotEnoughPermissionException;
}

return Contact::firstWhere([
Expand Down
11 changes: 3 additions & 8 deletions app/Domains/Contact/Dav/Web/DAVACL/PrincipalBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class PrincipalBackend extends AbstractBackend
{
public function __construct(
private User $user
) {
}
) {}

/**
* This is the prefix that will be used to generate principal urls.
Expand Down Expand Up @@ -96,9 +95,7 @@ public function getPrincipalByPath($path): array
* @param string $path
* @param \Sabre\DAV\PropPatch $propPatch
*/
public function updatePrincipal($path, DAV\PropPatch $propPatch): void
{
}
public function updatePrincipal($path, DAV\PropPatch $propPatch): void {}

/**
* This method is used to search for principals matching a set of
Expand Down Expand Up @@ -188,7 +185,5 @@ public function getGroupMembership($principal): array
*
* @param string $principal
*/
public function setGroupMemberSet($principal, array $members): void
{
}
public function setGroupMemberSet($principal, array $members): void {}
}
4 changes: 1 addition & 3 deletions app/Domains/Contact/DavClient/Jobs/UpdateAddressBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Collection;

class UpdateAddressBooks implements ShouldQueue
{
Expand All @@ -26,8 +26,6 @@ public function handle(): void

/**
* Manage the subscriptions.
*
* @param Collection<array-key,AddressBookSubscription> $subscriptions
*/
private function manageSubscriptions(Collection $subscriptions, Carbon $now): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function validate(array $data): void
$this->subscription = AddressBookSubscription::findOrFail($data['addressbook_subscription_id']);

if ($this->subscription->user->account_id !== $data['account_id']) {
throw new ModelNotFoundException();
throw new ModelNotFoundException;
}

// TODO: check if account is limited
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ private function iterateOver(array $list, string $name, callable $callback): mix
*/
public function propPatch(array $properties, string $url = ''): bool
{
$propPatch = new PropPatch();
$propPatch = new PropPatch;
$propPatch->properties = $properties;
$body = (new Service())->write(
$body = (new Service)->write(
'{DAV:}propertyupdate',
$propPatch
);
Expand Down Expand Up @@ -524,7 +524,7 @@ public function request(string $method, string $url = '', mixed $body = null, ar
*/
private static function parseMultiStatus(string $body): array
{
$multistatus = (new Service())
$multistatus = (new Service)
->expect('{DAV:}multistatus', $body);

$result = [];
Expand Down
Loading

0 comments on commit 47efde6

Please sign in to comment.