Skip to content

Commit

Permalink
chore: resolved merge conflicts with latest development
Browse files Browse the repository at this point in the history
  • Loading branch information
NRayya committed Oct 17, 2023
2 parents 6af2953 + b126b79 commit 27f8998
Show file tree
Hide file tree
Showing 147 changed files with 4,691 additions and 1,855 deletions.
5 changes: 3 additions & 2 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ protected function updateVerifiedUser($user, array $input)
$user->forceFill([
'first_name' => $input['first_name'],
'last_name' => $input['last_name'],
'name' => $input['name'] ? $input['name'] : $user->name,
'username' => $input['username'],
'name' => $input['username'] ? $input['username'] : $user->name,
'email' => $input['email'],
'email_verified_at' => null,
'orcid_id' => $input['orcid_id'],
'affiliation' => $input['affiliation'],
])->save();

$user->sendEmailVerificationNotification();
Expand Down
2 changes: 0 additions & 2 deletions app/Actions/Project/ArchiveProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Actions\Project;

use App\Models\Project;
use App\Models\User;

class ArchiveProject
{
Expand All @@ -24,7 +23,6 @@ public function toggle($project)
$project->save();
if ($project->is_archived) {
$project->sendNotification('archival', $this->prepareSendList($project));
$project->sendNotification('archivalAdmin', User::role(['super-admin'])->get());
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Project/InviteProjectMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace App\Actions\Project;

use App\Events\InvitingProjectMember;
use App\Events\ProjectInvite;
use App\Mail\ProjectInvitation;
use App\Models\User;
use App\Notifications\ProjectInviteNotification;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
Expand All @@ -28,7 +28,7 @@ public function invite($user, $project, string $email, string $role = null, stri

$this->validate($project, $email, $role, $message);

InvitingProjectMember::dispatch($project, $email, $role, $message);
//InvitingProjectMember::dispatch($project, $email, $role, $message);

$invitation = $project->projectInvitations()->create([
'email' => $email,
Expand All @@ -42,7 +42,7 @@ public function invite($user, $project, string $email, string $role = null, stri
$invitedUser = User::where('email', $invitation->email)->first();

if ($invitedUser) {
$invitedUser->notify(new ProjectInviteNotification($invitation));
event(new ProjectInvite($invitedUser, $invitation));
}
}

Expand Down
6 changes: 4 additions & 2 deletions app/Actions/Study/InviteStudyMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Actions\Study;

use App\Events\InvitingStudyMember;
use App\Events\StudyInvite;
use App\Mail\StudyInvitation;
use App\Models\User;
use App\Notifications\StudyInviteNotification;
Expand All @@ -28,7 +29,7 @@ public function invite($user, $study, string $email, string $role = null, string

$this->validate($study, $email, $role, $message);

InvitingStudyMember::dispatch($study, $email, $role, $message);
//InvitingStudyMember::dispatch($study, $email, $role, $message);

$invitation = $study->studyInvitations()->create([
'email' => $email,
Expand All @@ -42,7 +43,8 @@ public function invite($user, $study, string $email, string $role = null, string
$invitedUser = User::where('email', $invitation->email)->first();

if ($invitedUser) {
$invitedUser->notify(new StudyInviteNotification($invitation));
//$invitedUser->notify(new StudyInviteNotification($invitation));
event(new StudyInvite($invitedUser, $invitation));
}
}

Expand Down
31 changes: 31 additions & 0 deletions app/Console/Commands/DataBackup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Console\Commands;

use App\Jobs\DataBackupJob;
use Illuminate\Console\Command;

class DataBackup extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nmrxiv:backup-postgres-dump';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Take postgres dump and save to ceph storage under nmrxiv bucket.';

/**
* Execute the console command.
*/
public function handle()
{
DataBackupJob::dispatch();
}
}
1 change: 1 addition & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected function schedule(Schedule $schedule)
$schedule->command('nmrxiv:delete-projects')->daily();
$schedule->command('nmrxiv:delete-citations')->weekly();
$schedule->command('nmrxiv:delete-authors')->weekly();
$schedule->command('nmrxiv:backup-postgres-dump')->daily();
}

/**
Expand Down
33 changes: 0 additions & 33 deletions app/Events/InvitingProjectMember.php

This file was deleted.

33 changes: 0 additions & 33 deletions app/Events/InvitingStudyMember.php

This file was deleted.

37 changes: 37 additions & 0 deletions app/Events/ProjectArchival.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;

class ProjectArchival implements ShouldBroadcastNow
{
use Dispatchable;

public $project;

public $sendTo;

/**
* Create a new event instance.
*/
public function __construct($project, $sendTo)
{
$this->project = $project;
$this->sendTo = $sendTo;
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
37 changes: 37 additions & 0 deletions app/Events/ProjectDeletion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;

class ProjectDeletion implements ShouldBroadcastNow
{
use Dispatchable;

public $project;

public $sendTo;

/**
* Create a new event instance.
*/
public function __construct($project, $sendTo)
{
$this->project = $project;
$this->sendTo = $sendTo;
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
36 changes: 36 additions & 0 deletions app/Events/ProjectInvite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;

class ProjectInvite implements ShouldBroadcastNow
{
use Dispatchable;

public $invitedUser;

public $invitation;

/**
* Create a new event instance.
*/
public function __construct($invitedUser, $invitation)
{
$this->invitedUser = $invitedUser;
$this->invitation = $invitation;
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
36 changes: 36 additions & 0 deletions app/Events/StudyInvite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;

class StudyInvite implements ShouldBroadcastNow
{
use Dispatchable;

public $invitedUser;

public $invitation;

/**
* Create a new event instance.
*/
public function __construct($invitedUser, $invitation)
{
$this->invitedUser = $invitedUser;
$this->invitation = $invitation;
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
15 changes: 15 additions & 0 deletions app/Http/Controllers/Admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,19 @@ public function markNotificationAsRead(User $user, Request $request)

return $request->wantsJson() ? new JsonResponse('', 200) : back()->with('status', 'notification-markedAsRead');
}

/**
* Mark all notification as read.
*
* @param User $user
* @return \Illuminate\Http\RedirectResponse
*/
public function markAllNotificationAsRead(Request $request)
{
$user = Auth::user();

$user->unreadNotifications()->update(['read_at' => now()]);

return $request->wantsJson() ? new JsonResponse('', 200) : back()->with('status', 'all-notification-markedAsRead');
}
}
4 changes: 3 additions & 1 deletion app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function show(Request $request, Project $project, GetLicense $getLicense)
}

$team = $project->nonPersonalTeam;
$user = Auth::user();
$license = null;
if ($project->license_id) {
$license = $getLicense->getLicensebyId($project->license_id);
Expand All @@ -128,7 +129,8 @@ public function show(Request $request, Project $project, GetLicense $getLicense)
'team' => $team ? $team->load(['users', 'owner']) : null,
'members' => $project->allUsers(),
'availableRoles' => array_values(Jetstream::$roles),
'role' => $project->userProjectRole(Auth::user()->email),
'role' => $project->userProjectRole($user->email),
'teamRole' => $user->belongsToTeam($team) ? $user->teamRole($team) : null,
'license' => $license ? $license[0] : null,
'projectPermissions' => [
'canDeleteProject' => Gate::check('deleteProject', $project),
Expand Down
1 change: 1 addition & 0 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function share(Request $request)
'user.roles' => fn () => $user ?
$user->getRoleNames()
: null,
'teamRole' => fn () => $user ? $user->teamRole($user->currentTeam) : null,
'user.notifications' => fn () => $user ?
$user->unreadNotifications : null,
'twitter' => (env('TWITTER_CLIENT_ID') !== null && env('TWITTER_CLIENT_ID') !== ''),
Expand Down
Loading

0 comments on commit 27f8998

Please sign in to comment.