remove unused profile code from salmonaction
This commit is contained in:
parent
727773cdfa
commit
09e2d181be
@ -161,77 +161,6 @@ class SalmonAction extends Action
|
||||
return Ostatus_profile::ensureActorProfile($this->act);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fixme merge into Ostatus_profile::ensureActorProfile and friends
|
||||
*/
|
||||
function createProfile()
|
||||
{
|
||||
$actor = $this->act->actor;
|
||||
|
||||
$profile = new Profile();
|
||||
|
||||
$profile->nickname = $this->nicknameFromURI($actor->id);
|
||||
|
||||
if (empty($profile->nickname)) {
|
||||
$profile->nickname = common_nicknamize($actor->title);
|
||||
}
|
||||
|
||||
$profile->fullname = $actor->title;
|
||||
$profile->bio = $actor->summary; // XXX: is that right?
|
||||
$profile->profileurl = $actor->link; // XXX: is that right?
|
||||
$profile->created = common_sql_now();
|
||||
|
||||
$id = $profile->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($profile, 'INSERT', __FILE__);
|
||||
throw new Exception("Couldn't save new profile for $actor->id\n");
|
||||
}
|
||||
|
||||
// XXX: add avatars
|
||||
|
||||
$op = new Ostatus_profile();
|
||||
|
||||
$op->profile_id = $id;
|
||||
$op->homeuri = $actor->id;
|
||||
$op->created = $profile->created;
|
||||
|
||||
// XXX: determine feed URI from source or Webfinger or whatever
|
||||
|
||||
$id = $op->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($op, 'INSERT', __FILE__);
|
||||
throw new Exception("Couldn't save new ostatus profile for $actor->id\n");
|
||||
}
|
||||
|
||||
return $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @fixme should be merged into Ostatus_profile
|
||||
*/
|
||||
function nicknameFromURI($uri)
|
||||
{
|
||||
preg_match('/(\w+):/', $uri, $matches);
|
||||
|
||||
$protocol = $matches[1];
|
||||
|
||||
switch ($protocol) {
|
||||
case 'acct':
|
||||
case 'mailto':
|
||||
if (preg_match("/^$protocol:(.*)?@.*\$/", $uri, $matches)) {
|
||||
return common_canonical_nickname($matches[1]);
|
||||
}
|
||||
return null;
|
||||
case 'http':
|
||||
return common_url_to_nickname($uri);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function saveNotice()
|
||||
{
|
||||
$oprofile = $this->ensureProfile();
|
||||
|
Loading…
Reference in New Issue
Block a user