New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable12] Use PNG icons for emails and ios client #176

Merged
merged 1 commit into from Jul 7, 2017
Jump to file or symbol
Failed to load files and symbols.
+18 −0
Diff settings

Always

Just for now

Use PNG icons for emails and ios client

Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information...
nickvergessen committed Jun 20, 2017
commit 7f0f3aea7286dc5456eb10d8e75c0d44ed52edbb
View
@@ -29,6 +29,7 @@
use OCA\Activity\GroupHelper;
use OCA\Activity\UserSettings;
use OCA\Activity\ViewInfoCache;
use OCP\Activity\IManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
@@ -67,6 +68,9 @@ class APIv2 extends OCSController {
protected $loadPreviews;
/** @var IManager */
protected $activityManager;
/** @var Data */
protected $data;
@@ -99,6 +103,7 @@ class APIv2 extends OCSController {
*
* @param string $appName
* @param IRequest $request
* @param IManager $activityManager
* @param Data $data
* @param GroupHelper $helper
* @param UserSettings $settings
@@ -111,6 +116,7 @@ class APIv2 extends OCSController {
*/
public function __construct($appName,
IRequest $request,
IManager $activityManager,
Data $data,
GroupHelper $helper,
UserSettings $settings,
@@ -121,6 +127,7 @@ public function __construct($appName,
View $view,
ViewInfoCache $infoCache) {
parent::__construct($appName, $request);
$this->activityManager = $activityManager;
$this->data = $data;
$this->helper = $helper;
$this->settings = $settings;
@@ -220,6 +227,7 @@ protected function get($filter, $since, $limit, $previews, $filterObjectType, $f
return new DataResponse(null, Http::STATUS_FORBIDDEN);
}
$this->activityManager->setRequirePNG($this->request->isUserAgent([IRequest::USER_AGENT_CLIENT_IOS]));
try {
$response = $this->data->get(
$this->helper,
@@ -241,6 +249,7 @@ protected function get($filter, $since, $limit, $previews, $filterObjectType, $f
// No activity settings enabled
return new DataResponse(null, Http::STATUS_NO_CONTENT);
}
$this->activityManager->setRequirePNG(false);
$headers = $this->generateHeaders($response['headers'], $response['has_more'], $response['data']);
if (empty($response['data']) || $this->request->getHeader('If-None-Match') === $headers['ETag']) {
View
@@ -161,6 +161,7 @@ public function sendEmails($limit, $sendTime, $forceSending = false, $restrictEm
$defaultTimeZone = date_default_timezone_get();
$deleteItemsForUsers = [];
$this->activityManager->setRequirePNG(true);
foreach ($affectedUsers as $user) {
if (empty($userEmails[$user])) {
// The user did not setup an email address
@@ -181,6 +182,7 @@ public function sendEmails($limit, $sendTime, $forceSending = false, $restrictEm
// continue;
}
}
$this->activityManager->setRequirePNG(false);
// Delete all entries we dealt with
$this->deleteSentItems($deleteItemsForUsers, $sendTime);
@@ -25,6 +25,7 @@
use OCA\Activity\Controller\APIv2;
use OCA\Activity\Exception\InvalidFilterException;
use OCA\Activity\Tests\TestCase;
use OCP\Activity\IManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IUser;
@@ -51,6 +52,9 @@ class APIv2Test extends TestCase {
/** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */
protected $request;
/** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
protected $activityManager;
/** @var \OCA\Activity\Data|\PHPUnit_Framework_MockObject_MockObject */
protected $data;
@@ -90,6 +94,7 @@ class APIv2Test extends TestCase {
protected function setUp() {
parent::setUp();
$this->activityManager = $this->createMock(IManager::class);
$this->data = $this->createMock(Data::class);
$this->helper = $this->createMock(GroupHelper::class);
$this->userSettings = $this->createMock(UserSettings::class);
@@ -118,6 +123,7 @@ protected function getController(array $methods = []) {
return new APIv2(
'activity',
$this->request,
$this->activityManager,
$this->data,
$this->helper,
$this->userSettings,
@@ -133,6 +139,7 @@ protected function getController(array $methods = []) {
->setConstructorArgs([
'activity',
$this->request,
$this->activityManager,
$this->data,
$this->helper,
$this->userSettings,
ProTip! Use n and p to navigate between commits in a pull request.