Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/95/archive project #99

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

martinrobled0
Copy link
Contributor

What does this PR do?

I added the option of archive and unarchived projects. Admins and project members could archive and unarchived projects.
The archive projects will be hidden in the active list of projects. But you will find it on your proposal list.

How should this be manually tested?

  1. Go to the main page of a project
  2. Click on the archive button
  3. Confirm the action
  4. Go to the active projects list, you will not find it
  5. Go to the my proposal list projects
  6. Look for the archive project and select it
  7. Click on the unarchive project
  8. Confirm the action
  9. Go to the active projects list, you will find it

What are the relevant tickets?

#95

Screenshots

image
image
image
image
image

Checklist

  • I added the necessary documentation, if appropriate.
  • I added tests to prove that my fix is effective or my feature works.
  • I reviewed existing Pull Requests before submitting mine.

Copy link
Contributor

@juanan0309 juanan0309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question a a favor:
Favor: Can you please go to the app/routes/manager/filter-tags/test/labels.test.tsx and remove the request variable that is causing the ESLint issue? I forgot to remove it in my PR.

Question: Everything works fine for me, but, if I am an Admin, and archive a project I'm not a member of, I can't unarchive it as it doesn't appear in my "My proposals" list, is there a way to unarchive the projects in this case?

IconButton,
Tooltip,
} from "@mui/material";
import { blue } from "@mui/material/colors";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this line

type="submit"
className="primary warning"
>
Yes,archive it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a space after the comma? So it be Yes, archive it

});

if (!isAdmin)
validateIsTeamMember(profileId, projectMembers, currentProject.ownerId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should move these validation functions out of the *.server.ts files, and instead do them inside the action functions. That way the database layer will be cleaner, and authorization logic will live close to the view/controller layer.

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an example of this, look at the app/routes/projects/$projectId/updateRelatedProjects.ts file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense for me. Do you want me to start it on this ticket? 👀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but only for the validations you added. To move them to the app/routes/projects/archive.tsx action.

)}

{(isTeamMember || isAdmin) &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are doing the same validation as in the edit button, I think you don't need to create your own boolean block, but just add the IconButton to the top one.

Also, I think it would be better if the edit button is the one on the rigth.

@@ -39,6 +39,7 @@
"@remix-validated-form/with-zod": "^2.0.5",
"@uiw/react-md-editor": "^3.20.1",
"bcryptjs": "^2.4.3",
"ci": "^2.2.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ups 😅

const isAdmin = user.role == adminRoleName;

try {
await unarchiveProject(projectId, profile.id, isAdmin);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since both archive and unarchive routes are pretty similar, I wonder if we should instead have a single /toggle-archive route. 🙈 . But this change is not required, is just a nitpick, if you like it as it is, you can ignore it.

<Button
disabled={isButtonDisabled}
type="submit"
className="primary warning"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these classes do nothing. Instead I would use variant="contained" and color="warning". You can checkout to docs and api.

@jackbravo jackbravo force-pushed the main branch 2 times, most recently from 24fa5ac to 8cdd302 Compare January 4, 2023 14:20
@jackbravo
Copy link
Collaborator

By @LuisTejedaS 's comment here (and I agree), seems like we should just change how we display this feature. Instead of an archive button, that seems somewhat complicated, it could be displayed just like the admin-only delete button, but for owners of the project who are not administrators. The functionality would be similar, we activate a boolean column, and hide it from most views.

We would also have an admin-only view of soft-deleted projects so we can delete them completely.

@maubarraganwize maubarraganwize marked this pull request as draft August 31, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants