]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
generate an etag for shownotice
authorEvan Prodromou <evan@controlyourself.ca>
Tue, 2 Dec 2008 04:50:21 +0000 (23:50 -0500)
committerEvan Prodromou <evan@controlyourself.ca>
Tue, 2 Dec 2008 04:50:21 +0000 (23:50 -0500)
darcs-hash:20081202045021-5ed1f-ca0f14051507602bab8898e1e99d9cdb69f2eadc.gz

actions/shownotice.php

index cedf09678ae9fb5e715b9be1431d2866e7abaec4..d32846aadc75def10706a9c7e111ea28d20e7640 100644 (file)
@@ -42,14 +42,24 @@ class ShownoticeAction extends StreamAction {
                        return false;
                }
 
+               $this->avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
+
                return true;
        }
 
        function last_modified() {
-               $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
                return max(strtotime($this->notice->modified),
                                   strtotime($this->profile->modified),
-                                  ($avatar) ? strtotime($this->avatar->modified) : 0);
+                                  ($this->avatar) ? strtotime($this->avatar->modified) : 0);
+       }
+
+       function etag() {
+               return 'W/"' . implode(':', array($this->arg('action'),
+                                                                                 common_language(),
+                                                                                 $this->notice->id,
+                                                                                 strtotime($this->notice->modified),
+                                                                                 strtotime($this->profile->modified),
+                                                                                 ($this->avatar) ? strtotime($this->avatar->modified) : 0));
        }
 
        function handle($args) {