issue editing page, quirk removing artefacts

Bug #1521315 reported by Gary Leydon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
New
Undecided
Unassigned

Bug Description

Mahara 15.10.0, Php 5.6.12, Postgres 9.3.5

Problem removing artefact DOM element(s) when editing page (after page has been displayed)

reproducible on Mac OS X 10.9.5
    Chrome 46.0.2490.86 (64bit)
    Safari 9.0.1 99637.86.2.7.2)
    Firefox 42.0

To reproduce
Create a portfolio page
add a journal artefact to the page (or any other artefact)
add another artefact (doesn't matter what kind)

Display page (this is crucial, everything works as expected in edit mode)

Go back and edit the page
delete one of your artefacts and it gets removed from the DOM as expected
try to delete another artefact and it will appear to work but DOM will NOT be updated unless you reload page

problem found in
js/views.js

lines 538 button.on('click' ....)
the variable blockinstanceID is a global so far is the onclick function is concerned so the first time through the routine it is undefined, then on lines 546 - 548 it is set properly to the data-id attribute of the artefact you are trying to delete

When you try to delete another artefact from the page blockinstanceId retains the value from the previous call and is NOT set to the current artefacts data-id. (i.e. assignment on line 547 is skipped)

a potential fix (though I don't particularly like it)
after line 559 where the DOM element is removed add
blockinstanceId= undefined;

The only place where rewriteDeleteButton is called and blockinstanceId is 'defined' is on line 1099 setting up for the removecancel button on click function. Another fix might be to have that routine call it's own rewriteDeleteButton (maybe refactor rewriteDeleteButton ) and have onClick use it's own local blockinstanceId which is always assumed to be null.

Tags: dom javascript
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Hi Gary,

Thanks for the bug report!

I think this is the same bug as Bug 1511536, which we actually just released a fix for in Mahara 15.10.1.

Cheers,
Aaron

Revision history for this message
Gary Leydon (gary-leydon) wrote : Re: [Bug 1521315] Re: issue editing page, quirk removing artefacts
Download full text (3.6 KiB)

Sorry, I did search for blockinstanceId before reporting the bug but nothing came up. That looks like the fix. I’ll install 15.10.1

Gary Leydon
Associate Director for Technology Services
Yale University School of Medicine
Teaching and Learning Center
367 Cedar St
Harkness A
Rm 201A
<email address hidden>
ph:203-737-6408

On Nov 30, 2015, at 6:05 PM, Aaron Wells <email address hidden> wrote:

> *** This bug is a duplicate of bug 1511536 ***
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.launchpad.net_bugs_1511536&d=AwIFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=94-yAX-cTkHQdYw3rVeH53V0mBdCtF7iI4kiOi0DxFY&m=ywkhWDSJFXxvMkcMOvbyQ8KS-F1ZsDeylfr42kNMWNs&s=1uZoDuFHEEHFxhpwoWwpDNrQVO7Alfade74rOTiXKFY&e=
>
> Hi Gary,
>
> Thanks for the bug report!
>
> I think this is the same bug as Bug 1511536, which we actually just
> released a fix for in Mahara 15.10.1.
>
> Cheers,
> Aaron
>
> ** This bug has been marked a duplicate of bug 1511536
> Deleting blocks from page fails in some cases in 15.10
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.launchpad.net_bugs_1521315&d=AwIFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=94-yAX-cTkHQdYw3rVeH53V0mBdCtF7iI4kiOi0DxFY&m=ywkhWDSJFXxvMkcMOvbyQ8KS-F1ZsDeylfr42kNMWNs&s=aOYm7HQ1lFJ-ryrqfDp13hlDEThbG04R8h7rcy-vSAo&e=
>
> Title:
> issue editing page, quirk removing artefacts
>
> Status in Mahara:
> New
>
> Bug description:
> Mahara 15.10.0, Php 5.6.12, Postgres 9.3.5
>
> Problem removing artefact DOM element(s) when editing page (after page
> has been displayed)
>
> reproducible on Mac OS X 10.9.5
> Chrome 46.0.2490.86 (64bit)
> Safari 9.0.1 99637.86.2.7.2)
> Firefox 42.0
>
>
> To reproduce
> Create a portfolio page
> add a journal artefact to the page (or any other artefact)
> add another artefact (doesn't matter what kind)
>
> Display page (this is crucial, everything works as expected in edit
> mode)
>
> Go back and edit the page
> delete one of your artefacts and it gets removed from the DOM as expected
> try to delete another artefact and it will appear to work but DOM will NOT be updated unless you reload page
>
> problem found in
> js/views.js
>
> lines 538 button.on('click' ....)
> the variable blockinstanceID is a global so far is the onclick function is concerned so the first time through the routine it is undefined, then on lines 546 - 548 it is set properly to the data-id attribute of the artefact you are trying to delete
>
> When you try to delete another artefact from the page blockinstanceId
> retains the value from the previous call and is NOT set to the current
> artefacts data-id. (i.e. assignment on line 547 is skipped)
>
> a potential fix (though I don't particularly like it)
> after line 559 where the DOM element is removed add
> blockinstanceId= undefined;
>
> The only place where rewriteDeleteButton is called and blockinstanceId
> is 'defined' is on line 1099 setting up for the removecancel button on
> click function. Another fix might be to have that routine call it's
> own rewriteDeleteButton (maybe refactor rewriteDeleteButto...

Read more...

Revision history for this message
Gary Leydon (gary-leydon) wrote :
Download full text (3.5 KiB)

I can confirm that 15.10.1 fixed my problem
Thanks!

Gary Leydon
Associate Director for Technology Services
Yale University School of Medicine
Teaching and Learning Center
367 Cedar St
Harkness A
Rm 201A
<email address hidden>
ph:203-737-6408

On Nov 30, 2015, at 6:05 PM, Aaron Wells <email address hidden> wrote:

> *** This bug is a duplicate of bug 1511536 ***
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.launchpad.net_bugs_1511536&d=AwIFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=94-yAX-cTkHQdYw3rVeH53V0mBdCtF7iI4kiOi0DxFY&m=ywkhWDSJFXxvMkcMOvbyQ8KS-F1ZsDeylfr42kNMWNs&s=1uZoDuFHEEHFxhpwoWwpDNrQVO7Alfade74rOTiXKFY&e=
>
> Hi Gary,
>
> Thanks for the bug report!
>
> I think this is the same bug as Bug 1511536, which we actually just
> released a fix for in Mahara 15.10.1.
>
> Cheers,
> Aaron
>
> ** This bug has been marked a duplicate of bug 1511536
> Deleting blocks from page fails in some cases in 15.10
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.launchpad.net_bugs_1521315&d=AwIFaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=94-yAX-cTkHQdYw3rVeH53V0mBdCtF7iI4kiOi0DxFY&m=ywkhWDSJFXxvMkcMOvbyQ8KS-F1ZsDeylfr42kNMWNs&s=aOYm7HQ1lFJ-ryrqfDp13hlDEThbG04R8h7rcy-vSAo&e=
>
> Title:
> issue editing page, quirk removing artefacts
>
> Status in Mahara:
> New
>
> Bug description:
> Mahara 15.10.0, Php 5.6.12, Postgres 9.3.5
>
> Problem removing artefact DOM element(s) when editing page (after page
> has been displayed)
>
> reproducible on Mac OS X 10.9.5
> Chrome 46.0.2490.86 (64bit)
> Safari 9.0.1 99637.86.2.7.2)
> Firefox 42.0
>
>
> To reproduce
> Create a portfolio page
> add a journal artefact to the page (or any other artefact)
> add another artefact (doesn't matter what kind)
>
> Display page (this is crucial, everything works as expected in edit
> mode)
>
> Go back and edit the page
> delete one of your artefacts and it gets removed from the DOM as expected
> try to delete another artefact and it will appear to work but DOM will NOT be updated unless you reload page
>
> problem found in
> js/views.js
>
> lines 538 button.on('click' ....)
> the variable blockinstanceID is a global so far is the onclick function is concerned so the first time through the routine it is undefined, then on lines 546 - 548 it is set properly to the data-id attribute of the artefact you are trying to delete
>
> When you try to delete another artefact from the page blockinstanceId
> retains the value from the previous call and is NOT set to the current
> artefacts data-id. (i.e. assignment on line 547 is skipped)
>
> a potential fix (though I don't particularly like it)
> after line 559 where the DOM element is removed add
> blockinstanceId= undefined;
>
> The only place where rewriteDeleteButton is called and blockinstanceId
> is 'defined' is on line 1099 setting up for the removecancel button on
> click function. Another fix might be to have that routine call it's
> own rewriteDeleteButton (maybe refactor rewriteDeleteButton ) and have
> onClick use it's own local blockinstanceId which is always assum...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.