openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

questions and replies should be editable #31

Closed moui72 closed 7 years ago

moui72 commented 8 years ago

I realize that this is likely a feature that is already in the pipeline, and that it may be something that we don't have time to implement for the current version, but I just thought I'd make an issue so we don't forget about it.

I'd imagine that questions and replies should be editable both by their authors and by the relevant faculty

moui72 commented 8 years ago

To consider:

perhaps replies should also be deletable by their authors and by the relevant faculty.

also, questions with no replies should maybe be deletable by their authors, and questions in general should likely be deletable by the relevant faculty

boonebgorges commented 7 years ago

I started thinking about implementing this, but I don't think it can move forward without design. A couple of thoughts:

moui72 commented 7 years ago

I can't add labels, but this should probably have needs-design

boonebgorges commented 7 years ago

Yes. Added. I'll also see if I can grant you more access to the repo.

boonebgorges commented 7 years ago

Sorry for the delay on this - it was a lot of work. But the first pass is up and ready to test on openlabdev.org/webwork-playground. (Jenna's comp, for reference: https://www.dropbox.com/s/v1yosvl4yozxwal/OLWW_LAYOUT_PROBLEMPOSTV4-EDITQuestion.png?dl=0)

moui72 commented 7 years ago

so far edit functionality seems good, but I noticed an issue with the 'delete' button: when I edit a reply and then click 'delete' it will render the question without ANY replies. a page refresh restores them, though. I am assuming this has to do with the ajax request after delete not returning the list of replies and then populating the DOM with nothing.

editing one of many replies

image

after delete clicked

image

after page reloaded

image

boonebgorges commented 7 years ago

@moui72 Good find, and thanks for the detailed report. Looks like I messed up the routine that marks the reply as being removed (in the client) after deletion (from the server). This should now be fixed.

moui72 commented 7 years ago

perfect!

one thing I noticed, but this may be more of something to @jspevack to consider, is that you can have several responses in "edit mode" at a time -- but, functionality is properly localized/contextualized, so there is no behavior issues.

do we like this as is or do we want other edits to "close" when another is "opened"?

what do you think, @bree-z

many-edits

bree-z commented 7 years ago

I was trying to test out @moui72 's observation and have found that none of my edits save properly.

I've tried while logged in as Test Student and Test Faculty, and have tried editing my own questions and other users' questions. Here's what happens:

I click edit, make some edits, and click save. The button says "Saving," but my edits don't appear. If I click "Edit" again, they're there. If I reload, I still don't see them and if I click edit after reloading, they're not not there.

I'm seeing the same thing in Firefox (54.0.1) and Chrome (60.0.3112.78) on OS X 10.12.5.

While editing the question (logged in as Test Faculty):

editingquestion

After clicking Save:

editsdisappeared

boonebgorges commented 7 years ago

Thanks for the screenshots. Looking at the JS console, I see that the server is returning a 403 Forbidden.

In the case of questions, WordPress is doing something odd with user permissions. I've overridden them with some custom logic.

In the case of responses, the permission check I'd written validated against question authorship. I'm unsure why I originally did this. It seems correct that the response author ought to be able to edit an item, not the question author. Right?

boonebgorges commented 7 years ago

(ready to test on openlabdev.org)

bree-z commented 7 years ago

Thanks, Boone! This looks good to me.

And re response permission checks, I agree that a response author should be the one who can edit a response.

moui72 commented 7 years ago

Thanks @bree-z for catching what I missed. I was logged in as super user and not thinking about permissions.

moui72 commented 7 years ago

I think this is all set

boonebgorges commented 7 years ago

Thank you both!