Feature RTC Language Change NPM Resource Changed PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar beni71
beni71
17 May 2023

Pull Request for Feature request #23185 .

Summary of Changes

In the articles view there is a batch action which can add/assign one tag from the tag list to the selected articles. This PR introduces the possibility to remove/unassign one tag from the selected articles. It also extends batch processing for categories, contacts and news feeds.

How it looks like:

articles-batch-tag-removing2

Testing Instructions

If you use patch tester, after applying the patch, call npm install from commandline to rebuild the .js files in folder media.

  1. Make sure your Joomla tag system is active and the plugin "Behaviour - Taggable" is enabled.
  2. Create a new article and in the detail view add/assign two tags, lets say "Tag1" and "Tag2".
  3. Save and create a second article, add/assign it to tag "Tag2" and "Tag3".
  4. Save and close.
  5. In the articles list select both articles, click batch action and remove "Tag2". Apply batch processing.
  6. Open the first article details and check whether the "Tag2" is removed. The tag "Tag1" must be still assigned.
  7. Open the second article details and check whether the "Tag2" is removed. The tag "Tag3" must be still assigned.
  8. A similar test should be done for categories, contacts and news feeds.

Actual result BEFORE applying this Pull Request

It is not possible to remove/unassign a tag from an article via batch processing.

Expected result AFTER applying this Pull Request

It is possible to remove/unassign a tag from an article via batch processing.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

There are new text keys that need to be translated.

avatar joomla-cms-bot joomla-cms-bot - change - 17 May 2023
Category Administration Language & Strings JavaScript Repository NPM Change Layout Libraries Front End Plugins
avatar beni71 beni71 - open - 17 May 2023
avatar beni71 beni71 - change - 17 May 2023
Status New Pending
avatar beni71 beni71 - change - 17 May 2023
Title
Added possibility to batch remove a tag
[5.0] Added possibility to batch remove a tag
avatar beni71 beni71 - edited - 17 May 2023
avatar beni71 beni71 - change - 17 May 2023
Labels Added: Feature Language Change NPM Resource Changed PR-5.0-dev
avatar beni71 beni71 - change - 17 May 2023
The description was changed
avatar beni71 beni71 - edited - 17 May 2023
avatar crommie crommie - test_item - 26 Aug 2023 - Tested unsuccessfully
avatar crommie
crommie - comment - 26 Aug 2023

I have tested this item ? unsuccessfully on d9bf8bf

Not yet, this throws

There is no "joomla.batch-tag-addremove" asset of a "script" type in the registry.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar beni71
beni71 - comment - 27 Aug 2023

Hi @crommie, thanks for testing.
I tested it again by installing patch tester on a fresh joomla installation version 5. After applying the patch the article view indeed displayed that error. After calling npm install from commandline it worked. This is needed to rebuild the .js files in folder media. I will update the testing instructions.

avatar beni71 beni71 - change - 27 Aug 2023
The description was changed
avatar beni71 beni71 - edited - 27 Aug 2023
avatar crommie
crommie - comment - 28 Aug 2023

OK in that case I can't re-test since I'm testing on a PBF server site.

avatar ceford ceford - test_item - 14 Sep 2023 - Tested successfully
avatar ceford
ceford - comment - 14 Sep 2023

I have tested this item ✅ successfully on ba2293d

Tested batch tag removal from articles, article categories, contacts and news feeds. All OK.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar alikon alikon - test_item - 14 Sep 2023 - Tested successfully
avatar alikon
alikon - comment - 14 Sep 2023

I have tested this item ✅ successfully on ba2293d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar alikon alikon - change - 14 Sep 2023
Status Pending Ready to Commit
avatar alikon
alikon - comment - 14 Sep 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar beni71 beni71 - change - 30 Sep 2023
Labels Added: ?
avatar HLeithner HLeithner - change - 30 Sep 2023
Title
[5.0] Added possibility to batch remove a tag
[5.1] Added possibility to batch remove a tag
avatar HLeithner HLeithner - edited - 30 Sep 2023
avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar beni71 beni71 - change - 7 Oct 2023
Labels Added: PR-5.1-dev
Removed: PR-5.0-dev
avatar Quy Quy - change - 3 Nov 2023
Labels Added: ?
Removed: ?
avatar beni71 beni71 - change - 8 Dec 2023
Labels Added: RTC
Removed: ?
avatar crimle crimle - test_item - 24 Feb 2024 - Tested unsuccessfully
avatar crimle
crimle - comment - 24 Feb 2024

I have tested this item ? unsuccessfully on 70fa69c

Content > Articles
Error message
An error has occurred.
0 There is no "joomla.batch-tag-addremove" asset of a "script" type in the registry.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar richard67
richard67 - comment - 25 Feb 2024

@crimle @crommie I will reset the negative test results as they are not caused by this PR. The PR modifies an NPM dependency, which can be seen by the label "NPM Resource Changed". Such PRs can't be tested with Patchtester, they require either a development environment with composer and NPM, or they need to be applied by using the packages created by drone, which can be found in the "Downloads" section of the integration checks at the bottom of the PR.

avatar richard67 richard67 - alter_testresult - 25 Feb 2024 - crimle: Not tested
avatar richard67 richard67 - change - 25 Feb 2024
Status Ready to Commit Pending
Build 5.0-dev 5.1-dev
avatar richard67
richard67 - comment - 25 Feb 2024

Back to pending after rebase.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar richard67
richard67 - comment - 25 Feb 2024

@ceford @alikon Could you test this PR again on 5.1-dev? Thanks in advance.

avatar ceford ceford - test_item - 26 Feb 2024 - Tested successfully
avatar ceford
ceford - comment - 26 Feb 2024

I have tested this item ✅ successfully on 70fa69c

All tests worked fine.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar viocassel viocassel - test_item - 26 Feb 2024 - Tested successfully
avatar viocassel
viocassel - comment - 26 Feb 2024

I have tested this item ✅ successfully on 70fa69c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar richard67 richard67 - change - 26 Feb 2024
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 26 Feb 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40613.

avatar bembelimen
bembelimen - comment - 2 Mar 2024

I really like this feature and it should for sure go into Joomla, sadly we can't merge it in 5.1 as it breaks B/C. So I will rebase and it should go into 6.0.

Thank you for your contribution!

avatar beni71 beni71 - change - 3 Mar 2024
Title
[5.1] Added possibility to batch remove a tag
Added possibility to batch remove a tag
avatar beni71 beni71 - edited - 3 Mar 2024
avatar beni71 beni71 - change - 3 Mar 2024
Labels Added: PR-6.0-dev
Removed: PR-5.1-dev
avatar joomla-cms-bot joomla-cms-bot - change - 3 Mar 2024
Category Administration Language & Strings JavaScript Repository NPM Change Layout Libraries Front End Plugins Administration com_cache Language & Strings Layout Libraries
avatar beni71 beni71 - change - 3 Mar 2024
Labels Removed: NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 3 Mar 2024
Category Administration Language & Strings Layout Libraries com_cache Administration com_cache Language & Strings JavaScript Repository NPM Change Layout Libraries Front End Plugins
avatar laoneo laoneo - change - 20 Mar 2024
Labels Added: NPM Resource Changed b/c break
avatar joomla-cms-bot joomla-cms-bot - change - 20 Mar 2024
Category Administration Language & Strings Layout Libraries com_cache JavaScript Repository NPM Change Front End Plugins Administration Language & Strings JavaScript Repository NPM Change Layout Libraries Front End Plugins
avatar laoneo
laoneo - comment - 20 Mar 2024

@beni71 can you create a manual entry for the new arguments in the files in libraries/src? These is a backwards incompatibility and needs to be documented for other extension developers.

avatar beni71
beni71 - comment - 23 Mar 2024

@laoneo I created it within PR #242

avatar brianteeman
brianteeman - comment - 24 Mar 2024

I am confused. First @bembelimen says it cant go into 5 because its a b/c break but its ok for 6. Now @HLeithner says it cant go into 6 because its a b/c break and needs to be rewritten. And I obviously mistakenly understood that you can add options at the end just not in the middle.

avatar HLeithner
HLeithner - comment - 24 Mar 2024

Our b/c promise introduced with 5.0 said we can't b/c break "anything" without a grace period of one major version. Means introduction in 5.1 hard break (removal / behavior change) in 7.0.

Looking at this simple example on 3v4l shows you the error message for all components extending a function which gets a new parameter.

<?php

class AdminModel {
        protected function batchTag($value, $pks, $contexts, $removeTags = false) {
            
        }
}

class ModelBasedOn4or5or6code extends AdminModel {
        protected function batchTag($value, $pks, $contexts) {
            
        }
}

Error Message: Fatal error: Declaration of ModelBasedOn4or5or6code::batchTag($value, $pks, $contexts) must be compatible with AdminModel::batchTag($value, $pks, $contexts, $removeTags = false) in /in/mshfh on line 10

and it doesn't matter if it's introduced in 5.1 or 6.0, we can't break 6.0 because we say components worked with 5.x native will work with 6.0 too (at least that was the promise for 5.0 and I and most other devs expect that we keep it like this)

So changing the API for this case only works with a new function. or another way that old components still will work with 6.0. What we can do is deprecate the current signature and force extension developers to use the no signature (without functional part or proxing to a temp) function and add the new parameter in 7.0.

The other way around works: https://3v4l.org/c1ZZW

<?php

class AdminModel {
        protected function batchTag($value, $pks, $contexts) {
            
        }
}

class ModelBasedOn4or5or6code extends AdminModel {
        protected function batchTag($value, $pks, $contexts, $removeTags = false) {
            
        }
}

So to make this example more use full you can do: https://3v4l.org/iZK34

<?php

class AdminModel {
    // Change to proxy function in Joomla 7.0 to batchTag
    protected function batchTagTempTill70($value, $pks, $contexts, $removeTags = false) {
        // actuall batchTag code
    }

    // In 7.0 add $removeTags parameter and move code from Temp function to this function
    protected function batchTag($value, $pks, $contexts) {
        return $this->batchTagTempTill70($value, $pks, $contexts);
    }
}

class ModelBasedOn4or5or6code extends AdminModel {
    // Proxy function can be removed with Joomla 7.0 compatibility only 
    protected function batchTag($value, $pks, $contexts, $removeTags = false) {
        return $this->batchTagTempTill70($value, $pks, $contexts, $removeTags);
    }
}

I didn't played everything to the end but this should work.

avatar brianteeman
brianteeman - comment - 24 Mar 2024

thanks for the detailed explanation. It was just confusing as you were both saying different things so its hard to know what to do

avatar beni71
beni71 - comment - 25 Mar 2024

@HLeithner Thanks, now I understand what you meant with b/c. Before I continue applying your suggestion, wouldn't it be easier to introduce a new function on the AdminModel like: protected function batchRemoveTag($value, $pks, $contexts)? In this case we wouldn't break compatibility, isn't it?

avatar HLeithner
HLeithner - comment - 25 Mar 2024

who calls this function? does it increase maintenance effort for us or the 3rd party dev? (2 functions need to be maintained)
@Hackwar what's the plan with Tags, since we want to get rid of the implementation or better of UCM does this effect us in the future?

avatar Fedik
Fedik - comment - 25 Mar 2024

BTW, it can be done in backward compatible way, without new method and new param.
Just add a new property to the TagsHelper, and use it.

$tagsHelper->removeTags = true;
$tagsHelper->postStoreProcess();

//or
$tagsHelper->setRemoveTags(true);
$tagsHelper->postStoreProcess();

For AdminModel can use state property.

avatar HLeithner
HLeithner - comment - 25 Mar 2024

BTW, it can be done in backward compatible way, without new method and new param. Just add a new property to the TagsHelper, and use it.

$tagsHelper->removeTags = true;
$tagsHelper->postStoreProcess();

//or
$tagsHelper->setRemoveTags(true);
$tagsHelper->postStoreProcess();

For AdminModel can use state property.

of course this works but introduces a new ugly pattern which makes the code base more complex.

avatar beni71
beni71 - comment - 26 Mar 2024

So changing the API for this case only works with a new function.

@HLeithner @Hackwar I agree. To handle b/c we could just leave batchTag function untouched but deprecate it (with a note that it will be removed in 7.0), then create a new function e.g. batchTags with the new parameter set. Wouldn't it be the easiest solution (also for devs)? Or did I forget something important?

avatar heelc29
heelc29 - comment - 1 Apr 2024

Is it possible to use func_get_args()?
Like here:

// The following code is just for backward compatibility.
if (\func_num_args() > 1 && !\is_array($options)) {
$args = \func_get_args();
$options = [];
$options['type'] = $args[1];
$options['name'] = $args[2] ?? null;
$options['title'] = $args[3] ?? null;
}

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
Added possibility to batch remove a tag
[6.0] Added possibility to batch remove a tag
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar softforge
softforge - comment - 2 Oct 2024

Hi @beni71 we would really like to get this into Joomla 6.0 and would like to help you if we can. We agree it should be a new method and a deprecation to remove in 7.0 asap (if the message is not in before 6 then we cannot remove in 7)
Thanks for all you have done with this so far

So changing the API for this case only works with a new function.

@HLeithner @Hackwar I agree. To handle b/c we could just leave batchTag function untouched but deprecate it (with a note that it will be removed in 7.0), then create a new function e.g. batchTags with the new parameter set. Wouldn't it be the easiest solution (also for devs)? Or did I forget something important?

avatar beni71
beni71 - comment - 4 Oct 2024

@softforge Thanks for helping me.
I have solved the last comment from @HLeithner by adding a new function postStore in the TagsHelper and deprecated the function postStoreProcess.

(if the message is not in before 6 then we cannot remove in 7)

Does it mean that I have to create a PR for the version 5.x as well? If so, shouldn't the deprecation messages be adapted to something like: deprecated 5.x will be removed in 7.0 ?

avatar Bodge-IT
Bodge-IT - comment - 30 Oct 2024

@beni71 yes you would need to get something in 5.* for deprecation in 7. As soon as we see a pr against 5.2, we can merge this one.

Thanks for the time and work on this. We can help test that and discuss with the RM for that release.

avatar beni71 beni71 - change - 31 Oct 2024
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2024-10-31 10:28:29
Closed_By beni71
avatar beni71 beni71 - close - 31 Oct 2024
avatar beni71 beni71 - change - 31 Oct 2024
Status Closed New
Closed_Date 2024-10-31 10:28:29
Closed_By beni71
Labels Removed: RTC
avatar beni71 beni71 - change - 31 Oct 2024
Status New Pending
avatar beni71 beni71 - reopen - 31 Oct 2024
avatar richard67
richard67 - comment - 31 Oct 2024

@softforge @Bodge-IT Meanwhile @beni71 has made a PR for 5.2-dev: #44383 . But as far as I understand your comments above, you just wanted to have the deprecation of the old method batchTag in 5.2-dev, not the complete change. Or did I get something wrong? The new PR #44383 seems to contain all changes from this PR here but not do anything with deprecation message. Could you check and advise?

avatar softforge
softforge - comment - 31 Oct 2024

@softforge @Bodge-IT Meanwhile @beni71 has made a PR for 5.2-dev: #44383 . But as far as I understand your comments above, you just wanted to have the deprecation of the old method batchTag in 5.2-dev, not the complete change. Or did I get something wrong? The new PR #44383 seems to contain all changes from this PR here but not do anything with deprecation message. Could you check and advise?

You are right and I have commented on #44383
Thanks for spotting it

avatar Bodge-IT Bodge-IT - close - 13 Nov 2024
avatar Bodge-IT Bodge-IT - merge - 13 Nov 2024
avatar Bodge-IT Bodge-IT - change - 13 Nov 2024
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-11-13 09:56:03
Closed_By Bodge-IT
Labels Added: RTC
Removed: b/c break
avatar Bodge-IT
Bodge-IT - comment - 13 Nov 2024

Appreciate all your work and patience on this @beni71. Finally merged.

avatar HLeithner
HLeithner - comment - 13 Nov 2024

please create a migration entry in the manual for 6.0

Add a Comment

Login with GitHub to post a comment