Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

users can delete their cards from their collection #118

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

larafa
Copy link
Contributor

@larafa larafa commented Apr 26, 2018

  • still need to add disappear pop message after clicking yes
  • Do I remove the card from the cards list or just set the user id null when the user deletes card from their collection?

@codecov-io
Copy link

codecov-io commented Apr 26, 2018

Codecov Report

Merging #118 into master will decrease coverage by 2.04%.
The diff coverage is 3.22%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #118      +/-   ##
============================================
- Coverage     23.58%   21.53%   -2.05%     
- Complexity      133      152      +19     
============================================
  Files            91       93       +2     
  Lines          1463     1709     +246     
  Branches        188      219      +31     
============================================
+ Hits            345      368      +23     
- Misses         1042     1259     +217     
- Partials         76       82       +6
Impacted Files Coverage Δ Complexity Δ
frontend/src/actions/cards.js 13.33% <0%> (-1.49%) 0 <0> (ø)
backend/app/Http/Controllers/ProfileController.php 55.4% <0%> (-20.53%) 26 <2> (+6)
frontend/src/components/Card.js 12.12% <7.69%> (-2.88%) 0 <0> (ø)
backend/app/Models/Battle.php 50% <0%> (-16.67%) 8% <0%> (+5%)
...end/app/Http/Controllers/MarketplaceController.php 31.66% <0%> (-8.76%) 17% <0%> (+4%)
backend/app/Http/Controllers/StatsController.php 0% <0%> (ø) 7% <0%> (+4%) ⬆️
frontend/src/reducers/reducer_stats.js 0% <0%> (ø) 0% <0%> (ø) ⬇️
frontend/src/actions/stats.js 15.38% <0%> (ø) 0% <0%> (ø) ⬇️
frontend/src/reducers/reducer_user.js 0% <0%> (ø) 0% <0%> (ø) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41bac36...2861b2b. Read the comment docs.

return dispatch => {
return apiFetch('cards/' + cardId + '/delete', {
method: 'PUT',
body: JSON.stringify(cardId)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are passing the cardId through the url, I don't think you need to pass it in through the body

}

//user doesn't own card
$card->user_id = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine for now, we definitely don't want to remove the card from the db.

Copy link
Member

Choose a reason for hiding this comment

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

yeah technically we can't remove a card from the blockchain either soooo... we were dumb when writing these stories 😆

Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead add a removed field and set that to true to mark the card as removed.

The user_id field will be automatically repopulated after you 0 it out here.

We can then add a check for that removed field to our card model to make those cards hidden.

Copy link
Member

@harrischristiansen harrischristiansen left a comment

Choose a reason for hiding this comment

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

Looks good

}

//user doesn't own card
$card->user_id = null;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead add a removed field and set that to true to mark the card as removed.

The user_id field will be automatically repopulated after you 0 it out here.

We can then add a check for that removed field to our card model to make those cards hidden.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants