summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/Notice.php8
-rw-r--r--lib/activity.php12
-rw-r--r--lib/atomnoticefeed.php16
-rw-r--r--lib/atomusernoticefeed.php11
-rw-r--r--plugins/OStatus/actions/ostatussub.php2
-rw-r--r--plugins/OStatus/theme/base/css/ostatus.css3
-rw-r--r--tests/UserFeedParseTest.php131
-rw-r--r--theme/base/images/icons/README4
-rw-r--r--theme/base/images/icons/icons-01.gifbin3792 -> 4080 bytes
-rw-r--r--theme/default/css/display.css16
-rw-r--r--theme/identica/css/display.css16
11 files changed, 207 insertions, 12 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 97cb3b8fb..4c7e6ab4b 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1106,7 +1106,7 @@ class Notice extends Memcached_DataObject
return $groups;
}
- function asAtomEntry($namespace=false, $source=false)
+ function asAtomEntry($namespace=false, $source=false, $author=true)
{
$profile = $this->getProfile();
@@ -1151,8 +1151,10 @@ class Notice extends Memcached_DataObject
$xs->element('title', null, $this->content);
- $xs->raw($profile->asAtomAuthor());
- $xs->raw($profile->asActivityActor());
+ if ($author) {
+ $xs->raw($profile->asAtomAuthor());
+ $xs->raw($profile->asActivityActor());
+ }
$xs->element('link', array('rel' => 'alternate',
'type' => 'text/html',
diff --git a/lib/activity.php b/lib/activity.php
index ce14fa254..e1bce6f19 100644
--- a/lib/activity.php
+++ b/lib/activity.php
@@ -1060,6 +1060,18 @@ class Activity
}
$this->entry = $entry;
+
+ // @fixme Don't send in a DOMDocument
+ if ($feed instanceof DOMDocument) {
+ common_log(
+ LOG_WARNING,
+ 'Activity::__construct() - '
+ . 'DOMDocument passed in for feed by mistake. '
+ . "Expecting a 'feed' DOMElement."
+ );
+ $feed = $feed->getElementsByTagName('feed')->item(0);
+ }
+
$this->feed = $feed;
$pubEl = $this->_child($entry, self::PUBLISHED, self::ATOM);
diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php
index 3c3556cb9..e4df731fe 100644
--- a/lib/atomnoticefeed.php
+++ b/lib/atomnoticefeed.php
@@ -107,9 +107,19 @@ class AtomNoticeFeed extends Atom10Feed
*/
function addEntryFromNotice($notice)
{
- $this->addEntryRaw($notice->asAtomEntry());
- }
+ $source = $this->showSource();
+ $author = $this->showAuthor();
-}
+ $this->addEntryRaw($notice->asAtomEntry(false, $source, $author));
+ }
+ function showSource()
+ {
+ return true;
+ }
+ function showAuthor()
+ {
+ return true;
+ }
+}
diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php
index 55cebef6d..428cc2de2 100644
--- a/lib/atomusernoticefeed.php
+++ b/lib/atomusernoticefeed.php
@@ -61,6 +61,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
if (!empty($user)) {
$profile = $user->getProfile();
$this->addAuthor($profile->nickname, $user->uri);
+ $this->setActivitySubject($profile->asActivityNoun('subject'));
}
$title = sprintf(_("%s timeline"), $user->nickname);
@@ -105,4 +106,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
{
return $this->user;
}
+
+ function showSource()
+ {
+ return false;
+ }
+
+ function showAuthor()
+ {
+ return false;
+ }
}
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index bee48a8ae..65dee2392 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -398,7 +398,7 @@ class OStatusSubAction extends Action
function title()
{
// TRANS: Page title for OStatus remote subscription form
- return _m('Authorize subscription');
+ return _m('Confirm');
}
/**
diff --git a/plugins/OStatus/theme/base/css/ostatus.css b/plugins/OStatus/theme/base/css/ostatus.css
index ac668623d..f7d9853cf 100644
--- a/plugins/OStatus/theme/base/css/ostatus.css
+++ b/plugins/OStatus/theme/base/css/ostatus.css
@@ -52,7 +52,8 @@ margin-bottom:0;
width:405px;
}
-.aside #entity_subscriptions .more {
+.aside #entity_subscriptions .more,
+.aside #entity_groups .more {
float:left;
}
diff --git a/tests/UserFeedParseTest.php b/tests/UserFeedParseTest.php
new file mode 100644
index 000000000..b3f9a6417
--- /dev/null
+++ b/tests/UserFeedParseTest.php
@@ -0,0 +1,131 @@
+<?php
+
+if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
+ print "This script must be run from the command line\n";
+ exit();
+}
+
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('STATUSNET', true);
+
+require_once INSTALLDIR . '/lib/common.php';
+
+class UserFeedParseTests extends PHPUnit_Framework_TestCase
+{
+ public function testFeed1()
+ {
+ global $_testfeed1;
+ $dom = DOMDocument::loadXML($_testfeed1);
+ $this->assertFalse(empty($dom));
+
+ $entries = $dom->getElementsByTagName('entry');
+
+ $entry1 = $entries->item(0);
+ $this->assertFalse(empty($entry1));
+
+ $feedEl = $dom->getElementsByTagName('feed')->item(0);
+ $this->assertFalse(empty($feedEl));
+
+ // Test actor (from activity:subject)
+
+ $act1 = new Activity($entry1, $feedEl);
+ $this->assertFalse(empty($act1));
+ $this->assertFalse(empty($act1->actor));
+ $this->assertEquals($act1->actor->type, ActivityObject::PERSON);
+ $this->assertEquals($act1->actor->title, 'Zach Copley');
+ $this->assertEquals($act1->actor->id, 'http://localhost/statusnet/user/1');
+ $this->assertEquals($act1->actor->link, 'http://localhost/statusnet/zach');
+
+ $avatars = $act1->actor->avatarLinks;
+
+ $this->assertEquals(
+ $avatars[0]->url,
+ 'http://localhost/statusnet/theme/default/default-avatar-profile.png'
+ );
+
+ $this->assertEquals(
+ $avatars[1]->url,
+ 'http://localhost/statusnet/theme/default/default-avatar-stream.png'
+ );
+
+ $this->assertEquals(
+ $avatars[2]->url,
+ 'http://localhost/statusnet/theme/default/default-avatar-mini.png'
+ );
+
+ $this->assertEquals($act1->actor->displayName, 'Zach Copley');
+
+ $poco = $act1->actor->poco;
+ $this->assertEquals($poco->preferredUsername, 'zach');
+ $this->assertEquals($poco->address->formatted, 'El Cerrito, CA');
+ $this->assertEquals($poco->urls[0]->type, 'homepage');
+ $this->assertEquals($poco->urls[0]->value, 'http://zach.copley.name');
+ $this->assertEquals($poco->urls[0]->primary, 'true');
+ $this->assertEquals($poco->note, 'Zach Hack Attack');
+
+ // test the post
+
+ //var_export($act1);
+ $this->assertEquals($act1->object->type, 'http://activitystrea.ms/schema/1.0/note');
+ $this->assertEquals($act1->object->title, 'And now for something completely insane...');
+
+ $this->assertEquals($act1->object->content, 'And now for something completely insane...');
+ $this->assertEquals($act1->object->id, 'http://localhost/statusnet/notice/3');
+
+ }
+
+}
+
+$_testfeed1 = <<<TESTFEED1
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0">
+ <id>http://localhost/statusnet/api/statuses/user_timeline/1.atom</id>
+ <title>zach timeline</title>
+ <subtitle>Updates from zach on Zach Dev!</subtitle>
+ <logo>http://localhost/statusnet/theme/default/default-avatar-profile.png</logo>
+ <updated>2010-03-04T01:41:14+00:00</updated>
+<author>
+ <name>zach</name>
+ <uri>http://localhost/statusnet/user/1</uri>
+
+</author>
+ <link href="http://localhost/statusnet/zach" rel="alternate" type="text/html"/>
+ <link href="http://localhost/statusnet/main/sup#1" rel="http://api.friendfeed.com/2008/03#sup" type="application/json"/>
+ <link href="http://localhost/statusnet/main/push/hub" rel="hub"/>
+ <link href="http://localhost/statusnet/main/salmon/user/1" rel="http://salmon-protocol.org/ns/salmon-replies"/>
+ <link href="http://localhost/statusnet/main/salmon/user/1" rel="http://salmon-protocol.org/ns/salmon-mention"/>
+ <link href="http://localhost/statusnet/api/statuses/user_timeline/1.atom" rel="self" type="application/atom+xml"/>
+<activity:subject>
+ <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
+ <id>http://localhost/statusnet/user/1</id>
+ <title>Zach Copley</title>
+ <link rel="alternate" type="text/html" href="http://localhost/statusnet/zach"/>
+ <link rel="avatar" type="image/png" media:width="96" media:height="96" href="http://localhost/statusnet/theme/default/default-avatar-profile.png"/>
+ <link rel="avatar" type="image/png" media:width="48" media:height="48" href="http://localhost/statusnet/theme/default/default-avatar-stream.png"/>
+ <link rel="avatar" type="image/png" media:width="24" media:height="24" href="http://localhost/statusnet/theme/default/default-avatar-mini.png"/>
+
+<poco:preferredUsername>zach</poco:preferredUsername>
+<poco:displayName>Zach Copley</poco:displayName>
+<poco:note>Zach Hack Attack</poco:note>
+<poco:address>
+ <poco:formatted>El Cerrito, CA</poco:formatted>
+</poco:address>
+<poco:urls>
+ <poco:type>homepage</poco:type>
+ <poco:value>http://zach.copley.name</poco:value>
+ <poco:primary>true</poco:primary>
+
+</poco:urls>
+</activity:subject>
+<entry>
+ <title>And now for something completely insane...</title>
+ <link rel="alternate" type="text/html" href="http://localhost/statusnet/notice/3"/>
+ <id>http://localhost/statusnet/notice/3</id>
+ <published>2010-03-04T01:41:07+00:00</published>
+ <updated>2010-03-04T01:41:07+00:00</updated>
+ <link rel="ostatus:conversation" href="http://localhost/statusnet/conversation/3"/>
+ <content type="html">And now for something completely insane...</content>
+</entry>
+
+</feed>
+TESTFEED1;
diff --git a/theme/base/images/icons/README b/theme/base/images/icons/README
index 2e1782602..f701959ca 100644
--- a/theme/base/images/icons/README
+++ b/theme/base/images/icons/README
@@ -46,6 +46,10 @@
White underscore with green background
White C with green background
White magic wand with green background
+ Green badge with white background
+ Green sandbox with white background
+ Green speech bubble broken with white background
+ Green person with tie with white background
*/
Created by various authors
diff --git a/theme/base/images/icons/icons-01.gif b/theme/base/images/icons/icons-01.gif
index 210c44511..bf0f1230e 100644
--- a/theme/base/images/icons/icons-01.gif
+++ b/theme/base/images/icons/icons-01.gif
Binary files differ
diff --git a/theme/default/css/display.css b/theme/default/css/display.css
index 8ca267c33..be341813a 100644
--- a/theme/default/css/display.css
+++ b/theme/default/css/display.css
@@ -358,15 +358,27 @@ background-position: 5px -1445px;
.entity_delete input.submit {
background-position: 5px -1511px;
}
+.entity_sandbox .form_user_unsandbox input.submit {
+background-position: 5px -2568px;
+}
+.entity_silence .form_user_unsilence input.submit {
+background-position: 5px -2633px;
+}
.entity_role p {
background-position: 5px -2436px;
}
-.entity_role_administrator input.submit {
+.entity_role_administrator .form_user_grantrole input.submit {
background-position: 5px -983px;
}
-.entity_role_moderator input.submit {
+.entity_role_moderator .form_user_grantrole input.submit {
background-position: 5px -1313px;
}
+.entity_role_administrator .form_user_revokerole input.submit {
+background-position: 5px -2699px;
+}
+.entity_role_moderator .form_user_revokerole input.submit {
+background-position: 5px -2501px;
+}
.form_reset_key input.submit {
background-position: 5px -1973px;
}
diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css
index bc27cfb4d..db85408eb 100644
--- a/theme/identica/css/display.css
+++ b/theme/identica/css/display.css
@@ -358,15 +358,27 @@ background-position: 5px -1445px;
.entity_delete input.submit {
background-position: 5px -1511px;
}
+.entity_sandbox .form_user_unsandbox input.submit {
+background-position: 5px -2568px;
+}
+.entity_silence .form_user_unsilence input.submit {
+background-position: 5px -2633px;
+}
.entity_role p {
background-position: 5px -2436px;
}
-.entity_role_administrator input.submit {
+.entity_role_administrator .form_user_grantrole input.submit {
background-position: 5px -983px;
}
-.entity_role_moderator input.submit {
+.entity_role_moderator .form_user_grantrole input.submit {
background-position: 5px -1313px;
}
+.entity_role_administrator .form_user_revokerole input.submit {
+background-position: 5px -2699px;
+}
+.entity_role_moderator .form_user_revokerole input.submit {
+background-position: 5px -2501px;
+}
.form_reset_key input.submit {
background-position: 5px -1973px;
}