Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ZNTA-942-oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Jul 5, 2016
2 parents b03c20b + 541cc15 commit f9d008f
Show file tree
Hide file tree
Showing 28 changed files with 403 additions and 178 deletions.
19 changes: 19 additions & 0 deletions docs/release-notes.md
Expand Up @@ -3,12 +3,31 @@
##### Bug Fixes
* [ZNTA-846](https://zanata.atlassian.net/browse/ZNTA-846) - Group "request add project version" needs field limit
* [ZNTA-872](https://zanata.atlassian.net/browse/ZNTA-872) - Redirect to home from cancel button in create user page

##### Infrastructure Changes

* Zanata's cache configuration (Infinispan) is now controlled by `zanata-infinispan.xml`, not `standalone.xml`. Please see the [Infinispan](user-guide/system-admin/configuration/infinispan) section for more information.

The WildFly module for Hibernate 4.2 has been removed. Zanata will now use the version of Hibernate provided by
WildFly. The Zanata installer no longer installs any modules for WildFly. If a previous version of the Zanata
installer has put a Hibernate 4.2 module into your WildFly installation (in modules/org/hibernate/main) you should
remove it.

## 3.9

## 3.9.1
##### Changes
* [ZNTA-1192](https://zanata.atlassian.net/browse/ZNTA-1192) - RFE: Scripts to build the Docker development images

##### Bug Fixes
* [ZNTA-1182](https://zanata.atlassian.net/browse/ZNTA-1182) - Cannot login via kerberos as a new user
* [ZNTA-1175](https://zanata.atlassian.net/browse/ZNTA-1175) - "Login" text not showing in single openid setup
* [ZNTA-1174](https://zanata.atlassian.net/browse/ZNTA-1174) - Regression: cannot connect Fedora / OpenID account (NPE), various changes not saved
* [ZNTA-1145](https://zanata.atlassian.net/browse/ZNTA-1145) - PO-Revision-Date is empty if all translations in document is by copyTrans

-----------------------

## 3.9.0
##### Infrastructure Changes
* System admin can set system property `zanata.enforce.matchingusernames` to enforce matching username to be used for new user registration.
* Zanata has eliminated all JNDI-based configuration and replaced it with system properties. Please see the following sections for how certain values are now configured:
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/main/web/src/actions/profile.js
Expand Up @@ -91,8 +91,15 @@ const getUserInfo = (dispatch, username, dateRangeOption) => {

export const profileInitialLoad = (username) => {
return (dispatch, getState) => {
dispatch(getUserInfo(dispatch, username || window.config.user.username,
getState().profile.dateRangeOption))
const config = window.config
if (isEmpty(username) && !config.permission.isLoggedIn) {
// redirect to login screen if no username is found url
// and user is not logged in
window.location = config.baseUrl + config.links.loginUrl + '#profile'
} else {
dispatch(getUserInfo(dispatch, username,
getState().profile.dateRangeOption))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/main/web/src/components/NavItem.jsx
Expand Up @@ -69,7 +69,7 @@ const NavItem = ({
isSearchLink ? classes.search : {}
)
}
const text = isLogo ? (<span className='Hidden'>{title}</span>) : title
const text = isLogo ? (<span className='D(n)'>{title}</span>) : title
const inverted = false

const child = isLogo
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/main/web/src/containers/UserProfile/index.jsx
Expand Up @@ -50,7 +50,10 @@ const classes = {
class UserProfile extends Component {

componentDidMount () {
this.props.handleInitLoad(this.props.params.username)
const paramUsername = this.props.params.username
const username = (!paramUsername || paramUsername === 'undefined')
? undefined : paramUsername
this.props.handleInitLoad(username)
}

render () {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/main/web/src/index.js
Expand Up @@ -58,6 +58,8 @@ const store = ((initialState) => {

window.config = mapValues(window.config, (value) =>
isJsonString(value) ? JSON.parse(value) : value)
// baseUrl should be /zanata or ''
window.config.baseUrl = window.config.baseUrl || ''

render(
<Root store={store} history={hashHistory} />,
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/main/web/src/legacy.js
Expand Up @@ -47,8 +47,11 @@ WebFont.load({
window.config = mapValues(window.config, (value) =>
isJsonString(value) ? JSON.parse(value) : value)

// baseUrl should be /zanata or ''
window.config.baseUrl = window.config.baseUrl || ''

const links = {
'context': window.config.baseUrl || '',
'context': window.config.baseUrl,
'/login': window.config.links.loginUrl,
'/signup': window.config.links.registerUrl
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/main/web/webpack.config.js
Expand Up @@ -40,5 +40,9 @@ module.exports = {
},
node: {
__dirname: true
},
eslint: {
failOnWarning: false,
failOnError: true
}
}
13 changes: 0 additions & 13 deletions functional-test/pom.xml
Expand Up @@ -423,19 +423,6 @@
<jndi-remote-client.artifactId>wildfly-controller-client</jndi-remote-client.artifactId>
<jndi-remote-client.version>${wildfly.client.version}</jndi-remote-client.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>install-wildfly-modules</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down
Expand Up @@ -24,11 +24,9 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.zanata.page.projects.ProjectBasePage;
import org.zanata.util.WebElementUtil;

import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -43,7 +41,7 @@
@Slf4j
public class ProjectWebHooksTab extends ProjectBasePage {

private By webHooksList = By.id("settings-webhooks-list");
private By webHooksForm = By.id("settings-webhooks-form");
private By saveWebhookButton = By.id("add-webhook-button");
private By urlInputField = By.id("payloadUrlInput");
private By secretInputField = By.id("secretInput");
Expand All @@ -60,9 +58,10 @@ public ProjectWebHooksTab enterUrl(String url, String key) {
}

public List<WebhookItem> getWebHooks() {
List<WebElement> list = readyElement(webHooksList)
.findElement(By.className("list--slat"))
.findElements(By.className("list-item"));
List<WebElement> list = getWebhookList();
if (list.isEmpty()) {
return Lists.newArrayList();
}

return list.stream().map(element -> new WebhookItem(
element.findElement(By.name("url")).getText(),
Expand All @@ -76,16 +75,13 @@ public ProjectWebHooksTab expectWebHooksContains(final String url) {
return new ProjectWebHooksTab(getDriver());
}

public ProjectWebHooksTab expectWebHooksNotContains(final String url) {
waitForPageSilence();
assertThat(getWebHooks()).extracting("url").doesNotContain(url);
return new ProjectWebHooksTab(getDriver());
}

public ProjectWebHooksTab clickRemoveOn(String url) {
List<WebElement> listItems = readyElement(webHooksList)
.findElement(By.className("list--slat"))
.findElements(By.className("list-item"));
List<WebElement> listItems = getWebhookList();
if (listItems.isEmpty()) {
log.info("Did not find item {}", url);
return new ProjectWebHooksTab(getDriver());
}

boolean clicked = false;
for (WebElement listItem : listItems) {
if (listItem.getText().contains(url)) {
Expand All @@ -100,6 +96,15 @@ public ProjectWebHooksTab clickRemoveOn(String url) {
return new ProjectWebHooksTab(getDriver());
}

private List<WebElement> getWebhookList() {
List<WebElement> listWrapper = readyElement(webHooksForm)
.findElements(By.className("list--slat"));
if (listWrapper == null || listWrapper.isEmpty()) {
return Lists.newArrayList();
}
return listWrapper.get(0).findElements(By.className("list-item"));
}

@Getter
@AllArgsConstructor
public class WebhookItem {
Expand Down
Expand Up @@ -65,7 +65,7 @@ public void testGlossaryView() {
projectRootPath,
"mvn -U --batch-mode zanata:glossary-push " +
"-Dglossary.lang=hi " +
"-Dzanata.glossaryFile=compendium.csv " +
"-Dzanata.file=compendium.csv " +
"-Dzanata.userConfig=" + userConfigPath);

assertThat(clientWorkFlow.isPushSuccessful(result),
Expand Down
Expand Up @@ -52,11 +52,11 @@ public class GlossaryPushTest extends ZanataTestCase {
private String basicUserConfigPath;

private String pushCommand = "mvn -U --batch-mode zanata:glossary-push " +
"-Dglossary.lang=fr -Dzanata.glossaryFile=compendium_fr.po " +
"-Dglossary.lang=fr -Dzanata.file=compendium_fr.po " +
"-Dzanata.userConfig=";

private String pushCSVCommand = "mvn -U --batch-mode zanata:glossary-push " +
"-Dzanata.glossaryFile=compendium_invalid.csv -Dglossary.lang=hi " +
"-Dzanata.file=compendium_invalid.csv -Dglossary.lang=hi " +
"-Dzanata.userConfig=";

@Before
Expand Down
Expand Up @@ -56,8 +56,7 @@ public void addWebHook() throws Exception {
.goToProjectByName("about fedora")
.gotoSettingsTab()
.gotoSettingsWebHooksTab()
.enterUrl(testUrl, key)
.expectWebHooksContains(testUrl);
.enterUrl(testUrl, key);

assertThat(projectWebHooksTab.getWebHooks())
.extracting("url")
Expand All @@ -77,8 +76,7 @@ public void removeWebHook() throws Exception {
.gotoSettingsWebHooksTab()
.enterUrl(testUrl, key)
.expectWebHooksContains(testUrl)
.clickRemoveOn(testUrl)
.expectWebHooksNotContains(testUrl);
.clickRemoveOn(testUrl);

assertThat(projectWebHooksTab.getWebHooks())
.extracting("url")
Expand Down
28 changes: 0 additions & 28 deletions pom.xml
Expand Up @@ -1925,34 +1925,6 @@
<hibernate.module.url>https://bintray.com/artifact/download/sflanigan/generic/${hibernate.module.filename}</hibernate.module.url>
</properties>

<build>
<plugins>
<!--
Download wildfly modules from sf.net and extract under appserver.home
-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>install-wildfly-modules</id>
<!-- submodules should use 'package' to activate this -->
<phase>none</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target unless="skipITs">
<mkdir dir="${download.dir}" />
<get src="${hibernate.module.url}" dest="${download.dir}/${hibernate.module.filename}" skipexisting="true" />
<unzip src="${download.dir}/${hibernate.module.filename}" dest="${appserver.home}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<!-- These override the older versions forced by jboss-as-parent 7.2.0 -->
<dependencyManagement>
<dependencies>
Expand Down
19 changes: 10 additions & 9 deletions zanata-overlay/config/remote-deps.groovy
Expand Up @@ -15,13 +15,14 @@
* }
*
* The dependency name is not relevant, just an identifier.
*
* For example:
*
* 'wildfly' {
* hibernatemodule {
* url = "https://bintray.com/artifact/download/sflanigan/generic/wildfly-module-hibernate-main-4.2.20.Final.zip"
* toFile = "/hibernate-module.zip"
* extract = true
* }
* }
*/

'wildfly' {
hibernatemodule {
url = "https://bintray.com/artifact/download/sflanigan/generic/wildfly-module-hibernate-main-4.2.20.Final.zip"
toFile = "/hibernate-module.zip"
extract = true
}

}
5 changes: 0 additions & 5 deletions zanata-war/pom.xml
Expand Up @@ -1206,11 +1206,6 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>install-wildfly-modules</id>
<phase>package</phase>
</execution>

<!-- Install arquillian-customised version of standalone.xml -->
<execution>
<id>prepare-arquillian-container</id>
Expand Down
14 changes: 14 additions & 0 deletions zanata-war/src/main/java/org/zanata/action/ProjectHome.java
Expand Up @@ -41,6 +41,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;

import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
Expand Down Expand Up @@ -79,6 +80,7 @@
import org.zanata.service.LocaleService;
import org.zanata.service.SlugEntityService;
import org.zanata.service.ValidationService;
import org.zanata.service.impl.WebHooksPublisher;
import org.zanata.ui.AbstractListFilter;
import org.zanata.ui.InMemoryListFilter;
import org.zanata.ui.autocomplete.MaintainerAutocomplete;
Expand All @@ -87,6 +89,7 @@
import org.zanata.util.ComparatorUtil;
import org.zanata.util.ServiceLocator;
import org.zanata.util.UrlUtil;
import org.zanata.webhook.events.TestEvent;
import org.zanata.webtrans.shared.model.ValidationAction;
import org.zanata.webtrans.shared.model.ValidationId;
import org.zanata.webtrans.shared.validation.ValidationFactory;
Expand Down Expand Up @@ -1110,6 +1113,17 @@ public void removeWebHook(Long webhookId) {
}
}

public void testWebhook(String url, String secret, String strType) {
identity.checkPermission(getInstance(), "update");
WebhookType type = WebhookType.valueOf(strType);
if (isValidUrl(url, type)) {
TestEvent event =
new TestEvent(identity.getAccountUsername(), getSlug());
WebHooksPublisher
.publish(url, event, Optional.fromNullable(secret));
}
}

/**
* Check if url is valid and there is no duplication of url+type
*/
Expand Down

0 comments on commit f9d008f

Please sign in to comment.