Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions confluence-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Expand Down Expand Up @@ -171,6 +176,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.xwiki.contrib.user-common</groupId>
<artifactId>user-common-formatter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.contrib.xwiki.usercommon.formatter.UserFormatterFactory;
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
Expand Down Expand Up @@ -135,6 +136,9 @@ public class ConfluenceConverter implements ConfluenceFilterReferenceConverter
@Inject
private Provider<ComponentManager> componentManagerProvider;

@Inject
private UserFormatterFactory userFormatterFactory;

/**
* @param name the name to validate
* @return the validated name
Expand Down Expand Up @@ -198,7 +202,7 @@ public String toGroupReferenceName(String groupName)
return groupName;
}

return UsernameCleaner.format(format, Map.of("group", groupName));
return userFormatterFactory.create(Map.of("group", groupName)).format(format);
}

/**
Expand Down Expand Up @@ -240,7 +244,7 @@ public String convertUserNameToReferenceName(String userName)
return FORBIDDEN_USER_CHARACTERS.matcher(userName).replaceAll("_");
}

return UsernameCleaner.format(userFormat, Map.of("username", userName));
return userFormatterFactory.create(Map.of("username", userName)).format(userFormat);
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.xwiki.contrib.confluence.filter.internal.macros;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import com.xpn.xwiki.XWiki;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.test.reference.ReferenceComponentList;

import org.contrib.xwiki.usercommon.formatter.internal.DefaultUserFormatter;
import org.contrib.xwiki.usercommon.formatter.internal.DefaultUserFormatterFactory;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -70,6 +73,8 @@
@ComponentList({
DefaultConfluenceInputContext.class,
ConfluenceXMLPackage.class,
DefaultUserFormatter.class,
DefaultUserFormatterFactory.class,
ConfluenceConverter.class
})
@ComponentTest
Expand Down