diff --git a/public/main/install/configuration.dist.php b/public/main/install/configuration.dist.php index 14db5a5b19..c861eb768e 100644 --- a/public/main/install/configuration.dist.php +++ b/public/main/install/configuration.dist.php @@ -1039,21 +1039,6 @@ $_configuration['required_extra_fields_in_profile'] = [ // Avoid add a reply-to header when a no-reply address is set. //$_configuration['mail_no_reply_avoid_reply_to'] = false; -// Allows to user add feedback (likes or dislikes) to posts in social wall. Requires DB changes: -// CREATE TABLE message_feedback (id BIGINT AUTO_INCREMENT NOT NULL, message_id BIGINT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT '0' NOT NULL, disliked TINYINT(1) DEFAULT '0' NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_DB0F8049537A1329 (message_id), INDEX IDX_DB0F8049A76ED395 (user_id), INDEX idx_message_feedback_uid_mid (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -// ALTER TABLE message_feedback ADD CONSTRAINT FK_DB0F8049537A1329 FOREIGN KEY (message_id) REFERENCES message (id) ON DELETE CASCADE; -// ALTER TABLE message_feedback ADD CONSTRAINT FK_DB0F8049A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE; -// In 1.11.8, before enabling this feature, you also need to: -// - edit src/Chamilo/CoreBundle/Entity/MessageFeedback.php -// and follow the instructions about the @ORM\Entity() line -// - edit src/Chamilo/CoreBundle/Entity/Message.php -// and follow the instructions about the @ORM\OneToMany line for the $likes property -// - launch "composer install" to rebuild the autoload.php -//$_configuration['social_enable_messages_feedback'] = false; - -// Disable dislike button in the social network. -//$_configuration['disable_dislike_option'] = false; - // Block student's access to the course documents when using the ckeditor "Browse server" button //$_configuration['block_editor_file_manager_for_students'] = false; // Show a language flag next to the user picture in the social network diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170627122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170627122900.php index 1b79ff6f42..fc9dc6391e 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170627122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170627122900.php @@ -347,6 +347,19 @@ class Version20170627122900 extends AbstractMigrationChamilo "INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'ticket_project_user_roles', 'Ticket', '$selectedValue', 'ticket_project_user_roles', 1, 1)" ); } + + // social configurations + if ($this->getConfigurationValue('social_enable_messages_feedback')) { + $this->addSql( + "INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'social_enable_messages_feedback', 'Social', 'true', 'social_enable_messages_feedback', 1, 1)" + ); + } + + if ($this->getConfigurationValue('disable_dislike_option')) { + $this->addSql( + "INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'disable_dislike_option', 'Social', 'true', 'disable_dislike_option', 1, 1)" + ); + } } public function down(Schema $schema): void diff --git a/src/CoreBundle/Settings/SocialSettingsSchema.php b/src/CoreBundle/Settings/SocialSettingsSchema.php index 8f9d794a38..bb099f82b1 100644 --- a/src/CoreBundle/Settings/SocialSettingsSchema.php +++ b/src/CoreBundle/Settings/SocialSettingsSchema.php @@ -19,12 +19,16 @@ class SocialSettingsSchema extends AbstractSettingsSchema [ 'allow_social_tool' => 'true', 'allow_students_to_create_groups_in_social' => 'false', + 'social_enable_messages_feedback' => 'false', + 'disable_dislike_option' => 'false', ] ) ; $allowedTypes = [ 'allow_social_tool' => ['string'], 'allow_students_to_create_groups_in_social' => ['string'], + 'social_enable_messages_feedback' => ['string'], + 'disable_dislike_option' => ['string'], ]; $this->setMultipleAllowedTypes($allowedTypes, $builder); } @@ -34,6 +38,8 @@ class SocialSettingsSchema extends AbstractSettingsSchema $builder ->add('allow_social_tool', YesNoType::class) ->add('allow_students_to_create_groups_in_social', YesNoType::class) + ->add('social_enable_messages_feedback', YesNoType::class) + ->add('disable_dislike_option', YesNoType::class) ; } }