Commit fc8af05a by Maiyannah Bishop

Merge branch 'nightly' of git@git.gnu.io:gnu/gnu-social.git into nightly

# By Mikael Nordfeldth (28) and others
# Via Mikael Nordfeldth (9) and mmn (8)
* 'nightly' of git@git.gnu.io:gnu/gnu-social.git: (36 commits)
  Try https first on URL mention lookup
  Somewhat simpler regex. Thanks acct:takeshitakenji@gs.kawa-kun.com
  Fix URL mention regular expression FOR REALZ
  Fix URL mention regular expression FOR REALZ
  Fix URL mention regular expression in OStatusPlugin
  Domain name regular expression into lib/framework.php
  Split up OStatusPlugin preg functions so they can be reused
  A bit more instructive debugging
  New domain regexp for WebFinger matching.
  Fix URL mention regular expression in OStatusPlugin
  Domain name regular expression into lib/framework.php
  Split up OStatusPlugin preg functions so they can be reused
  A bit more instructive debugging
  New domain regexp for WebFinger matching.
  Import backlog on new subscription.
  Split OStatusPlugin FeedSub receive into two parts
  Less frightening interface on remote subscription
  Empty resource would throw exception
  Less frightening interface on remote subscription
  Empty resource would throw exception
  ...

# Conflicts:
#	actions/apistatusesupdate.php
#	plugins/ConversationTree/lib/conversationtree.php
#	plugins/Favorite/actions/showfavorites.php
#	plugins/LRDD/lib/discovery.php
#	plugins/OStatus/OStatusPlugin.php
#	plugins/OStatus/actions/ostatussub.php
#	plugins/OStatus/actions/pushcallback.php
#	plugins/OStatus/classes/FeedSub.php
#	plugins/OStatus/classes/Ostatus_profile.php
#	plugins/OStatus/scripts/testfeed.php
#	plugins/OpenID/actions/openidsettings.php
#	plugins/OpenID/openid.php
#	plugins/SearchSub/actions/searchsubs.php
#	plugins/TagSub/actions/tagsubs.php
#	plugins/TwitterBridge/TwitterBridgePlugin.php
#	plugins/TwitterBridge/lib/twitterimport.php
#	plugins/TwitterBridge/twitter.php
#	plugins/UserFlag/actions/adminprofileflag.php
#	tests/ActivityGenerationTests.php
#	tests/CommandInterperterTest.php
#	tests/LocationTest.php
#	tests/MediaFileTest.php
#	tests/URLDetectionTest.php
#	tests/UserFeedParseTest.php
#	tests/XmppValidateTest.php
#	theme/neo-quitter/css/display.css
2 parents 3926b3b7 956cfaf8
......@@ -169,7 +169,7 @@ class GroupBlockList extends ProfileList
$this->group = $group;
}
function newListItem($profile)
function newListItem(Profile $profile)
{
return new GroupBlockListItem($profile, $this->group, $this->action);
}
......
......@@ -172,7 +172,7 @@ class GroupqueueAction extends GroupAction
// @todo FIXME: documentation missing.
class GroupQueueList extends GroupMemberList
{
function newListItem($profile)
function newListItem(Profile $profile)
{
return new GroupQueueListItem($profile, $this->group, $this->action);
}
......
......@@ -207,7 +207,7 @@ class SearchNoticeList extends NoticeList {
$this->terms = $terms;
}
function newListItem($notice)
function newListItem(Notice $notice)
{
return new SearchNoticeListItem($notice, $this->out, $this->terms);
}
......
......@@ -184,7 +184,7 @@ class PeopletagMemberList extends ProfileList
$this->peopletag = $peopletag;
}
function newListItem($profile)
function newListItem(Profile $profile)
{
return new PeopletagMemberListItem($profile, $this->peopletag, $this->action);
}
......
......@@ -184,7 +184,7 @@ class PeopletagSubscriberList extends ProfileList
$this->peopletag = $peopletag;
}
function newListItem($profile)
function newListItem(Profile $profile)
{
return new PeopletagSubscriberListItem($profile, $this->peopletag, $this->action);
}
......
......@@ -144,6 +144,18 @@ class ShowstreamAction extends NoticestreamAction
$this->target->getNickname(), $this->tag)));
}
if (!$this->target->isLocal()) {
// remote profiles at least have Atom, but we can't guarantee anything else
return array(
new Feed(Feed::ATOM,
$this->target->getAtomFeed(),
// TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname.
sprintf(_('Notice feed for %s (Atom)'),
$this->target->getNickname()))
);
}
return array(new Feed(Feed::JSON,
common_local_url('ApiTimelineUser',
array(
......@@ -170,10 +182,7 @@ class ShowstreamAction extends NoticestreamAction
sprintf(_('Notice feed for %s (RSS 2.0)'),
$this->target->getNickname())),
new Feed(Feed::ATOM,
common_local_url('ApiTimelineUser',
array(
'id' => $this->target->getID(),
'format' => 'atom')),
$this->target->getAtomFeed(),
// TRANS: Title for link to notice feed.
// TRANS: %s is a user nickname.
sprintf(_('Notice feed for %s (Atom)'),
......
......@@ -987,11 +987,6 @@ class Profile extends Managed_DataObject
function delete($useWhere=false)
{
// just in case it hadn't been done before... (usually set before adding deluser to queue handling!)
if (!$this->hasRole(Profile_role::DELETED)) {
$this->grantRole(Profile_role::DELETED);
}
$this->_deleteNotices();
$this->_deleteSubscriptions();
$this->_deleteTags();
......@@ -1003,6 +998,7 @@ class Profile extends Managed_DataObject
// not on individual objects.
$related = array('Reply',
'Group_member',
'Profile_role'
);
Event::handle('ProfileDeleteRelated', array($this, &$related));
......@@ -1011,6 +1007,8 @@ class Profile extends Managed_DataObject
$inst->profile_id = $this->id;
$inst->delete();
}
$this->grantRole(Profile_role::DELETED);
$localuser = User::getKV('id', $this->id);
if ($localuser instanceof User) {
......@@ -1578,6 +1576,14 @@ class Profile extends Managed_DataObject
}
return $url;
}
public function getHtmlTitle()
{
try {
return $this->getAcctUri(false);
} catch (ProfileNoAcctUriException $e) {
return $this->getNickname();
}
}
public function getNickname()
{
......@@ -1658,14 +1664,13 @@ class Profile extends Managed_DataObject
return !empty($block);
}
function getAtomFeed()
public function getAtomFeed()
{
$feed = null;
if (Event::handle('StartProfileGetAtomFeed', array($this, &$feed))) {
$user = User::getKV('id', $this->id);
if (!empty($user)) {
$feed = common_local_url('ApiTimelineUser', array('id' => $user->id,
if ($this->isLocal()) {
$feed = common_local_url('ApiTimelineUser', array('id' => $this->getID(),
'format' => 'atom'));
}
Event::handle('EndProfileGetAtomFeed', array($this, $feed));
......
......@@ -338,6 +338,11 @@ class User extends Managed_DataObject
// TRANS: Profile data could not be inserted for some reason.
throw new ServerException(_m('Could not insert profile data for new user.'));
}
// Necessary because id has been known to be reissued.
if ($profile->hasRole(Profile_role::DELETED)) {
$profile->revokeRole(Profile_role::DELETED);
}
$user->id = $id;
......
......@@ -35,7 +35,7 @@ class Command
function __construct($user=null)
{
$this->scoped = $user->getProfile();
$this->scoped = empty($user)?null:$user->getProfile();
$this->user = $user;
}
......
......@@ -42,6 +42,7 @@ $default =
'theme' => 'neo-gnu',
'path' => $_path,
'logfile' => null,
'logdebug' => false,
'logo' => null,
'ssllogo' => null,
'logperf' => false, // Enable to dump performance counters to syslog
......@@ -262,6 +263,7 @@ $default =
'application/vnd.oasis.opendocument.text-web' => 'oth',
'application/pdf' => 'pdf',
'application/zip' => 'zip',
'application/x-bzip2' => 'bz2',
'application/x-go-sgf' => 'sgf',
'application/xml' => 'xml',
'application/gpx+xml' => 'gpx',
......
......@@ -104,6 +104,7 @@ define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\.\:\-\_\+\/\=\:\;\%\~\*\
define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS . '\&');
define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_QSTRING_CHARS . '\?\#');
define('URL_REGEX_EXCLUDED_END_CHARS', '\?\.\,\!\#\:\''); // don't include these if they are directly after a URL
define('URL_REGEX_DOMAIN_NAME', '(?:(?!-)[A-Za-z0-9\-]{1,63}(?<!-)\.)+[A-Za-z]{2,10}');
// append our extlib dir as the last-resort place to find libs
......
......@@ -26,7 +26,7 @@ class GroupMemberList extends ProfileList
$this->group = $group;
}
function newListItem($profile)
function newListItem(Profile $profile)
{
return new GroupMemberListItem($profile, $this->group, $this->action);
}
......
......@@ -203,8 +203,7 @@ function mail_subscribe_notify_profile($listenee, $other)
$name = $profile->getBestName();
$long_name = ($other->fullname) ?
($other->fullname . ' (' . $other->nickname . ')') : $other->nickname;
$long_name = $other->getFancyName();
$recipients = $listenee->email;
......
......@@ -135,15 +135,17 @@ class Nickname
*/
public static function normalize($str, $checkuse=false)
{
if (mb_strlen($str) > self::MAX_LEN) {
// Display forms must also fit!
throw new NicknameTooLongException();
}
// We should also have UTF-8 normalization (å to a etc.)
$str = trim($str);
$str = str_replace('_', '', $str);
$str = mb_strtolower($str);
if (mb_strlen($str) > self::MAX_LEN) {
// Display forms must also fit!
throw new NicknameTooLongException();
} elseif (mb_strlen($str) < 1) {
if (mb_strlen($str) < 1) {
throw new NicknameEmptyException();
} elseif (!self::isCanonical($str)) {
throw new NicknameInvalidException();
......@@ -181,6 +183,8 @@ class Nickname
public static function isBlacklisted($str)
{
$blacklist = common_config('nickname', 'blacklist');
if(!$blacklist)
return false;
return in_array($str, $blacklist);
}
......
......@@ -254,9 +254,9 @@ class NoticeListItem extends Widget
function showAuthor()
{
$attrs = array('href' => $this->profile->profileurl,
$attrs = array('href' => $this->profile->getUrl(),
'class' => 'h-card',
'title' => $this->profile->getNickname());
'title' => $this->profile->getHtmlTitle());
if(empty($this->repeat)) { $attrs['class'] .= ' p-author'; }
if (Event::handle('StartShowNoticeItemAuthor', array($this->profile, $this->out, &$attrs))) {
......@@ -315,7 +315,7 @@ class NoticeListItem extends Widget
$profileurl = common_local_url('userbyid', array('id' => $attn->getID()));
}
$this->pa[] = array('href' => $profileurl,
'title' => $attn->getNickname(),
'title' => $attn->getHtmlTitle(),
'class' => "addressee {$class} p-name u-url",
'text' => $attn->getStreamName());
}
......
......@@ -424,7 +424,7 @@ class Router
$m->connect('api/statuses/update.:format',
array('action' => 'ApiStatusesUpdate',
'format' => '(xml|json)'));
'format' => '(xml|json|atom)'));
$m->connect('api/statuses/destroy/:id.:format',
array('action' => 'ApiStatusesDestroy',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!