-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enh #6950: Ability to reset some notification settings to all users w… (
#6964) * Enh #6950: Ability to reset some notification settings to all users without resetting "Like" notifications by email * #6964 (comment) --------- Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
- Loading branch information
1 parent
100b0e1
commit 2738f80
Showing
5 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ected/humhub/modules/notification/migrations/m240422_162959_new_is_untouched_settings.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
use humhub\modules\content\models\ContentContainerSetting; | ||
use yii\db\Expression; | ||
use yii\db\Migration; | ||
use yii\db\Query; | ||
|
||
/** | ||
* Class m240422_162959_new_is_untouched_settings | ||
*/ | ||
class m240422_162959_new_is_untouched_settings extends Migration | ||
{ | ||
/** | ||
* Inserts new rows into the `content_container_setting` table to add the "is_touched_settings" | ||
* setting for the "notification" module where the "name" is "notification.like_email" which was | ||
* previously used to know if the setting was modified by the user or not | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function safeUp() | ||
{ | ||
$rows = (new Query()) | ||
->select([ | ||
"module_id", | ||
"contentcontainer_id", | ||
new Expression("'is_touched_settings' as name"), | ||
new Expression("'1' as value"), | ||
]) | ||
->from(ContentContainerSetting::tableName()) | ||
->where([ | ||
'name' => 'notification.like_email', | ||
'module_id' => 'notification', | ||
]) | ||
->all(); | ||
|
||
$query = Yii::$app->db->createCommand() | ||
->batchInsert( | ||
ContentContainerSetting::tableName(), | ||
['module_id', 'contentcontainer_id', 'name', 'value'], | ||
$rows, | ||
); | ||
|
||
$query->execute(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function safeDown() | ||
{ | ||
echo "m240422_162959_new_is_untouched_settings cannot be reverted.\n"; | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters