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

SHARE-584 Introduction Task - Simon #5053

Closed
wants to merge 3 commits into from

Conversation

simon-costisella
Copy link

This is my Introduction Task and I changed the ProjectController.php and project_details.html.twig to add a steal button. I changed the codeView Button to the steal button.


Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name and id of the Jira ticket in the PR’s title eg.: SHARE-666 The devils ticket
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no warnings and errors
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Verify that all tests are passing (CI), if not please state the test cases in the section below
  • Perform a self-review of the changes
  • Stick to the project’s git workflow (rebase and squash your commits)
  • Verify that your changes do not have any conflicts with the base branch
  • Put your ticket into the Code Review section in Jira
  • Post a message in the #catroweb Slack channel and ask for a code reviewer
  • Check that your pull request has been successfully deployed to https://web-test-1.catrob.at/

Additional Description

TODO: Add additional information that is not in your commit-message here

Tests - additional information

The tests fail because of the missing code view button

TODO: add additional information about testruns here

This is my Introduction Task and I changed the ProjectController.php and project_details.html.twig to add a steal button. I changed the codeView Button to the steal button.
@dmetzner dmetzner added the training Just a training PR. Do not merge! label Jul 4, 2024
'text': "codeview.title"|trans({}, "catroweb")
'text': "Steal"
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 have not used the translation system, just a heads up for the future:

codeview.title is registered by the developer in the translations/catroweb.en.yaml file as

codeview:
    title: Steal

All other translation files; E.g catroweb.de.yml are translated in its own process (automated by GitHub Actions) using Crowdin -> More details here: https://catrobat.atlassian.net/wiki/spaces/CATWEB/pages/74383377/Crowdin+-+Translation+Management

@@ -212,6 +211,31 @@ public function projectLike(Request $request, string $id): Response
]);
}

#[Route(path: '/projectStealButton/{id}', name: 'projectStealButton', methods: ['GET'])]
Copy link
Collaborator

@dmetzner dmetzner Jul 4, 2024

Choose a reason for hiding this comment

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

At Catroweb we try to write our code using the API approach, to decouple the frontend from the backend. We have multiple different frontends (ours on the share, and also the apps)
Usually, your request (steal) would use our API (https://github.com/Catrobat/Catroweb-API // https://developer.catrobat.org/Catroweb-API/) Of course that is an oerhead for the training example.

Instead of using a GET request, consider using POST which is used to send data to a server to create/update a resource. Feel free to take a look at all available methods: https://www.w3schools.com/tags/ref_httpmethods.asp

That said it would be nice, to return a status code rather than a redirect in the response, and handle the response using the frontend logic.

$project->setUser($user);
$this->entity_manager->flush();

$this->addFlash('snackbar', 'Project stolen successfully!');
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about the case, when the user already owns the project?

@dmetzner dmetzner marked this pull request as draft July 4, 2024 07:39
@dmetzner
Copy link
Collaborator

dmetzner commented Jul 4, 2024

Found 1 of 903 files that can be fixed in 11.917 seconds, 20.00 MB memory used
Error: Process completed with exit code 8.

With php composer.phar fix those code style issues can be resolved automatically

@@ -63,11 +63,11 @@
</div>
<div class="col-6 mb-3 d-lg-none mt-3">
{% include 'components/redirect_button.twig' with {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually, a new feature should not replace an existing feature ;)

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 8.33333% with 11 lines in your changes missing coverage. Please review.

Project coverage is 46.96%. Comparing base (0361ecb) to head (97fc253).
Report is 588 commits behind head on develop.

Files with missing lines Patch % Lines
...plication/Controller/Project/ProjectController.php 8.33% 11 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #5053      +/-   ##
=============================================
+ Coverage      40.14%   46.96%   +6.81%     
- Complexity      5927     6162     +235     
=============================================
  Files            670      681      +11     
  Lines          20967    21528     +561     
=============================================
+ Hits            8418    10110    +1692     
+ Misses         12549    11418    -1131     
Flag Coverage Δ
behat 44.96% <8.33%> (+7.37%) ⬆️
phpunit 7.75% <0.00%> (-0.47%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is my Introduction Task and I changed the ProjectController.php and project_details.html.twig to add a steal button. I changed the codeView Button to the steal button.
@simon-costisella
Copy link
Author

@schaubes ready for review :)

@dmetzner dmetzner force-pushed the develop branch 14 times, most recently from dc968e3 to a853379 Compare August 6, 2024 13:49
@dmetzner dmetzner closed this Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training Just a training PR. Do not merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants