Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit 0fad1c0

Browse files
authored
chore: remove issues reducers (#51)
1 parent 58e9517 commit 0fad1c0

File tree

5 files changed

+1
-246
lines changed

5 files changed

+1
-246
lines changed

render/actions/issues.actions.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,11 @@ import moment from 'moment';
33

44
import request, { notify } from './helper';
55

6-
export const ISSUES_GET_PAGE = 'ISSUES_GET_PAGE';
76
export const ISSUES_GET = 'ISSUES_GET';
87
export const ISSUES_COMMENTS_SEND = 'ISSUES_COMMENTS_SEND';
98
export const ISSUES_RESET_SELECTION = 'ISSUES_RESET_SELECTION';
109
export const ISSUES_TIME_ENTRY_GET = 'ISSUES_TIME_ENTRY_GET';
1110

12-
const getPage = (filter, pageNumber, batchSize) => (dispatch, getState) => {
13-
const { issues } = getState();
14-
const limit = typeof batchSize === 'number' ? Math.abs(batchSize) : issues.all.limit;
15-
const page = typeof pageNumber === 'number' && pageNumber >= 0 ? pageNumber : issues.all.page;
16-
const offset = page * limit;
17-
let query = {
18-
include: 'attachments,children,relations,journals',
19-
offset,
20-
limit
21-
};
22-
23-
if (filter) {
24-
query = {
25-
...query,
26-
...filter
27-
};
28-
}
29-
30-
dispatch(notify.start(ISSUES_GET_PAGE, { page }));
31-
32-
return request({
33-
url: '/issues.json',
34-
id: `getIssues:${page}`,
35-
query
36-
})
37-
.then(({ data }) => dispatch(notify.ok(ISSUES_GET_PAGE, data, { page })))
38-
.catch((error) => {
39-
// eslint-disable-next-line
40-
console.error('Error when trying to get a list of issues:', error.message);
41-
dispatch(notify.nok(ISSUES_GET_PAGE, error, { page }));
42-
});
43-
};
44-
4511
const get = (id) => (dispatch) => {
4612
dispatch(notify.start(ISSUES_GET));
4713

@@ -126,7 +92,6 @@ const getTimeEntriesPage = (issueId, projectId, pageNumber, batchSize) => (dispa
12692
const resetSelected = () => ({ type: ISSUES_RESET_SELECTION });
12793

12894
export default {
129-
getPage,
13095
get,
13196
getTimeEntriesPage,
13297
sendComments,

render/reducers/__tests__/issues.reducer.spec.js

Lines changed: 0 additions & 156 deletions
This file was deleted.

render/reducers/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { combineReducers } from 'redux';
22
import settingsReducer from './settings.reducer';
3-
import allIssuesReducer from './issues.reducer';
43
import issueReducer from './issue.reducer';
54
import selectedIssueReducer from './issue.selected.reducer';
65
import trackingReducer from './tracking.reducer';
@@ -10,7 +9,6 @@ import timeEntryReducer from './timeEntry.reducer';
109
const appReducer = combineReducers({
1110
settings: settingsReducer,
1211
issues: combineReducers({
13-
all: allIssuesReducer,
1412
selected: selectedIssueReducer
1513
}),
1614
issue: issueReducer,

render/reducers/issues.reducer.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

render/views/__tests__/AppViewPages/SummaryPage.spec.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ThemeProvider } from 'styled-components';
1010

1111
import { theme } from '../../../theme';
1212
import { SummaryPage } from '../../AppViewPages/SummaryPage';
13-
import issueActions, { ISSUES_GET_PAGE } from '../../../actions/issues.actions';
13+
import issueActions from '../../../actions/issues.actions';
1414
import { initialize, getInstance, reset } from '../../../../common/request';
1515

1616
const mockStore = configureStore([thunk]);
@@ -70,7 +70,6 @@ describe('AppView -> Summary Page', () => {
7070
);
7171

7272
expect(spy).toHaveBeenCalled();
73-
expect(store.getActions()[0].type).toBe(ISSUES_GET_PAGE);
7473
expect(store.getActions()[0].info.page).toBe(0);
7574
spy.mockRestore();
7675
});
@@ -116,7 +115,6 @@ describe('AppView -> Summary Page', () => {
116115

117116
setTimeout(() => {
118117
expect(store.getActions().length).toBe(2);
119-
expect(store.getActions().filter((action) => action.type === ISSUES_GET_PAGE).length).toBe(2);
120118
done();
121119
}, 1);
122120
});
@@ -157,7 +155,6 @@ describe('AppView -> Summary Page', () => {
157155
fireEvent.click(getAllByText('Id').pop());
158156
setTimeout(() => {
159157
expect(store.getActions().length).toBe(2);
160-
expect(store.getActions().filter((action) => action.type === ISSUES_GET_PAGE).length).toBe(2);
161158
done();
162159
}, 1);
163160
});
@@ -198,7 +195,6 @@ describe('AppView -> Summary Page', () => {
198195
fireEvent.click(document.querySelector('#queryOptions input:first-child'));
199196
setTimeout(() => {
200197
expect(store.getActions().length).toBe(3);
201-
expect(store.getActions().filter((action) => action.type === ISSUES_GET_PAGE).length).toBe(2);
202198
done();
203199
}, 1);
204200
});

0 commit comments

Comments
 (0)