Merge pull request #276 from owncloud/fix-compilation

Fix compilation
This commit is contained in:
Joas Schilling 2015-03-30 17:22:49 +02:00
Родитель 2b53d9ab60 1633690f2b
Коммит 0e28b9e0f1
9 изменённых файлов: 52 добавлений и 25 удалений

Просмотреть файл

@ -132,7 +132,9 @@ class Application extends App {
return new Navigation(
$c->query('ActivityL10N'),
$server->getActivityManager(),
$c->query('URLGenerator'),
$server->getURLGenerator(),
$c->query('UserSettings'),
$c->query('CurrentUID'),
$rssToken
);
});

Просмотреть файл

@ -19,3 +19,10 @@ if (version_compare($installedVersion, '1.2.2', '<')) {
\OC::$server->getLogger()->debug('Deleting ' . $numEntries . ' activities with a broken ' . $column . ' value.', ['app' => 'acitivity']);
}
}
if (version_compare($installedVersion, '1.2.2', '<')) {
$update = \OCP\DB::prepare('UPDATE `*PREFIX*activity` SET `app` = ? WHERE `type` = ?');
$update->execute(array('files_sharing', 'shared'));
$update = \OCP\DB::prepare('UPDATE `*PREFIX*activity_mq` SET `amq_appid` = ? WHERE `amq_type` = ?');
$update->execute(array('files_sharing', 'shared'));
}

Просмотреть файл

@ -1 +1 @@
1.2.2
1.2.3

Просмотреть файл

@ -100,7 +100,7 @@ class Feed extends Controller {
$this->helper->setL10n($l);
$this->helper->setUser($user);
$description = $l->t('Personal activity feed for %s', $user);
$description = (string) $l->t('Personal activity feed for %s', $user);
$activities = $this->data->read($this->helper, $this->settings, 0, self::DEFAULT_PAGE_SIZE, 'all', $user);
} catch (\UnexpectedValueException $e) {
$l = Util::getL10N('activity');

Просмотреть файл

@ -169,18 +169,17 @@ class Data {
$limitActivities .= ' AND `user` = ?';
$parameters[] = $user;
}
else if ($filter === 'by') {
else if ($filter === 'by' || $filter === 'all' && !$userSettings->getUserSetting($user, 'setting', 'self')) {
$limitActivities .= ' AND `user` <> ?';
$parameters[] = $user;
}
else if ($filter !== 'all') {
list($condition, $params) = $this->activityManager->getQueryForFilter($filter);
if (!is_null($condition)) {
$limitActivities .= ' ';
$limitActivities .= $condition;
if (is_array($params)) {
$parameters = array_merge($parameters, $params);
}
list($condition, $params) = $this->activityManager->getQueryForFilter($filter);
if (!is_null($condition)) {
$limitActivities .= ' ';
$limitActivities .= $condition;
if (is_array($params)) {
$parameters = array_merge($parameters, $params);
}
}

Просмотреть файл

@ -77,7 +77,7 @@ class Display {
$tmpl->assign('user', $activity['user']);
$tmpl->assign('displayName', User::getDisplayName($activity['user']));
if ($activity['app'] === 'files') {
if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) {
// We do not link the subject as we create links for the parameters instead
$activity['link'] = '';
}

Просмотреть файл

@ -291,19 +291,20 @@ class FilesHooks {
}
$selfAction = substr($subject, -5) !== '_self';
$app = $type === Files_Sharing::TYPE_SHARED ? 'files_sharing' : 'files';
$link = Util::linkToAbsolute('files', 'index.php', array(
'dir' => ($isFile) ? dirname($path) : $path,
));
// Add activity to stream
if ($streamSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'self'))) {
$this->activityData->send('files', $subject, $subjectParams, '', array(), $path, $link, $user, $type, $priority);
$this->activityData->send($app, $subject, $subjectParams, '', array(), $path, $link, $user, $type, $priority);
}
// Add activity to mail queue
if ($emailSetting && (!$selfAction || $this->userSettings->getUserSetting($this->currentUser, 'setting', 'selfemail'))) {
$latestSend = time() + $emailSetting;
$this->activityData->storeMail('files', $subject, $subjectParams, $user, $type, $latestSend);
$this->activityData->storeMail($app, $subject, $subjectParams, $user, $type, $latestSend);
}
}

Просмотреть файл

@ -46,6 +46,9 @@ class Navigation {
/** @var string */
protected $active;
/** @var string */
protected $user;
/** @var string */
protected $rssLink;
@ -55,13 +58,17 @@ class Navigation {
* @param \OC_L10N $l
* @param \OCP\Activity\IManager $manager
* @param \OCP\IURLGenerator $URLGenerator
* @param UserSettings $userSettings
* @param string $user
* @param string $rssToken
* @param null|string $active Navigation entry that should be marked as active
*/
public function __construct(\OC_L10N $l, IManager $manager, IURLGenerator $URLGenerator, $rssToken, $active = 'all') {
public function __construct(\OC_L10N $l, IManager $manager, IURLGenerator $URLGenerator, UserSettings $userSettings, $user, $rssToken, $active = 'all') {
$this->l = $l;
$this->activityManager = $manager;
$this->URLGenerator = $URLGenerator;
$this->userSettings = $userSettings;
$this->user = $user;
$this->active = $active;
if ($rssToken) {
@ -104,23 +111,26 @@ class Navigation {
* @return array Notification data (user => array of rows from the table)
*/
public function getLinkList() {
$topEntries = array(
array(
$topEntries = [
[
'id' => 'all',
'name' => (string) $this->l->t('All Activities'),
'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList'),
),
array(
],
];
if ($this->user && $this->userSettings->getUserSetting($this->user, 'setting', 'self')) {
$topEntries[] = [
'id' => 'self',
'name' => (string) $this->l->t('Activities by you'),
'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'self')),
),
array(
];
$topEntries[] = [
'id' => 'by',
'name' => (string) $this->l->t('Activities by others'),
'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', array('filter' => 'by')),
),
);
];
}
$additionalEntries = $this->activityManager->getNavigation();
$topEntries = array_merge($topEntries, $additionalEntries['top']);

Просмотреть файл

@ -44,7 +44,15 @@ class NavigationTest extends TestCase {
$activityManager->registerExtension(function() use ($activityLanguage) {
return new Extension($activityLanguage, $this->getMock('\OCP\IURLGenerator'));
});
$navigation = new Navigation($activityLanguage, $activityManager, \OC::$server->getURLGenerator(), $constructorActive);
$navigation = new Navigation(
$activityLanguage,
$activityManager,
\OC::$server->getURLGenerator(),
$this->getMockBuilder('OCA\Activity\UserSettings')->disableOriginalConstructor()->getMock(),
'test',
'',
$constructorActive
);
$output = $navigation->getTemplate($forceActive)->fetchPage();
// Get only the template part with the navigation links