Browse Source

bugfix: deleting a deck actually works

master
Inderjit Gill 4 months ago
parent
commit
5c6334957a
2 changed files with 27 additions and 17 deletions
  1. +0
    -2
      civil-server/src/db/decks.rs
  2. +27
    -15
      www/js/AppState.js

+ 0
- 2
civil-server/src/db/decks.rs View File

@ -427,8 +427,6 @@ pub(crate) async fn delete(db_pool: &Pool, user_id: Key, id: Key) -> Result<()>
)
.await?;
pg::zero(&tx, "DELETE FROM idea_extras WHERE deck_id = $1", &[&id]).await?;
pg::zero(&tx, "DELETE FROM notes_decks WHERE deck_id = $1", &[&id]).await?;
points::delete_all_points_connected_with_deck(&tx, id).await?;


+ 27
- 15
www/js/AppState.js View File

@ -144,22 +144,34 @@ export const reducer = (state, action) => {
ac: {
decks: state.ac.decks.filter(filterFn)
},
listing: {
ideas: {
all: state.listing.ideas.all.filter(filterFn),
orphans: state.listing.ideas.orphans.filter(filterFn),
recent: state.listing.ideas.recent.filter(filterFn),
},
publications: {
all: state.listing.publications.all.filter(filterFn),
orphans: state.listing.publications.orphans.filter(filterFn),
recent: state.listing.publications.recent.filter(filterFn),
rated: state.listing.publications.rated.filter(filterFn),
},
people: state.listing.people.filter(filterFn),
timelines: state.listing.timelines.filter(filterFn)
}
listing: {}
};
if (state.listing.ideas) {
newState.listing.ideas = {
all: state.listing.ideas.all.filter(filterFn),
orphans: state.listing.ideas.orphans.filter(filterFn),
recent: state.listing.ideas.recent.filter(filterFn),
};
};
if (state.listing.publications) {
newState.listing.publications = {
all: state.listing.publications.all.filter(filterFn),
orphans: state.listing.publications.orphans.filter(filterFn),
recent: state.listing.publications.recent.filter(filterFn),
rated: state.listing.publications.rated.filter(filterFn),
};
}
if (state.listing.people) {
newState.listing.people = state.listing.people.filter(filterFn);
}
if (state.listing.timelines) {
newState.listing.timelines = state.listing.timelines.filter(filterFn);
}
delete newState.fullGraph[action.id];
// todo: delete all the other references in fullGraph to action.id
delete newState.cache.deck[action.id];


Loading…
Cancel
Save