Skip to content

Commit

Permalink
fix: published project policy issues fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CS76 committed Jan 15, 2024
1 parent be04a3e commit f03801f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/Policies/ProjectPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function createProject(User $user)
*/
public function updateProject(User $user, Project $project)
{
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published) {
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published || (! $project->is_published && $project->doi)) {
return false;
}

Expand Down
12 changes: 6 additions & 6 deletions resources/js/Pages/Project/Index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<div>
<div class="flex items-baseline justify-between">
<!-- <div class="flex items-baseline justify-between">
<div id="tour-step-projects">
<h2 class="text-lg">Projects</h2>
<!-- <div class="mt-2 text-sm text-gray-700"> -->
<!-- <div class="max-w-2xl">You may house a variety of projects.</div> -->
<!-- </div> -->
<div class="mt-2 text-sm text-gray-700">
<div class="max-w-2xl">You may house a variety of projects.</div>
</div>
</div>
</div>
</div> -->
<span v-if="projects.length <= 0">
<div v-if="mode == 'create' && editableTeamRole" class="mt-4">
<div class="px-6 py-4 bg-white shadow-md rounded-lg">
Expand Down Expand Up @@ -368,7 +368,7 @@
"
class="float mt-1 border-t px-3 py-0.5 -mx-6 mt-4 text-sm font-medium bg-yellow-100 text-red-800 capitalize"
>
PUBLISHED -&emsp;
&nbsp;&nbsp;
<b
>Release date:
{{ formatDate(project.release_date) }}</b
Expand Down
31 changes: 19 additions & 12 deletions resources/js/Pages/Project/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
restore a deleted project within the 30-day recovery period.
</div>
<div
v-if="!project.is_public && project.is_published"
v-if="
!project.is_public && !project.is_published && project.doi
"
class="text-center px-3 py-2 bg-green-50 text-green-700 border-b"
>
<b>Info: </b> This project is published and set to be released
on {{ formatDate(project.release_date) }}. You cannot edit a
published project, please create a new version to updated the
project.
<b>Info: </b> This project is in embargo and set to be released
on {{ formatDate(project.release_date) }}. You cannot edit the
project, please create a new version to updated the project.
</div>
<div v-if="project.is_public">
<div
Expand All @@ -31,9 +32,9 @@
v-else
class="text-center px-3 py-2 bg-green-50 text-green-700 border-b"
>
<b>Info: </b> This project is published. You cannot edit a
published project, please create a new version to updated
the project.
<b>Info: </b> This project is archived. You cannot edit a
archived project, please create a new version to updated the
project.
</div>
</div>
<div v-if="project.is_public && project.doi != null">
Expand Down Expand Up @@ -325,17 +326,23 @@
v-if="
!project.is_public &&
!project.is_published &&
!project.is_deleted
!project.is_deleted &&
!project.doi
"
class="flex-nowrap"
>
<Publish :project="project" />
</div>
<div v-if="!project.is_public && project.is_published">
<div
v-if="
!project.is_public &&
!project.is_published &&
project.doi
"
>
<span
class="ml-4 inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-yellow-100 text-red-800 capitalize"
class="ml-4 py-2 inline-flex items-center px-3 rounded-md text-sm font-medium bg-yellow-100 text-red-800 capitalize"
>
PUBLISHED -&emsp;
<b
>Release date:
{{ formatDate(project.release_date) }}</b
Expand Down

0 comments on commit f03801f

Please sign in to comment.