UX-wise, the "report to Mollom" link duplicates the "delete" link, and you have to read carefully to understand that by reporting, something will be deleted.

Additionally, that completely separate form requires us to not only resemble complex permission checks for every single entity. It also makes full integration of third-party modules like Webform very complex.

In #645374: Make entity ids available to form submit handlers, I've prepared Drupal core to supply the entity id in the same form value location as in the entity edit form. This allows Mollom to simply re-use and integrate with all the regular delete confirmation forms, instead of duplicating them.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Needs review
FileSize
19.94 KB

So this is what it will approx. look like. Already works to some extent (only tests are failing).

However, I searched the issue queue pretty extensively and tried to find the reason for why we have those "unpublish and report to Mollom" node/comment operations.

They make absolutely zero sense for me. And since they make things more complex than they need to be and also break my tests, I will go ahead and kill them.

sun’s picture

FileSize
19.13 KB

I like.

sun’s picture

#states flavor.

report-comment.png

Doesn't work out though, since radio buttons cannot be deselected. Otherwise, quite cool. :)

sun’s picture

Still lovely. That's what I had previously:

report-select.png

sun’s picture

I also considered this, but when actually having to use it, it's much slower than a exposed radio list.

report-human-compact.png

sun’s picture

So let's go with this:

report-final.png

...

Yes, I shortened the options even more. And I also shortened the description. This widget was *far* too verbose. So the worst that can happen, happens: You are either confused, or you don't read it at all.

sun’s picture

Remaining @todos:

+++ mollom.module	18 Feb 2010 02:49:34 -0000
@@ -367,15 +368,86 @@ function mollom_data_save($entity, $id) 
+function mollom_data_delete_form_submit($form, &$form_state) {
+  // @todo Only works for forms with configured enabled_fields currently.
+  $data = mollom_form_get_values($form_state['values'], $form_state['mollom']['enabled_fields'], $form_state['mollom']['mapping']);
+  // @todo This should not happen, but can.
+  if (!isset($data['post_id'])) {
+    return;
+  }

Didn't think of this use-case originally. This means we need to iterate over all "elements", not "enabled_fields".

Shouldn't hold up this patch, but should be a critical task in the queue.

+++ mollom.module	18 Feb 2010 02:49:34 -0000
@@ -438,6 +511,57 @@ function mollom_form_alter(&$form, &$for
+  // Integrate with delete confirmation forms to send feedback to Mollom.
...
+    // @todo Cache this info somehow.
+    $form_info = mollom_get_form_info();
+    foreach ($form_info as $mollom_form_id => $info) {
+      if (isset($info['delete form']) && $info['delete form'] == $form_id) {
+        if (mollom_get_mode($mollom_form_id)) {
+          $report = TRUE;
+          $mollom_form = mollom_form_load($mollom_form_id);
+        }
+        break;
+      }
+    }
+    if (isset($report) && isset($mollom_form['entity']) && isset($mollom_form['mapping']['post_id'])) {

1) We need to cache this in a suitable manner, i.e. using "delete form" as primary array key and the form id as value. Invalidate the cache whenever mollom_form_save() runs. Create the cache whenever mollom_get_form_info() runs.

Alternatively, consider to use a variable. Doesn't change invalidation/creation rules though.

2) We also need to cache mollom_get_form_info(). That is, because Webform needs to load entire nodes to build its form info for Mollom. mollom_get_form_info() is invoked for every form. Performance killer. Also applies to D6, unfortunately. :-/

+++ mollom.module	18 Feb 2010 02:49:34 -0000
@@ -847,6 +971,9 @@ function mollom_theme() {
+    'mollom_form_element' => array(
+      'render element' => 'element',
+    ),

Sorry, forgot to remove.

Powered by Dreditor.

Dries’s picture

1. The mass node and comment operations have been deleted. These are very important to keep.

2.

+++ mollom.module	18 Feb 2010 02:49:34 -0000
@@ -6,6 +6,7 @@
+ * @todo Add {mollom}.created column to remove session data older than $maxage.

Good idea, and should probably be backported to D6.

3.

+++ mollom.module	18 Feb 2010 02:49:34 -0000
@@ -1638,6 +1709,40 @@ function user_mollom_form_info() {
 /**
+ * Implements hook_user_cancel().
+ */
+function mollom_user_cancel($edit, $account, $method) {
+  switch ($method) {
+    case 'user_cancel_reassign':
+    case 'user_cancel_delete':
+      mollom_data_delete('user', $account->uid);
+      break;
+  }
+}

If we add the 'created' column and expire older entries, this might not be necessary?

sun’s picture

FileSize
20.8 KB

Safety re-roll against HEAD. No changes since last patch. I'll try to come back to this issue after tackling the scaling problem.

Status: Needs review » Needs work

The last submitted patch, mollom-HEAD.report.9.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
20.22 KB

Straight re-roll against HEAD. No other changes (yet).

Status: Needs review » Needs work

The last submitted patch, mollom-HEAD.report.11.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
25.89 KB

New changes in this patch:

- Added {mollom}.changed column. It's not "created", because session data for a certain entity may be updated after editing. (TBD elsewhere)

- Fixed wrong/D6 links on status report page.

- Removed all hook_ENTITY_delete() hook implementations in favor of simplified integration and automated expiry via {mollom}.changed.

@todo:

- Implement lookup cache for "delete form".

sun’s picture

FileSize
29.17 KB

I'm not 100% happy with this patch (the lookup cache), but it works and is a giant improvement over what we have currently.

Meaning: There is definitely room for improvement.

Status: Needs review » Needs work

The last submitted patch, mollom-HEAD.report.14.patch, failed testing.

Dries’s picture

Status: Needs work » Fixed

Committed to CVS HEAD. Thanks.

sun’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

Yayayay! :)

Though: part of the goal was to backport the essentials of this patch, so modules like Webform can use it + actually send feedback to Mollom. (we cannot change the integration for node, comment, user modules in D6, as users would be confused)

sun’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.37 KB
11.91 KB

So this patch:

- Adds {mollom}.changed column and expiration handling.

- Adds the mollom_data_report[_multiple]() and mollom_data_delete[_multiple]() helper functions + form alters for registered forms defining "delete form".

Additionally: A small clean-up patch for HEAD.

sun’s picture

Fixed missing $ret in module update function.

Tested with revised Webform integration, and: WORKS! :)

sun’s picture

Status: Needs review » Reviewed & tested by the community
Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to DRUPAL-6--1 and CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 8b3407b on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #717212 by sun: clean-up.
    
    
  • Commit cb25ccb on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #717212 by sun: remove 'report to Mollom' links and integrate...

  • Commit 8b3407b on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #717212 by sun: clean-up.
    
    
  • Commit cb25ccb on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #717212 by sun: remove 'report to Mollom' links and integrate...