]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add rel=self links to atom entries
authorEvan Prodromou <evan@status.net>
Mon, 25 Oct 2010 13:48:01 +0000 (09:48 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 25 Oct 2010 13:48:01 +0000 (09:48 -0400)
classes/Notice.php

index 676e4cb546a078fec21592f17db2fd21d1886538..90ea811b6bce7710d606ac9539afa2f095704195 100644 (file)
@@ -1615,15 +1615,30 @@ class Notice extends Memcached_DataObject
 
         // @fixme check this logic
 
-        if ($this->isLocal() && !empty($cur) && $cur->id == $this->profile_id) {
-            $relEditUrl = common_local_url('ApiStatusesShow', array('id' => $this->id,
-                                                                    'format' => 'atom'));
+        if ($this->isLocal()) {
 
-            if (Event::handle('StartActivityRelEdit', array(&$this, &$xs, &$relEditUrl))) {
-                $xs->element('link', array('rel' => 'edit',
+            $selfUrl = common_local_url('ApiStatusesShow', array('id' => $this->id,
+                                                                 'format' => 'atom'));
+
+            if (Event::handle('StartActivityRelSelf', array(&$this, &$xs, &$selfUrl))) {
+                $xs->element('link', array('rel' => 'self',
                                            'type' => 'application/atom+xml',
-                                           'href' => $relEditUrl));
-                Event::handle('EndActivityRelEdit', array(&$this, &$xs, $relEditUrl));
+                                           'href' => $selfUrl));
+                Event::handle('EndActivityRelSelf', array(&$this, &$xs, $selfUrl));
+            }
+
+            if (!empty($cur) && $cur->id == $this->profile_id) {
+
+                // note: $selfUrl may have been changed by a plugin
+                $relEditUrl = common_local_url('ApiStatusesShow', array('id' => $this->id,
+                                                                        'format' => 'atom'));
+
+                if (Event::handle('StartActivityRelEdit', array(&$this, &$xs, &$relEditUrl))) {
+                    $xs->element('link', array('rel' => 'edit',
+                                               'type' => 'application/atom+xml',
+                                               'href' => $relEditUrl));
+                    Event::handle('EndActivityRelEdit', array(&$this, &$xs, $relEditUrl));
+                }
             }
         }