Skip to content

Commit

Permalink
Merge pull request #1313 from ericenns/hotfix/22.05.2
Browse files Browse the repository at this point in the history
Hotfix/22.05.2
  • Loading branch information
ksierks authored Jun 10, 2022
2 parents 8208ca1 + 274320f commit e42f30d
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 146 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

# Changelog

## [22.05.2] - 2022/06/10
* [Developer/UI]: Fix flaky UI Integration tests. See [PR 1313](https://github.com/phac-nml/irida/pull/1313)
* [Developer]: Update war build to decrease size and remove executable ability. See [PR 1313](https://github.com/phac-nml/irida/pull/1313)
* [Developer/UI]: Fixed bug where context path was not set for login and password reset components. See [PR 1313](https://github.com/phac-nml/irida/pull/1313)
* [Developer]: Fixed bug where duplicate project_subscriptions were added for users who had direct project membership with email subscriptions and were also a member of the project through group membership. See [PR 1313](https://github.com/phac-nml/irida/pull/1313)

## [22.05.1] - 2022/06/01
* [UI]: Fixed bug where samples could not be removed from share page. See [PR 1296](https://github.com/phac-nml/irida/pull/1296) for more.
* [Developer]: Fixed bug where project_subscriptions were added for groups without projects. See [PR 1296](https://github.com/phac-nml/irida/pull/1296) for more.
Expand Down Expand Up @@ -80,6 +86,7 @@

## [...previous](https://github.com/phac-nml/irida/blob/21.09.2/CHANGELOG.md)

[22.05.2]: https://github.com/phac-nml/irida/compare/22.05.1...22.05.2
[22.05.1]: https://github.com/phac-nml/irida/compare/22.05...22.05.1
[22.05]: https://github.com/phac-nml/irida/compare/22.03.1...22.05
[22.03.1]: https://github.com/phac-nml/irida/compare/22.03...22.03.1
Expand Down
23 changes: 20 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<groupId>ca.corefacility.bioinformatics</groupId>
<artifactId>irida</artifactId>
<packaging>war</packaging>
<version>22.05.1</version>
<version>22.05.2</version>
<name>irida</name>
<url>http://www.irida.ca</url>

Expand Down Expand Up @@ -542,6 +542,15 @@
<jvmArguments>${failsafeArgLine}</jvmArguments>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<goals>
Expand Down Expand Up @@ -749,10 +758,18 @@
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>
node/,
node_modules/,
.yarn/,
resources/css/,
resources/js/
resources/js/,
webpack*,
.yarn*,
package.json,
styles.js,
entries.js,
.eslintr.js,
postcss.config.js
</packagingExcludes>
<attachClasses>true</attachClasses>
</configuration>
Expand Down Expand Up @@ -1027,4 +1044,4 @@
</properties>
</profile>
</profiles>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,69 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">

<changeSet id="user-account-project-subscription" author="katherine">
<validCheckSum>8:e75125f4b2af1759f21078bafe3b8ed9</validCheckSum>
<validCheckSum>8:4b751d31b04454a4763d8dca46ef4857</validCheckSum>
<createTable tableName="project_subscription">
<column name="id" type="bigint(20)" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
<constraints primaryKey="true" nullable="false" />
</column>
<column name="project_id" type="bigint(20)">
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_PROJECT"
referencedColumnNames="id" referencedTableName="project" nullable="false"/>
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_PROJECT" referencedColumnNames="id" referencedTableName="project" nullable="false" />
</column>
<column name="user_id" type="bigint(20)">
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_USER"
referencedColumnNames="id" referencedTableName="user" nullable="false"/>
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_USER" referencedColumnNames="id" referencedTableName="user" nullable="false" />
</column>
<column name="email_subscription" type="bit(1)" >
<constraints nullable="false"/>
<column name="email_subscription" type="bit(1)">
<constraints nullable="false" />
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
</createTable>

<addUniqueConstraint columnNames="project_id, user_id"
constraintName="UK_PROJECT_SUBSCRIPTION_PROJECT_USER" tableName="project_subscription"/>
<addUniqueConstraint columnNames="project_id, user_id" constraintName="UK_PROJECT_SUBSCRIPTION_PROJECT_USER" tableName="project_subscription" />

<createTable tableName="project_subscription_AUD">
<column name="id" type="bigint(20)" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
<constraints primaryKey="true" nullable="false" />
</column>
<column name="REV" type="int(11)">
<constraints primaryKey="true" nullable="false"
foreignKeyName="FK_PROJECT_SUBSCRIPTION_REVISION" referencedColumnNames="id"
referencedTableName="Revisions"/>
<constraints primaryKey="true" nullable="false" foreignKeyName="FK_PROJECT_SUBSCRIPTION_REVISION" referencedColumnNames="id" referencedTableName="Revisions" />
</column>
<column name="REVTYPE" type="tinyint(4)"/>
<column name="REVTYPE" type="tinyint(4)" />
<column name="project_id" type="bigint(20)">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
<column name="user_id" type="bigint(20)">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
<column name="email_subscription" type="bit(1)">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
<constraints nullable="false" />
</column>
</createTable>

<sql>
INSERT INTO project_subscription (project_id, user_id, email_subscription, created_date)
SELECT project_id, user_id, IF(email_subscription=b'1', 1, 0), now() FROM project_user
SELECT project_id, user_id, MAX(email_subscription), MIN(created_date) FROM
(SELECT project_id, user_id, IF(email_subscription=b'1', 1, 0) as email_subscription, now() as created_date FROM project_user
UNION
SELECT p.project_id, m.user_id, 0, now() from user_group_member m INNER JOIN user_group_project p ON
m.group_id = p.user_group_id;
SELECT p.project_id, m.user_id, 0 as email_subscription, now() as created_date from user_group_member m INNER JOIN user_group_project p ON
m.group_id = p.user_group_id) t group by project_id, user_id;
</sql>

<dropColumn tableName="project_user" columnName="email_subscription"/>
<dropColumn tableName="project_user_AUD" columnName="email_subscription"/>
<dropColumn tableName="project_user" columnName="email_subscription" />
<dropColumn tableName="project_user_AUD" columnName="email_subscription" />

</changeSet>
</databaseChangeLog>
4 changes: 4 additions & 0 deletions src/main/webapp/pages/password/password_reset.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
window.PAGE = {
passwordReset: /*[[${passwordReset}]]*/ "0",
};

window.TL = {
_BASE_URL: /*[[@{/}]]*/ '/',
}
</script>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/resources/js/apis/password-reset.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
import { setBaseUrl } from "../utilities/url-utilities";

const BASE_URL = setBaseUrl(`ajax/password_reset`);
const BASE_URL = setBaseUrl(`/ajax/password_reset`);

/**
* Redux API for password resets.
*/
export const passwordResetApi = createApi({
reducerPath: `passwordResetApi`,
baseQuery: fetchBaseQuery({
baseUrl: setBaseUrl(BASE_URL),
baseUrl: BASE_URL,
}),
tagTypes: ["PasswordReset"],
endpoints: (build) => ({
Expand Down
14 changes: 11 additions & 3 deletions src/main/webapp/resources/js/pages/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import store from "./store";
import { ForgotPassword } from "./password/ForgotPassword";
import { ActivateAccount } from "./password/ActivateAccount";

/*
WEBPACK PUBLIC PATH:
Webpack does not know what the servlet context path is. To fix this, webpack exposed
the variable `__webpack_public_path__`
See: https://webpack.js.org/guides/public-path/#on-the-fly
*/
__webpack_public_path__ = setBaseUrl(`/dist/`);

const { Item } = Form;

/**
Expand Down Expand Up @@ -99,7 +107,7 @@ function LoginForm({ updateDisplayLoginPage, updatePageType }) {
history.pushState(
"forgot",
"Forgot Password",
"/forgot_password"
setBaseUrl("/forgot_password")
);
}}
style={{ padding: 0, marginLeft: 15 }}
Expand All @@ -116,7 +124,7 @@ function LoginForm({ updateDisplayLoginPage, updatePageType }) {
history.pushState(
"activate",
"Activate Account",
"/activate_account"
setBaseUrl("/activate_account")
);
}}
style={{ padding: 0, marginLeft: 25 }}
Expand Down Expand Up @@ -180,7 +188,7 @@ function LoginPage() {
history.pushState(
"forgot",
"Forgot Password",
"/forgot_password"
setBaseUrl("/forgot_password")
);
}}
>
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/resources/js/pages/password/PasswordReset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ import store from "../store";
import { Provider } from "react-redux";
import { validatePassword } from "../../utilities/validation-utilities";

/*
WEBPACK PUBLIC PATH:
Webpack does not know what the servlet context path is. To fix this, webpack exposed
the variable `__webpack_public_path__`
See: https://webpack.js.org/guides/public-path/#on-the-fly
*/
__webpack_public_path__ = setBaseUrl(`/dist/`);

const { Item } = Form;
const passwordExpired =
new URLSearchParams(window.location.search).get("expired") || false;
Expand Down
9 changes: 9 additions & 0 deletions src/main/webapp/resources/js/pages/projects/samples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import {
} from "../../../apis/projects/associated-projects";
import samplesReducer from "../redux/samplesSlice";
import { projectApi } from "../../../apis/projects/project";
import { setBaseUrl } from "../../../utilities/url-utilities";

/*
WEBPACK PUBLIC PATH:
Webpack does not know what the servlet context path is. To fix this, webpack exposed
the variable `__webpack_public_path__`
See: https://webpack.js.org/guides/public-path/#on-the-fly
*/
__webpack_public_path__ = setBaseUrl(`/dist/`);

/**
* Redux store for project samples
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/resources/js/pages/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ const UserSecurityPage = React.lazy(() =>
import("./components/UserSecurityPage")
);

/*
WEBPACK PUBLIC PATH:
Webpack does not know what the servlet context path is. To fix this, webpack exposed
the variable `__webpack_public_path__`
See: https://webpack.js.org/guides/public-path/#on-the-fly
*/
__webpack_public_path__ = setBaseUrl(`/dist/`);

/**
* React component that displays the user pages.
* @returns {*}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.List;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;
Expand Down Expand Up @@ -47,8 +45,8 @@
@Tag("IntegrationTest")
@Tag("UI")
@ActiveProfiles("it")
@SpringBootTest(classes = { IridaApplication.class,
IridaApiTestFilesystemConfig.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(classes = { IridaApplication.class, IridaApiTestFilesystemConfig.class },
webEnvironment = WebEnvironment.RANDOM_PORT)
@Import(IridaIntegrationTestUriConfig.class)
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class })
@DatabaseTearDown("classpath:/ca/corefacility/bioinformatics/irida/test/integration/TableReset.xml")
Expand All @@ -67,26 +65,6 @@ public class AbstractIridaUIITChromeDriver {
@RegisterExtension
public ScreenshotOnFailureWatcher watcher = new ScreenshotOnFailureWatcher();

/**
* Code to execute before *each* test.
*/
@BeforeEach
public void setUpTest() throws IOException {
// logout before everything else.
LoginPage.logout(driver());
}

/**
* Code to execute after *each* test.
*/
@AfterEach
public void tearDown() {
// NOTE: DO **NOT** log out in this method. This method happens because
// the @After method happens immediately after test failure, but before
// the @Rule TestWatcher checks the outcome of the test. We want to take
// a screenshot of the application state **before** logging out.
}

/**
* Code to execute *once* after the class is finished.
*/
Expand Down Expand Up @@ -119,18 +97,12 @@ public static WebDriver driver() {
}

/**
* Method to use on any page to check to ensure that internationalization
* messages are being automatically loaded onto the page.
* Method to use on any page to check to ensure that internationalization messages are being automatically loaded
* onto the page.
*
* @param page
* - the instance of {@link AbstractPage} to check for
* internationalization.
* @param entries
* - a {@link List} of bundle names. This will correspond to the
* loaded webpack bundles.
* @param header
* - Expected text for the main heading on the page. Needs to
* have class name `t-main-heading`
* @param page - the instance of {@link AbstractPage} to check for internationalization.
* @param entries - a {@link List} of bundle names. This will correspond to the loaded webpack bundles.
* @param header - Expected text for the main heading on the page. Needs to have class name `t-main-heading`
*/
public void checkTranslations(AbstractPage page, List<String> entries, String header) {
// Always check for app :)
Expand Down Expand Up @@ -167,6 +139,22 @@ public void testFailed(ExtensionContext context, Throwable t) {
} catch (final IOException e) {
logger.error("Unable to write screenshot out.", e);
}
testFinished();
}

/**
* {@inheritDoc}}
*/
@Override
public void testSuccessful(ExtensionContext context) {
testFinished();
}

/**
* Logout after test has finished executing
*/
private void testFinished() {
LoginPage.logout(driver());
}
}
}
Loading

0 comments on commit e42f30d

Please sign in to comment.