πŸ‡»πŸ‡³Vietnam @tra.duong

Account created on 29 March 2018, about 6 years ago
#

Recent comments

πŸ‡»πŸ‡³Vietnam tra.duong

The permission for "View published content" is belong to "system" module (yes, the "system" is also a module).

1. Go to /admin/people/permissions,

The permission in this page is changed on purposed
When access:
"core/modules/user/src/Form/UserPermissionsForm.php::permissionsByProvider()"
You will see

    // Move the access content permission to the Node module if it is installed.
    // @todo Add an alter so that this section can be moved to the Node module.
    if ($this->moduleHandler->moduleExists('node')) {
      // Insert 'access content' before the 'view own unpublished content' key

After have a check, there is a glitch of "core/modules/views/src/Plugin/views/display/DisplayPluginBase.php::buildOptionsForm()"
It does not replace/move the 'access content' permission from "system" to "node" like it does on permission page.

That's my checks.

πŸ‡»πŸ‡³Vietnam tra.duong

From a usability point of view there's certainly room for improvement.

Well, what about inheritance role?
The roles, most permissions are identical, only few of them need to adjust. What if we inherit the permissions from existing role and do only on adjustment?
My two cents.

πŸ‡»πŸ‡³Vietnam tra.duong

I change status to needs work

πŸ‡»πŸ‡³Vietnam tra.duong

@atul ghate

I have applied your patch, it work fine on:
+ Display close button.
+ Close message when click.
But, I see a close button already exists on the claro theme. I think the styling should be identical.
Otherwise, a light box shadow seems not Claro style.
Here is a close button on views popup:

My two cents

πŸ‡»πŸ‡³Vietnam tra.duong

I set the status to active. The trace in #20 should be the cause of the problem.

πŸ‡»πŸ‡³Vietnam tra.duong

I tried to trace and found something error:

 [notice] Performed install task: install_profile_themes
 [warning] The "extra_field_block:node:recipe:content_moderation_control" was not found
  .....
 [notice] Performed install task: install_install_profile

The orders is weid here, when install theme, it also try to import the settings in demo_umami/config/install
But the content types are installed in install_install_profile step.
After the content types is installed, the content_moderation module checks for moderated bundles to register the plugins (extra_field_block:node:{bundle}:content_moderation_control)

So, in the install_profile_themes step, it cannot see the (extra_field_block:node:{bundle}:content_moderation_control) then throw a 'PluginNotFoundException' and return as 'Drupal/Core/Block/Plugin/Block/Broken'.

Then, in install_install_profile step, it Fix that broken plugin, because content_moderation module invoke the register here.

Propose solution:
Considering about put the import content type's display mode in after content_moderation register the plugin / Or remove the warning of registering `extra_field_block:{content_type}:{bundle}:{content_moderation field}` plugins in the install_profile_themes step.

About the error when translation:
Line 30452 of "translations/drupal-10.0.3.es.po" in my case:


...
msgstr ""
"Las actualizaciones fallaron para el tipo de entidad %entity_type,
"para %entity_ids. <a href=\":url\">Compruebe los registros</a>."  
msgid ""
...

replace <a href=:url> to <a href=\":url\"> solve the error.

πŸ‡»πŸ‡³Vietnam tra.duong

@alexpott, it not totally the same yes. Because for monolingual, which is not English, it try to switch back to English and override the translation in View
I mean it override the configuration of the already overrided view.
This behavior answer why patch #76 works. It ignore the 'switch back' in locale_system_set_config_langcodes()
The thing to consider here is, which is made by user must be kept, even when switch back to English is not identical.
I put my issue here, to give another factor of this issue to easier to evaluate.

πŸ‡»πŸ‡³Vietnam tra.duong

I install demo_umami using:
Drupal 10.0.3
PHP 8.1.14
and run `lando drush si demo_umami -y`

[notice] Starting Drupal installation. This takes a while.
 [notice] Performed install task: install_select_language
 [notice] Performed install task: install_select_profile
 [notice] Performed install task: install_load_profile
 [notice] Performed install task: install_verify_requirements
 [notice] Performed install task: install_verify_database_ready
 [notice] Performed install task: install_base_system
 [notice] Performed install task: install_bootstrap_full
 [notice] Performed install task: install_profile_modules
 [notice] Performed install task: install_profile_themes
 [warning] The "extra_field_block:node:recipe:content_moderation_control" was not found
 [warning] The "extra_field_block:node:recipe:content_moderation_control" was not found
 [warning] The "extra_field_block:node:page:content_moderation_control" was not found
 [warning] The "extra_field_block:node:page:content_moderation_control" was not found
 [warning] The "extra_field_block:node:article:content_moderation_control" was not found
 [warning] The "extra_field_block:node:article:content_moderation_control" was not found
 [notice] Performed install task: install_install_profile
 [error]  Import of string "Las actualizaciones fallaron para el tipo de entidad %entity_type, para %entity_ids. <a href=:url>Compruebe los registros</a>." was skipped because of disallowed or malformed HTML. 
 [notice] Translations imported: 8892 added, 0 updated, 0 removed.
 [warning] 1 disallowed HTML string(s) in files: translations://drupal-10.0.3.es.po.
 [notice] Performed install task: install_import_translations
 [notice] Performed install task: install_configure_form
 [warning] No configuration objects have been updated.
 [notice] Performed install task: install_finish_translations
 [notice] Performed install task: install_finished

There are 8 warnings and 1 error

It is not good for a core's demo profile.

πŸ‡»πŸ‡³Vietnam tra.duong

It is useless since https://www.drupal.org/project/drupal/issues/3092090 β†’ when
core\lib\Drupal\Core\Path\AliasManager.php is removed
It became a single interface without any implements since then.

πŸ‡»πŸ‡³Vietnam tra.duong

I have this issue.
Tried #76 and #106 patches.

My environment:
+ Drupal 9.5
+ Default langcode is Ja, monolingual
+ Check on '/admin/content/media'

Steps to reproduce the error:
+ install site
+ import configurations (views.view.media.yml in this case) which is langcode 'ja' and label of 'Status' changed.
+ `drush locale:check`
+ `drush locale:update` <-- issue appeared here

The result is `Status` label is fallback to the translate of string `Status`, not the already translate string in `views.view.media.yml`
=> The translation of views change unintentional.

About patch #76: It not change the text in this case, but it is too brutal.
About patch #106: The configuration is changed.
I have a check on `vendor/drush/drush/src/Drupal/Commands/core/LocaleCommands.php::update`
it call locale/locale.fetch.inc::locale_translation_batch_update_build
Seems patch #106 does not take affect to the processing of this function

I agreed to @Anybody in #124. I raise a case when the patch may failed to deeper improvement

πŸ‡»πŸ‡³Vietnam tra.duong

I add patch to fix the PHPCS, please review

πŸ‡»πŸ‡³Vietnam tra.duong

@viperror The patch add routing, you need to clear the cache to recognize new route.

@Qusai Taha, your patch contains error.
in src/Form/CreateThreadForm.php i/src/Form/CreateThreadForm.php

...
+    // Split search users.
+    $recipients = explode(", ", $form_state->getValue('to')); <-- CHECK
+    $recipients_id = [];

Note: User's input, better split by comma, not followed by any space.

+        ->condition('name', $recipient, "="); <-- CHECK

Note: very dangerous
1. SQL injection may happen here.
2. Because this is user's input, a trim() on $recipient is good.

+        $recipient_id = $query->execute()->fetchCol(); <-- CHECK
+
+        if (empty($recipient_id)) {

Note: Query produce array/boolean

+          $this->messenger()->addError($this->t('There a user name is not valid, please make sure to enter a valid user name.')); <-- CHECK
+        }

Note:
-> the error message is not correct.
-> Consider log errors and send message once the check name is done,
-> Showing which name is error is awesome here too.

+        else {
+          $recipients_id[] = $recipient_id; <-- CHECK
+        }
...

Note: here produce multiple dimension array
It will let this piece of code error

+    if (!empty($recipients_id)) {
+      if (count($recipients_id) > 1) {
+        foreach($recipients_id as $recipient_id) { 
+          $thread_id = $this->privateMsgService->createThread($author_id, $subject, $body_value, $format, $recipient_id); <-- CHECK
+        }

Note: $recipient_id is array, not int

πŸ‡»πŸ‡³Vietnam tra.duong

@Ludo.R I have some thoughts about your patch
First:
+core_version_requirement: ^8 || ^9 || ^10
should be ^8.8 || ^9 || ^10
Please refer https://www.drupal.org/node/3070687 β†’

Second:
This module add dependency on https://www.drupal.org/project/menu_link β†’ which is currently not available for Drupal 10.

πŸ‡»πŸ‡³Vietnam tra.duong

@yivanov
`tsotoodeh` see an error, he may not explained it clear.
You can install a fresh Drupal site. Enable languages and interface translation, config translations..etc to check.
You won't see the options in the 'Unit of time' which is `tsotoodeh` mentioned.
If you search for

  • @minute
  • @second
  • @custom
  • @default

You will see the translation string of them. You can see `@minute` but cannot see `Only Minute`.
These are arguments as the code as this line provide:

$this->t('@minute', ['@minute' => 'Only Minute']);

So, if you translate the string by arguments, it may only available for developers or someone can read the code. It is not translate the text, just a replacement argument.

There are 2 options to improve/correct this translations:

// Your code:
  $only_minute = $this->t('@minute', ['@minute' => 'Only Minute']);
  $minute_second = $this->t('@second', ['@second' => 'Minute and Second']);
  $below = $this->t('@custom', ['@custom' => 'Minute and Second, 1 minute if words < words per minute']);
  $default = $this->t('@default', ['@default' => 'Default (only minute) without text']);


/* Option 1:*/
  $only_minute = $this->t('Only Minute');
  $minute_second = $this->t('Minute and Second');
  $below = $this->t('Minute and Second, 1 minute if words < words per minute');
  $default = $this->t('Default (only minute) without text');


/* Option 2:*/
  $only_minute = $this->t('@minute', ['@minute' =>  $this->t('Only Minute')]);
  $minute_second = $this->t('@second', ['@second' =>  $this->t('Minute and Second')]);
  $below = $this->t('@custom', ['@custom' =>  $this->t('Minute and Second, 1 minute if words < words per minute')]);
  $default = $this->t('@default', ['@default' =>  $this->t('Default (only minute) without text')]);

Option 1: will provide 1 string in the translation text.
Option 2: will provide 2 strings (ex: `@minute` and `Only Minute`).

Note
I think `tsotoodeh` mentioned about Option1 and this Option1 is correct.
Besides, the @minute, @second ... may cause conflicts on translation string. They are so popular.

πŸ‡»πŸ‡³Vietnam tra.duong

I have pushed a commit, please review

πŸ‡»πŸ‡³Vietnam tra.duong

@richgerdes
I have check the commit again, it makes me confuse somehow.
https://git.drupalcode.org/project/event/-/merge_requests/2/diffs
Please uncheck "Show whitespace changes" in "Preferences", the whitespaces may auto-corrected by my IDE.

πŸ‡»πŸ‡³Vietnam tra.duong

I have check the commit @richgerdes's commit and it removed the BSOD.

However, depends on https://www.drupal.org/docs/drupal-apis/entity-api/converting-a-content-... β†’
I also add a hook_update_N to migrate old data just in case.

I put an MR.

πŸ‡»πŸ‡³Vietnam tra.duong

tra.duong β†’ made their first commit to this issue’s fork.

πŸ‡»πŸ‡³Vietnam tra.duong

@gayatri chahar Your patch works.

However, there is something left over

In /src/PasswordPolicy.php:

-use Drupal\user\Entity\User;

In /src/PasswordPolicyInterface.php:

- use Drupal\simple_password_policy\Event\PasswordPolicyExpireEvent;
- use Drupal\simple_password_policy\Event\PasswordPolicyWarningEvent;

Regards.

πŸ‡»πŸ‡³Vietnam tra.duong

I have take a look at the status of color module:

  • A "deprecated" link is displayed on the Extend page => YES
  • They are also mentioned in a deprecated section on the Status Report page => YES
  • The Upgrade Status contrib module mentions deprecated modules => YES

System:
- Drupal 9.5.4-dev
- PHP: 8.1.14
- Mysql: 5.7.29

Note: It also appeared on uninstall module page(/admin/modules/uninstall).

πŸ‡»πŸ‡³Vietnam tra.duong

tra.duong β†’ made their first commit to this issue’s fork.

Production build 0.69.0 2024