Hard to tell from the diff but the following may let you remove the above IF statement and handle changing the coment_sources record separately.

if($new_source == 'comment' || (!$new_source && $source == 'comment'))