summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-06-26 10:16:27 -0400
committerBrion Vibber <brion@pobox.com>2010-06-26 10:16:27 -0400
commitd9e56e15cc3174093fc994e524d1d9cf402ae8a3 (patch)
treeba673d3417cca00b2db1e7d2c1bd7697f9712215 /classes
parentb66709215309126969104ad114874360785f3d57 (diff)
parent9eb5a976b03fae6bd1e1fce6abfe4a6c7964d1ae (diff)
Merge branch 'master' into testing
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php28
-rw-r--r--classes/Profile.php10
-rw-r--r--classes/User_group.php15
3 files changed, 46 insertions, 7 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 9ac9e10c1..e6f527439 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1190,7 +1190,7 @@ class Notice extends Memcached_DataObject
'xmlns:media' => 'http://purl.org/syndication/atommedia',
'xmlns:poco' => 'http://portablecontacts.net/spec/1.0',
'xmlns:ostatus' => 'http://ostatus.org/schema/1.0',
- 'xmlns:statusnet' => 'http://status.net/ont/');
+ 'xmlns:statusnet' => 'http://status.net/schema/api/1/');
} else {
$attrs = array();
}
@@ -1225,7 +1225,7 @@ class Notice extends Memcached_DataObject
$xs->element('title', null, common_xml_safe_str($this->content));
if ($author) {
- $xs->raw($profile->asAtomAuthor());
+ $xs->raw($profile->asAtomAuthor($cur));
$xs->raw($profile->asActivityActor());
}
@@ -1238,9 +1238,25 @@ class Notice extends Memcached_DataObject
$xs->element('published', null, common_date_w3dtf($this->created));
$xs->element('updated', null, common_date_w3dtf($this->created));
+ $source = null;
+
+ $ns = $this->getSource();
+
+ if ($ns) {
+ if (!empty($ns->name) && !empty($ns->url)) {
+ $source = '<a href="'
+ . htmlspecialchars($ns->url)
+ . '" rel="nofollow">'
+ . htmlspecialchars($ns->name)
+ . '</a>';
+ } else {
+ $source = $ns->code;
+ }
+ }
+
$noticeInfoAttr = array(
- 'local_id' => $this->id, // local notice ID (useful to clients for ordering)
- 'source' => $this->source, // the client name (source attribution)
+ 'local_id' => $this->id, // local notice ID (useful to clients for ordering)
+ 'source' => $source, // the client name (source attribution)
);
$ns = $this->getSource();
@@ -1252,8 +1268,8 @@ class Notice extends Memcached_DataObject
if (!empty($cur)) {
$noticeInfoAttr['favorite'] = ($cur->hasFave($this)) ? "true" : "false";
- $profile = $cur->getProfile();
- $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false";
+ $profile = $cur->getProfile();
+ $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false";
}
if (!empty($this->repeat_of)) {
diff --git a/classes/Profile.php b/classes/Profile.php
index 54f557ea7..a303469e9 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -849,15 +849,23 @@ class Profile extends Memcached_DataObject
*
* Assumes that Atom has been previously set up as the base namespace.
*
+ * @param Profile $cur the current authenticated user
+ *
* @return string
*/
- function asAtomAuthor()
+ function asAtomAuthor($cur = null)
{
$xs = new XMLStringer(true);
$xs->elementStart('author');
$xs->element('name', null, $this->nickname);
$xs->element('uri', null, $this->getUri());
+ if ($cur != null) {
+ $attrs = Array();
+ $attrs['following'] = $cur->isSubscribed($this) ? 'true' : 'false';
+ $attrs['blocking'] = $cur->hasBlocked($this) ? 'true' : 'false';
+ $xs->element('statusnet:profile_info', $attrs, null);
+ }
$xs->elementEnd('author');
return $xs->getString();
diff --git a/classes/User_group.php b/classes/User_group.php
index 110f08301..e04c46626 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -154,6 +154,21 @@ class User_group extends Memcached_DataObject
return $members;
}
+ function getMemberCount()
+ {
+ // XXX: WORM cache this
+
+ $members = $this->getMembers();
+ $member_count = 0;
+
+ /** $member->count() doesn't work. */
+ while ($members->fetch()) {
+ $member_count++;
+ }
+
+ return $member_count;
+ }
+
function getAdmins($offset=0, $limit=null)
{
$qry =