Skip to content
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

Enh: Rename column status to state in User, Space, & Membership #6517

Draft
wants to merge 27 commits into
base: statable
Choose a base branch
from

Conversation

martin-rueegg
Copy link
Contributor

@martin-rueegg martin-rueegg commented Aug 16, 2023

Part of

  1. Enh: Introduce Archiveable, Deletable, Editable, Readable, & Viewable Interfaces #6451
  2. Enh: Introduce FindInstanceInterface - Part 1.a: Creating base classes #6503
  3. Enh: Introduce FindInstanceInterface - Part 2: Implementing throughout the code #6463
  4. Enh Introduce Statable interfaces and implementation #6430
  5. Enh: Rename column status to state in User, Space, & Membership #6517 (this PR)
  6. Some minor changes
  7. Enh: Introduce state and other fields to file table and implement interfaces #6523
  8. Enh: [RFC] [WIP] Make profile image handling generic and re-usable for any content #6408

What kind of change does this PR introduce?

  • Feature
  • Refactor

Does this PR introduce a breaking change?

  • Yes

If yes, please describe the impact and migration path for existing applications:
Module developers who have not used the constants to refer to a status, but rather hard-coded a numeric value, or have used status codes from the reserved range, have to revisit the table of new status codes and update the status values or preferrably use the appropriate constants.

The PR fulfills these requirements

  • It's submitted to the statable branch
  • All tests are passing
  • New/updated tests are included
  • Changelog was modified

Other information:

See #6430 (comment)

yurabakhtin and others added 12 commits August 10, 2023 21:36
* Fix module form "Set as default"

* Display status bar after save module form "Set as default"

---------

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
* Enh humhub#68: Online Indicator Position

* Enh humhub#68: Online Indicator Position

---------

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
…x/humhub into metaworx-enh/allow-event-data-from-config
* Fix humhub#6509: Fix online status position on people page

* Fix humhub#6510: Fix online status position on people page
Normal use will not do anything other than succeed!
```
php $HUMHUB_VENDOR_BIN/codecept run unit LoadDbTest
```

However, if run with the environment variable HUMHUB_DB_INITIALIZE set, then the default fixtures will be loaded and not unloaded after the test.
```
HUMHUB_DB_INITIALIZE= php $HUMHUB_VENDOR_BIN/codecept run unit LoadDbTest
```
@martin-rueegg martin-rueegg force-pushed the enh/1-statable-2 branch 2 times, most recently from 4fbc382 to e4617c8 Compare August 16, 2023 17:40
```
- ReadableContentQueryTest: Global content guest non guest mode  Destroying application
  Starting application
  [ConnectionWatcher] watching new connections
  [Fixtures] Loading fixtures
  [ConnectionWatcher] watching new connections
  [ConnectionWatcher] no longer watching new connections
  [ConnectionWatcher] closing all (0) connections
  [Fixtures] Done
  [yii\web\Session::open] 'Session started'
  [queue] 'Could not execute queued job! Message: Argument 2 passed to Symfony\\Component\\Mime\\Address::__construct() must be of the type string, null given, called in /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php on line 368 Trace:#0 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php(368): Symfony\\Component\\Mime\\Address->__construct()
  humhub#1 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php(51): yii\\symfonymailer\\Message->convertStringsToAddresses()
  humhub#2 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/targets/MailTarget.php(71): yii\\symfonymailer\\Message->setFrom()
  humhub#3 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/targets/BaseTarget.php(161): humhub\\modules\\notification\\targets\\MailTarget->handle()
  humhub#4 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/components/NotificationManager.php(101): humhub\\modules\\notification\\targets\\BaseTarget->send()
  humhub#5 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/jobs/SendBulkNotification.php(38): humhub\\modules\\notification\\components\\NotificationManager->sendBulk()
  humhub#6 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/queue/ActiveJob.php(33): humhub\\modules\\notification\\jobs\\SendBulkNotification->run()
  humhub#7 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-queue/src/Queue.php(246): humhub\\modules\\queue\\ActiveJob->execute()
  humhub#8 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/queue/driver/Instant.php(31): yii\\queue\\Queue->handleMessage()
  humhub#9 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-queue/src/Queue.php(196): humhub\\modules\\queue\\driver\\Instant->pushMessage()
  humhub#10 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/components/BaseNotification.php(210): yii\\queue\\Queue->push()
  humhub#11 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(370): humhub\\modules\\notification\\components\\BaseNotification->sendBulk()
  humhub#12 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(321): humhub\\modules\\content\\models\\Content->notifyContentCreated()
  humhub#13 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(268): humhub\\modules\\content\\models\\Content->processNewContent()
  humhub#14 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(615): humhub\\modules\\content\\models\\Content->afterSave()
  humhub#15 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()
  humhub#16 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(676): yii\\db\\ActiveRecord->insert()
  humhub#17 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/components/ContentActiveRecord.php(476): yii\\db\\BaseActiveRecord->save()
  humhub#18 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/post/models/Post.php(97): humhub\\modules\\content\\components\\ContentActiveRecord->afterSave()
  humhub#19 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(615): humhub\\modules\\post\\models\\Post->afterSave()
  humhub#20 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()
  humhub#21 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(676): yii\\db\\ActiveRecord->insert()
  humhub#22 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/tests/codeception/unit/ReadableContentQueryTest.php(70): yii\\db\\BaseActiveRecord->save()
  humhub#23 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Test/Unit.php(57): tests\\codeception\\unit\\modules\\content\\ReadableContentQueryTest->_before()
  humhub#24 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/phpunit-wrapper/src/TestCase.php(12): Codeception\\Test\\Unit->_setUp()
  humhub#25 /home/mdr/projects/humhub/htdocs/protected/humhub/tests/codeception/_support/HumHubDbTestCase.php(60): Codeception\\PHPUnit\\TestCase->setUp()
  humhub#26 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestCase.php(1207): tests\\codeception\\_support\\HumHubDbTestCase->setUp()
  humhub#27 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestResult.php(728): PHPUnit\\Framework\\TestCase->runBare()
  humhub#28 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestCase.php(964): PHPUnit\\Framework\\TestResult->run()
  humhub#29 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestSuite.php(684): PHPUnit\\Framework\\TestCase->run()
  humhub#30 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/phpunit-wrapper/src/Runner.php(117): PHPUnit\\Framework\\TestSuite->run()
  humhub#31 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/SuiteManager.php(161): Codeception\\PHPUnit\\Runner->doEnhancedRun()
  humhub#32 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(208): Codeception\\SuiteManager->run()
  humhub#33 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(162): Codeception\\Codecept->runSuite()
  humhub#34 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Command/Run.php(401): Codeception\\Codecept->run()
  humhub#35 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Command/Command.php(298): Codeception\\Command\\Run->execute()
  humhub#36 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(1040): Symfony\\Component\\Console\\Command\\Command->run()
  humhub#37 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()
  humhub#38 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
  humhub#39 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Application.php(117): Symfony\\Component\\Console\\Application->run()
  humhub#40 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/app.php(46): Codeception\\Application->run()
  humhub#41 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/app.php(47): {closure}()
  humhub#42 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/codecept(6): require(\'/home/mdr/proje...\')
  humhub#43 /home/mdr/projects/humhub/htdocs/protected/vendor/bin/codecept(112): include(\'/home/mdr/proje...\')
  humhub#44 {main}'
  [queue] 'Could not execute queued job! Message: Argument 2 passed to Symfony\\Component\\Mime\\Address::__construct() must be of the type string, null given, called in /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php on line 368 Trace:#0 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php(368): Symfony\\Component\\Mime\\Address->__construct()
  humhub#1 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-symfonymailer/src/Message.php(51): yii\\symfonymailer\\Message->convertStringsToAddresses()
  humhub#2 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/targets/MailTarget.php(71): yii\\symfonymailer\\Message->setFrom()
  humhub#3 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/targets/BaseTarget.php(161): humhub\\modules\\notification\\targets\\MailTarget->handle()
  humhub#4 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/components/NotificationManager.php(101): humhub\\modules\\notification\\targets\\BaseTarget->send()
  humhub#5 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/jobs/SendBulkNotification.php(38): humhub\\modules\\notification\\components\\NotificationManager->sendBulk()
  humhub#6 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/queue/ActiveJob.php(33): humhub\\modules\\notification\\jobs\\SendBulkNotification->run()
  humhub#7 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-queue/src/Queue.php(246): humhub\\modules\\queue\\ActiveJob->execute()
  humhub#8 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/queue/driver/Instant.php(31): yii\\queue\\Queue->handleMessage()
  humhub#9 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2-queue/src/Queue.php(196): humhub\\modules\\queue\\driver\\Instant->pushMessage()
  humhub#10 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/notification/components/BaseNotification.php(210): yii\\queue\\Queue->push()
  humhub#11 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(370): humhub\\modules\\notification\\components\\BaseNotification->sendBulk()
  humhub#12 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(321): humhub\\modules\\content\\models\\Content->notifyContentCreated()
  humhub#13 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/models/Content.php(268): humhub\\modules\\content\\models\\Content->processNewContent()
  humhub#14 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(615): humhub\\modules\\content\\models\\Content->afterSave()
  humhub#15 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()
  humhub#16 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(676): yii\\db\\ActiveRecord->insert()
  humhub#17 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/components/ContentActiveRecord.php(476): yii\\db\\BaseActiveRecord->save()
  humhub#18 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/post/models/Post.php(97): humhub\\modules\\content\\components\\ContentActiveRecord->afterSave()
  humhub#19 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(615): humhub\\modules\\post\\models\\Post->afterSave()
  humhub#20 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()
  humhub#21 /home/mdr/projects/humhub/htdocs/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(676): yii\\db\\ActiveRecord->insert()
  humhub#22 /home/mdr/projects/humhub/htdocs/protected/humhub/modules/content/tests/codeception/unit/ReadableContentQueryTest.php(76): yii\\db\\BaseActiveRecord->save()
  humhub#23 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Test/Unit.php(57): tests\\codeception\\unit\\modules\\content\\ReadableContentQueryTest->_before()
  humhub#24 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/phpunit-wrapper/src/TestCase.php(12): Codeception\\Test\\Unit->_setUp()
  humhub#25 /home/mdr/projects/humhub/htdocs/protected/humhub/tests/codeception/_support/HumHubDbTestCase.php(60): Codeception\\PHPUnit\\TestCase->setUp()
  humhub#26 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestCase.php(1207): tests\\codeception\\_support\\HumHubDbTestCase->setUp()
  humhub#27 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestResult.php(728): PHPUnit\\Framework\\TestCase->runBare()
  humhub#28 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestCase.php(964): PHPUnit\\Framework\\TestResult->run()
  humhub#29 /home/mdr/projects/humhub/htdocs/protected/vendor/phpunit/phpunit/src/Framework/TestSuite.php(684): PHPUnit\\Framework\\TestCase->run()
  humhub#30 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/phpunit-wrapper/src/Runner.php(117): PHPUnit\\Framework\\TestSuite->run()
  humhub#31 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/SuiteManager.php(161): Codeception\\PHPUnit\\Runner->doEnhancedRun()
  humhub#32 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(208): Codeception\\SuiteManager->run()
  humhub#33 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Codecept.php(162): Codeception\\Codecept->runSuite()
  humhub#34 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Command/Run.php(401): Codeception\\Codecept->run()
  humhub#35 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Command/Command.php(298): Codeception\\Command\\Run->execute()
  humhub#36 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(1040): Symfony\\Component\\Console\\Command\\Command->run()
  humhub#37 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()
  humhub#38 /home/mdr/projects/humhub/htdocs/protected/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
  humhub#39 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/src/Codeception/Application.php(117): Symfony\\Component\\Console\\Application->run()
  humhub#40 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/app.php(46): Codeception\\Application->run()
  humhub#41 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/app.php(47): {closure}()
  humhub#42 /home/mdr/projects/humhub/htdocs/protected/vendor/codeception/codeception/codecept(6): require(\'/home/mdr/proje...\')
  humhub#43 /home/mdr/projects/humhub/htdocs/protected/vendor/bin/codecept(112): include(\'/home/mdr/proje...\')
  humhub#44 {main}'
  [tests\codeception\_support\HumHubDbTestCase::setUp] Initializing Modules
  [tests\codeception\_support\HumHubDbTestCase::setUp] Reloading settings
  [tests\codeception\_support\HumHubDbTestCase::setUp] Flushing cache
  [tests\codeception\_support\HumHubDbTestCase::setUp] Deleting mails
  [yii\mail\BaseMailer::send] 'Sending email "Sara Tester just wrote post "Public Space Public Post" in space Space 3" to "user1@example.com"'
  [yii\mail\BaseMailer::send] 'Sending email "Sara Tester just wrote post "Public Space Private Post" in space Space 3" to "user1@example.com"'
  [yii\web\User::logout] 'User \'2\' logged out from .'
✔ ReadableContentQueryTest: Global content guest non guest mode (3.06s)
^
```

rather than

```
- ReadableContentQueryTest: Global content guest non guest mode  Destroying application
  Starting application
  [ConnectionWatcher] watching new connections
  [Fixtures] Loading fixtures
  [ConnectionWatcher] watching new connections
  [ConnectionWatcher] no longer watching new connections
  [ConnectionWatcher] closing all (0) connections
  [Fixtures] Done
  [tests\codeception\_support\HumHubDbTestCase::setUp] Initializing Modules
  [tests\codeception\_support\HumHubDbTestCase::setUp] Reloading settings
  [tests\codeception\_support\HumHubDbTestCase::setUp] Flushing cache
  [tests\codeception\_support\HumHubDbTestCase::setUp] Deleting mails
  [yii\web\Session::open] 'Session started'
  [yii\mail\BaseMailer::send] 'Sending email "Sara Tester just wrote post "Public Space Public Post" in space Space 3" to "user1@example.com"'
  [yii\mail\BaseMailer::send] 'Sending email "Sara Tester just wrote post "Public Space Private Post" in space Space 3" to "user1@example.com"'
  [yii\web\User::logout] 'User \'2\' logged out from .'
✔ ReadableContentQueryTest: Global content guest non guest mode (1.51s)
  Destroying application
  [ConnectionWatcher] no longer watching new connections
  [ConnectionWatcher] closing all (0) connections
-
```
…dInstance()` call, rather than `$model::FindOne()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants