Skip to content

Delete channels from the channel edit view - #2988

Merged
sairina merged 1 commit into
learningequality:hotfixesfrom
micahscopes:delete-channels-in-edit-page
Feb 24, 2021
Merged

Delete channels from the channel edit view#2988
sairina merged 1 commit into
learningequality:hotfixesfrom
micahscopes:delete-channels-in-edit-page

Conversation

@micahscopes

@micahscopesmicahscopes commented Feb 24, 2021

Copy link
Copy Markdown
Contributor

Description

Fixes deletion of channels from the channel edit page.

Issue Addressed (if applicable)

Fixes#2894

Steps to Test

  • Edit channel that you want to delete
  • Delete the channel using the "..." menu in the upper right corner of the channel edit page
  • Ensure that the channel was deleted, you were redirected to the channel list page and that the snackbar message appears.

Implementation Notes (optional)

At a high level, how did you implement this?

There were two small bugs:

  • Two functions shared the same name
  • A promise was being returned from inside of a Dexie transaction

this.showProgressModal = true;
},
deleteChannel() {
deleteChannelModal() {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

deleteChannel also happened to be the name of a vuex action that was mapped into this component, so these were conflicting.

// Call endpoint directly in case we need to navigate to new page
return this.transaction({ mode: 'rw', source: IGNORED_SOURCE }, () => {
return this.table.update(id, { deleted: true }).then(() => {
return client.patch(this.modelUrl(id), { deleted: true });

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Dexie doesn't support using these kinds of promises inside of transactions, see here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might be a useful code comment?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'll add it!

@micahscopes
micahscopesforce-pushed the delete-channels-in-edit-page branch 2 times, most recently from fa7095f to f9e1040CompareFebruary 24, 2021 15:04
@micahscopes
micahscopesforce-pushed the delete-channels-in-edit-page branch from f9e1040 to 295bf95CompareFebruary 24, 2021 15:07

@sairinasairina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@sairina
sairina merged commit 4182f86 into learningequality:hotfixesFeb 24, 2021
@metodimilevqa

Copy link
Copy Markdown

I confirm the fix is successful with #3000

Sign up for freeto 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.

Cannot Delete Channels from Channel Edit Page

4 participants

@micahscopes@metodimilevqa@rtibbles@sairina