diff --git a/protected/humhub/docs/CHANGELOG_DEV.md b/protected/humhub/docs/CHANGELOG_DEV.md index 5e000bae21..393e14ff86 100644 --- a/protected/humhub/docs/CHANGELOG_DEV.md +++ b/protected/humhub/docs/CHANGELOG_DEV.md @@ -58,3 +58,5 @@ HumHub Change Log (DEVELOP) - Enh: More generic approach to determine themed view files - Enh: Always use ISO 639-1 alpha-2 (and ISO 3166-2) language codes - Enh: Update Yii version to 2.0.27 +- Enh: Reorganized translation method categories to reduce language files +- Enh: Removed deprecated methods/classes since v1.1 - see migration guide for details diff --git a/protected/humhub/docs/guide/developer/modules-migrate.md b/protected/humhub/docs/guide/developer/modules-migrate.md index 666da7adfd..9bee87d957 100644 --- a/protected/humhub/docs/guide/developer/modules-migrate.md +++ b/protected/humhub/docs/guide/developer/modules-migrate.md @@ -56,7 +56,7 @@ If you're using any custom modules, please change the message directories accord The following deprecated method have been removed. -**Content model** +**Content model -removed methods ** - canWrite() - canRead() @@ -64,7 +64,18 @@ The following deprecated method have been removed. - getSpace() - getUser() +**Removed class** +- humhub\modules\space\modules\manage\widgets\Menu + +**Space class - removed methods** + +- canInvite() +- canShare() + +**Notification class - removed methods** + +- getSpace() Migrate from 1.2 to 1.3 ----------------------- diff --git a/protected/humhub/modules/notification/models/Notification.php b/protected/humhub/modules/notification/models/Notification.php index 910bb5db16..cfbf6296a0 100644 --- a/protected/humhub/modules/notification/models/Notification.php +++ b/protected/humhub/modules/notification/models/Notification.php @@ -160,17 +160,6 @@ class Notification extends \humhub\components\ActiveRecord return $this->hasOne(User::class, ['id' => 'originator_user_id']); } - /** - * Returns space of this notification - * - * @return \yii\db\ActiveQuery - * @deprecated since version 1.1 - */ - public function getSpace() - { - return $this->hasOne(Space::class, ['id' => 'space_id']); - } - /** * Returns polymorphic relation linked with this notification * diff --git a/protected/humhub/modules/space/models/Space.php b/protected/humhub/modules/space/models/Space.php index 857bc333be..f482ea54c5 100644 --- a/protected/humhub/modules/space/models/Space.php +++ b/protected/humhub/modules/space/models/Space.php @@ -354,31 +354,6 @@ class Space extends ContentContainerActiveRecord implements Searchable return false; } - /** - * Checks if given user can invite people to this workspace - * Note: use directly permission instead - * - * @return boolean - * @deprecated since version 1.1 - */ - public function canInvite() - { - return $this->getPermissionManager()->can(new InviteUsers()); - } - - /** - * Checks if given user can share content. - * Shared Content is public and is visible also for non members of the space. - * Note: use directly permission instead - * - * @return boolean - * @deprecated since version 1.1 - */ - public function canShare() - { - return $this->getPermissionManager()->can(new CreatePublicContent()); - } - /** * Returns an array of informations used by search subsystem. * Function is defined in interface ISearchable diff --git a/protected/humhub/modules/space/modules/manage/widgets/Menu.php b/protected/humhub/modules/space/modules/manage/widgets/Menu.php deleted file mode 100644 index 83b7583e33..0000000000 --- a/protected/humhub/modules/space/modules/manage/widgets/Menu.php +++ /dev/null @@ -1,21 +0,0 @@ -space->canInvite()) { + if (!$this->space->getPermissionManager()->can(new InviteUsers())) { return; } - + return $this->render('inviteButton', ['space' => $this->space]); } diff --git a/protected/humhub/modules/user/controllers/InviteController.php b/protected/humhub/modules/user/controllers/InviteController.php index 759f3c6fa5..04caa7324a 100644 --- a/protected/humhub/modules/user/controllers/InviteController.php +++ b/protected/humhub/modules/user/controllers/InviteController.php @@ -8,6 +8,7 @@ namespace humhub\modules\user\controllers; +use humhub\modules\user\Module; use Yii; use yii\web\Controller; use yii\web\HttpException; @@ -20,7 +21,7 @@ use humhub\widgets\ModalClose; /** * InviteController for new user invites - * + * * @since 1.1 */ class InviteController extends Controller @@ -40,7 +41,7 @@ class InviteController extends Controller /** * Invite form and processing action - * + * * @return string the action result * @throws \yii\web\HttpException */ @@ -56,7 +57,7 @@ class InviteController extends Controller foreach ($model->getEmails() as $email) { $this->createInvite($email); } - + return ModalClose::widget([ 'success' => Yii::t('UserModule.base', 'User has been invited.') ]); @@ -67,7 +68,7 @@ class InviteController extends Controller /** * Creates and sends an e-mail invite - * + * * @param email $email */ protected function createInvite($email) @@ -76,25 +77,29 @@ class InviteController extends Controller $userInvite->email = $email; $userInvite->source = Invite::SOURCE_INVITE; $userInvite->user_originator_id = Yii::$app->user->getIdentity()->id; - + $existingInvite = Invite::findOne(['email' => $email]); if ($existingInvite !== null) { $userInvite->token = $existingInvite->token; $existingInvite->delete(); } - + $userInvite->save(); $userInvite->sendInviteMail(); } /** * Checks if current user can invite new members - * + * * @return boolean can invite new members */ protected function canInvite() { - return Yii::$app->getModule('user')->settings->get('auth.internalUsersCanInvite') || Yii::$app->user->can([new ManageUsers(), new ManageGroups()]); + /** @var Module $module */ + $module = Yii::$app->getModule('user'); + + return $module->settings->get('auth.internalUsersCanInvite') || + Yii::$app->user->can([new ManageUsers(), new ManageGroups()]); } }