Skip to content

Commit

Permalink
Merge pull request #655 from nextcloud/bugfix/637/disable-activity-email
Browse files Browse the repository at this point in the history
fix(activity): Add a migration to remove the appconfig and preferences
  • Loading branch information
nickvergessen authored May 16, 2023
2 parents 9b8f59c + d7a6ebd commit 9d53c94
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## 6.6.1 – 2023-05-16
### Fixed
- Activity emails still send although the announcement is emailed
[#576](https://github.com/nextcloud/announcementcenter/pull/576)

## 6.6.0 – 2023-05-12
### Added
- Compatibility with Nextcloud 27
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
⚡ Activities integration
🔔 Notifications integration]]></description>
<version>6.6.0</version>
<version>6.6.1</version>
<licence>agpl</licence>
<author>Joas Schilling</author>
<namespace>AnnouncementCenter</namespace>
Expand Down
59 changes: 59 additions & 0 deletions lib/Migration/Version6006Date20230516000000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2023, Joas Schilling <[email protected]>
*
* @author Joas Schilling <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\AnnouncementCenter\Migration;

use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
* Remove previous default config and user preference of activity setting
* They are no long editable since we have direct emails, but they still send
* otherwise.
*/
class Version6006Date20230516000000 extends SimpleMigrationStep {
protected IDBConnection $connection;

public function __construct(IDBConnection $connection) {
$this->connection = $connection;
}

public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
// Remove former activity default setting
$query = $this->connection->getQueryBuilder();
$query->delete('appconfig')
->where($query->expr()->eq('appid', $query->createNamedParameter('activity')))
->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('notify_email_announcementcenter')));
$query->executeStatement();

// Remove former activity user preference
$query = $this->connection->getQueryBuilder();
$query->delete('preferences')
->where($query->expr()->eq('appid', $query->createNamedParameter('activity')))
->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('notify_email_announcementcenter')));
$query->executeStatement();
}
}

0 comments on commit 9d53c94

Please sign in to comment.