Skip to content

Commit dc10f25

Browse files
dhernandez-quoinjtoliver-quoin
authored andcommitted
Merged in r2-3072-click-back-error (pull request #7060)
R2-3072 - Clicking back to "cases to assign" list gives error Approved-by: Joshua Toliver
2 parents b5fe984 + 366242d commit dc10f25

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

app/javascript/components/record-list/selectors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const getAppliedFilters = (state, namespace) =>
1919
export const getAppliedFiltersAsQueryString = (state, namespace) => {
2020
const filters = filtersToQueryString(getAppliedFilters(state, namespace));
2121

22-
return new URLSearchParams(filters).toString();
22+
return filters;
2323
};
2424

2525
export const getLoading = (state, namespace) => state.getIn(getNamespacePath(namespace).concat("loading"), false);

app/javascript/components/record-list/utils/filters-to-query-string.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const paramQueryString = (key, value) => {
1919
}, "");
2020
}
2121

22-
return `${key}=${value}`;
22+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
2323
};
2424

2525
export default filters =>

app/javascript/components/record-list/utils/filters-to-query-string.unit.test.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,32 @@ import filtersToQueryString from "./filters-to-query-string";
77
describe("<RecordList />/utils - filtersToQueryString", () => {
88
it("returns a query string for the filters object", () => {
99
expect(filtersToQueryString(fromJS({ record_state: [true], status: ["open"] }))).to.equals(
10-
"record_state[0]=true&status[0]=open"
10+
"record_state%5B0%5D=true&status%5B0%5D=open"
1111
);
1212
});
1313

1414
it("returns a query string with a value for each element in the array of the filter", () => {
15-
expect(filtersToQueryString(fromJS({ status: ["open", "closed"] }))).to.equals("status[0]=open&status[1]=closed");
15+
expect(filtersToQueryString(fromJS({ status: ["open", "closed"] }))).to.equals(
16+
"status%5B0%5D=open&status%5B1%5D=closed"
17+
);
1618
});
1719

1820
it("returns a query string with a value for each element in the map of the filter", () => {
1921
expect(filtersToQueryString(fromJS({ date: { from: "2010-01-05", to: "2010-01-08" } }))).to.equals(
20-
"date[from]=2010-01-05&date[to]=2010-01-08"
22+
"date%5Bfrom%5D=2010-01-05&date%5Bto%5D=2010-01-08"
2123
);
2224
});
2325

2426
it("returns a query string for a hash with a nested list", () => {
2527
expect(filtersToQueryString(fromJS({ not: { last_updated_by: ["user1", "user2"] }, status: ["open"] }))).to.equals(
26-
"not[last_updated_by][0]=user1&not[last_updated_by][1]=user2&status[0]=open"
28+
"not%5Blast_updated_by%5D%5B0%5D=user1&not%5Blast_updated_by%5D%5B1%5D=user2&status%5B0%5D=open"
2729
);
2830
});
2931

3032
it("returns a query string for a list with hashes", () => {
3133
expect(
3234
filtersToQueryString(fromJS({ not: [{ user_name: "user1" }, { user_name: "user2" }], status: ["open"] }))
33-
).to.equals("not[0][user_name]=user1&not[1][user_name]=user2&status[0]=open");
35+
).to.equals("not%5B0%5D%5Buser_name%5D=user1&not%5B1%5D%5Buser_name%5D=user2&status%5B0%5D=open");
3436
});
3537

3638
it("returns a query string for a list with nested lists", () => {
@@ -45,7 +47,14 @@ describe("<RecordList />/utils - filtersToQueryString", () => {
4547
})
4648
)
4749
).to.equals(
48-
"user_name[0][0]=user1&user_name[0][1]=user2&user_name[1][0]=user3&user_name[1][1]=user4&status[0]=open"
50+
"user_name%5B0%5D%5B0%5D=user1&user_name%5B0%5D%5B1%5D=user2" +
51+
"&user_name%5B1%5D%5B0%5D=user3&user_name%5B1%5D%5B1%5D=user4&status%5B0%5D=open"
4952
);
5053
});
54+
55+
it("returns a query string for a date range with positive time zone", () => {
56+
expect(
57+
filtersToQueryString(fromJS({ created_at: ["1970-01-01T00:00:00+00:00..2025-02-17T20:04:54+00:00"] }))
58+
).to.equals("created_at%5B0%5D=1970-01-01T00%3A00%3A00%2B00%3A00..2025-02-17T20%3A04%3A54%2B00%3A00");
59+
});
5160
});

0 commit comments

Comments
 (0)