We have moved to Github. Please open tickets there.

Opened 4 years ago

Closed 17 months ago

Last modified 16 months ago

#683 closed Defect (fixed)

Annotation update action fail should not delete annotation

Reported by: marcus Owned by:
Priority: high Milestone: Elgg 1.8.3
Component: API Version: 1.8.1b1
Severity: major Keywords:
Cc: brettp Difficulty: easy

Description


Attachments (1)

annotations.diff (388 bytes) - added by hidef 2 years ago.
update_annontations returns false in case it fails

Download all attachments as: .zip

Change History (9)

comment:1 Changed 3 years ago by brettp

  • Component set to API
  • Milestone set to Elgg 1.8
  • Priority changed from minor to major

comment:2 Changed 3 years ago by brettp

  • Difficulty set to easy

comment:3 Changed 3 years ago by ewinslow

  • Milestone changed from Elgg 1.8 to Elgg 1.8.1

Changed 2 years ago by hidef

update_annontations returns false in case it fails

comment:4 Changed 18 months ago by Facyla

  • Version set to 1.8.1b1

The submitted patch returns false when update_annotation fails.. BUT still deletes the annotation itself !
I think update_annotation(à should return true or false, based on success, but not delete the updated annotation in the process, whatever happens. If the annotation should be deleted, let do it depending on update result, or via the event hook.

I don't know yet how to submit diff patches, but here's the change based on 1.8 : http://reference.elgg.org/1.8/annotations_8php_source.html#l00132
FROM :
00167 if (elgg_trigger_event('update', 'annotation', $obj)) {
00168 return true;
00169 } else {
00170 @todo add plugin hook that sends old and new annotation information before db access
00171 elgg_delete_annotation_by_id($annotation_id);
00172 }

TO :
00167 if (elgg_trigger_event('update', 'annotation', $obj)) {
00168 return true;
00169 } else {
00170 @todo add plugin hook that sends old and new annotation information before db access
00171 return false;
00172 }

comment:5 Changed 18 months ago by Facyla

formatted code excerpt...

Changes based on 1.8 : http://reference.elgg.org/1.8/annotations_8php_source.html#l00132 :

FROM :

00167         if (elgg_trigger_event('update', 'annotation', $obj)) {
00168             return true;
00169         } else {
00170             // @todo add plugin hook that sends old and new annotation information before db access
00171             elgg_delete_annotation_by_id($annotation_id);
00172         }

TO :

00167         if (elgg_trigger_event('update', 'annotation', $obj)) {
00168             return true;
00169         } else {
00170             // @todo add plugin hook that sends old and new annotation information before db access
00171             return false;
00172         }

comment:6 Changed 18 months ago by cash

  • Milestone changed from Elgg 1.8.x to Elgg 1.8.3

comment:7 Changed 17 months ago by Cash Costello

  • Resolution set to fixed
  • Status changed from new to closed

Fixes #683 not deleting annotation when event handlers return false on an update

Changeset: 9e311e7236188e826277aed3dca733e02eb21f6a

comment:8 Changed 16 months ago by Cash Costello

Fixes #683 not deleting annotation when event handlers return false on an update

Changeset: 9e311e7236188e826277aed3dca733e02eb21f6a

Note: See TracTickets for help on using tickets.