Make token names consistent

Created on 4 December 2022, almost 2 years ago
Updated 1 February 2023, almost 2 years ago

Problem/Motivation

This is a follow-up on #3315709: Token [current-user:ip-address] no longer work when ECA Core is enabled and we may want to make token names provided by ECA more consistent. In particular, ECA provides these:

  • form, current-form
  • user, current_user

There is a hyphen and an underscore, that should be the same one. And as the token contrib module uses current-user which would cause conflicts if ECA were to use the same, ECA should use underscore generally.

This would break existing models, that used a token with the old name. But the ECA update command could resolve this automatically, or maybe even an update hook in this case.

📌 Task
Status

Fixed

Version

1.2

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @_pratik_ opened merge request.
  • 🇮🇳India _pratik_ Banglore

    Hi @jurgenhaas,
    Created MR for patch #3. and missed occurence.
    It cover 1 and 3 from #5.
    For point 2, update command will works, right ?
    Thanks.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks a lot @_pratik_ for the MR and the enhancements. There is only one little comment in the code that needs your attention.

    As for the update of existing models, unfortunately the existing update command doesn't cover that. The update command recognizes changed in the config forms for the plugins, but the changed token name is being used in config values. So, what's required is an update_hook which goes through all the models, check all the config fields if a token with [current-form is being used and replace that with [current_form. In the eca.install file there are already a few hooks which do similar thing. Using one of them as a blue print should help a lot.

  • 🇮🇳India _pratik_ Banglore

    Hi @jurgenhaas,
    I am little occupied with some other priority work. Unable to focus here.
    I thought to inform, to not keep you waiting.

    Thanks.

  • Status changed to Needs review almost 2 years ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    I've resolved the one code issue and added the update hook which updates existing models. For that reason, we need to back port this fix into 1.1.x and 1.0.x so that those models don't be missed out from this update.

  • Status changed to RTBC almost 2 years ago
  • 🇩🇪Germany danielspeicher Steisslingen

    Thank you guys for the work.

    Good idea to us an update method. This keeps the code clean.

  • Status changed to Fixed almost 2 years ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thank you. Merged this into all 3 branches.

  • 🇩🇪Germany mxh Offenburg

    Why backport? This issue is a task, not a bug fix. Futhermore, despite of having the update hook, there is a risk of breaking compatibility. Therefore, this should've only committed into the current feature branch (1.2.x).

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024