Closed (fixed)
Project:
Question/Answer
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Jul 2012 at 10:28 UTC
Updated:
16 Sep 2012 at 17:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
ec commentedA small bug, It should be a
elseifinstead ofelse! New patch added.Comment #2
ec commentedHi,
This new patch uses the code refactoring I introduced in
https://drupal.org/node/1689720#comment-6267892for thedeselectfeature.So this new patch introduces 2 new perms, one for "own" and one for "any" question.
This patch works as a standalone, that is to say that it doesn't need any other patch to work. Hence you can test this new
changelink. The use case for this is for example when after a long time with inactivity someone post a new comment more accurate to answer a question which has already a best answer selected. In this case we don't need to deselect and then select a new one. This can be done in one step.Please let me know, thanks,
Comment #3
jcisio commentedI'll modify this patch to add the support for deselecting an answer for moderation purpose. The use case is when a moderator think the selected answer is not good, or it was selected by error. So the answer could be deselected, and leave time/room for new answer.
Comment #4
jcisio commentedI refactor a bit more, add the "deselect" permissions. Only tested with uid 1, could you test the permission for 1/ author 2/ someone with permission but other than uid 1?
Then I think it'd be good to commit.
Comment #5
jcisio commentedThere should have been a patch ;)
Comment #6
jcisio commentedComment #7
ec commentedHi Jcisio,
Sorry for the delay, I'm just back from holidays. I've try your patch in #5 on my test website and, so far, it looks to work very well for all types of users.
So +1 for it.
BTW, your code refactoring is way better than mine ;-)
Best,
Comment #8
ec commentedI found one minor issue. In
question_answer.pages.incline 24 we should have this:$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? '' : $cid;instead of this:
$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? 0 : $cid;because when we are using
durationthe system check for an empty field and not a field filled with0.Comment #9
jcisio commentedYes that should be changed. However it is an integer field, I don't think '' or '0' matter (I think the default value even is NULL).
Comment #10
ec commentedYes this :
$node->{$qtype[$node->type]['answer']}[0]['value'] = ($action == 'deselect') ? NULL : $cid;works well too.
Comment #11
jcisio commentedCommitted and pushed. Move to 7.x queue for forward port.
Comment #12
jcisio commentedFixed with http://drupalcode.org/project/question_answer.git/commit/ae5d6dc