mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-06-04 02:39:08 -04:00
Change the API for getting to the original state of an ORM.
Old API: $obj->original("field_name")
New API: $obj->original()->field_name
This allows us to revert the varous xxx_updated events back to passing
an original ORM as well as the the updated one. This makes for a
cleaner event API.
Old API: comment_updated($comment) { $comment->original("field_name") }
Old API: comment_updated($old, $new) { $old->field_name }
This commit is contained in:
@@ -64,17 +64,17 @@ class Comment_Model extends ORM {
|
||||
$created = true;
|
||||
}
|
||||
}
|
||||
$visible_change = $this->original()->state == "published" || $this->state == "published";
|
||||
parent::save();
|
||||
|
||||
if (isset($created)) {
|
||||
module::event("comment_created", $this);
|
||||
} else {
|
||||
module::event("comment_updated", $this);
|
||||
module::event("comment_updated", $this->original(), $this);
|
||||
}
|
||||
|
||||
// We only notify on the related items if we're making a visible change, which means moving in
|
||||
// or out of a published state
|
||||
if ($this->original("state") == "published" || $this->state == "published") {
|
||||
// We only notify on the related items if we're making a visible change.
|
||||
if ($visible_change) {
|
||||
module::event("item_related_update", $this->item());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user