<commit_before>/**
 *  Copyright (C) 2017 3D Repo Ltd
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { push } from 'connected-react-router';
import { all, put, select, take, takeLatest } from 'redux-saga/effects';

import { ROUTES } from '../../constants/routes';
import { INITIAL_HELICOPTER_SPEED, NEW_PIN_ID, VIEWER_CLIP_MODES, VIEWER_EVENTS } from '../../constants/viewer';
import * as API from '../../services/api';
import { MultiSelect } from '../../services/viewer/multiSelect';
import { Viewer } from '../../services/viewer/viewer';
import { BimActions } from '../bim';
import { CommentsActions } from '../comments';
import { CompareActions } from '../compare';
import { selectCurrentUser, CurrentUserActions } from '../currentUser';
import { DialogActions } from '../dialog';
import { GisActions } from '../gis';
import { GroupsActions } from '../groups';
import { selectIssuesMap, IssuesActions } from '../issues';
import { JobsActions } from '../jobs';
import { MeasurementsActions } from '../measurements';
import { selectCurrentRevisionId, selectSettings, ModelActions, ModelTypes } from '../model';
import { PresentationActions } from '../presentation';
import { selectRisksMap, RisksActions } from '../risks';
import { selectUrlParams } from '../router/router.selectors';
import { SequencesActions } from '../sequences';
import { StarredActions } from '../starred';
import { dispatch } from '../store';
import { TreeActions } from '../tree';
import { selectInitialView, ViewpointsActions, ViewpointsTypes } from '../viewpoints';
import { ViewerGuiActions, ViewerGuiTypes } from './viewerGui.redux';
import {
	selectClipNumber,
	selectHelicopterSpeed,
	selectIsClipEdit,
	selectIsMetadataVisible
} from './viewerGui.selectors';

function* fetchData({ teamspace, model }) {
	try {
		yield put(ModelActions.setPendingState(true));
		const { data: settings } = yield API.getModelSettings(teamspace, model);

		yield put(ModelActions.fetchSettingsSuccess(settings));
		yield put(ModelActions.setPendingState(false));
	} catch (error) {
		yield put(DialogActions.showRedirectToTeamspaceDialog(error));
		return;
	}

	try {
		const { username } = yield select(selectCurrentUser);
		yield all([
			put(CurrentUserActions.fetchUser(username)),
			put(JobsActions.fetchJobs(teamspace)),
			put(JobsActions.getMyJob(teamspace)),
			put(TreeActions.startListenOnSelections()),
			put(ViewerGuiActions.startListenOnClickPin()),
			put(ViewerGuiActions.startListenOnModelLoaded()),
			put(ModelActions.fetchMetaKeys(teamspace, model)),<commit_msg>ISSUE #2596 reinstate model settings fetch via modelActions (#2597)<commit_after>/**
 *  Copyright (C) 2017 3D Repo Ltd
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { push } from 'connected-react-router';
import { all, put, select, take, takeLatest } from 'redux-saga/effects';

import { ROUTES } from '../../constants/routes';
import { INITIAL_HELICOPTER_SPEED, NEW_PIN_ID, VIEWER_CLIP_MODES, VIEWER_EVENTS } from '../../constants/viewer';
import * as API from '../../services/api';
import { MultiSelect } from '../../services/viewer/multiSelect';
import { Viewer } from '../../services/viewer/viewer';
import { BimActions } from '../bim';
import { CommentsActions } from '../comments';
import { CompareActions } from '../compare';
import { selectCurrentUser, CurrentUserActions } from '../currentUser';
import { DialogActions } from '../dialog';
import { GisActions } from '../gis';
import { GroupsActions } from '../groups';
import { selectIssuesMap, IssuesActions } from '../issues';
import { JobsActions } from '../jobs';
import { MeasurementsActions } from '../measurements';
import { selectCurrentRevisionId, selectSettings, ModelActions, ModelTypes } from '../model';
import { PresentationActions } from '../presentation';
import { selectRisksMap, RisksActions } from '../risks';
import { selectUrlParams } from '../router/router.selectors';
import { SequencesActions } from '../sequences';
import { StarredActions } from '../starred';
import { dispatch } from '../store';
import { TreeActions } from '../tree';
import { selectInitialView, ViewpointsActions, ViewpointsTypes } from '../viewpoints';
import { ViewerGuiActions, ViewerGuiTypes } from './viewerGui.redux';
import {
	selectClipNumber,
	selectHelicopterSpeed,
	selectIsClipEdit,
	selectIsMetadataVisible
} from './viewerGui.selectors';

function* fetchData({ teamspace, model }) {
	try {
		const { data: settings } = yield API.getModelSettings(teamspace, model);
	} catch (error) {
		yield put(DialogActions.showRedirectToTeamspaceDialog(error));
		return;
	}

	try {
		const { username } = yield select(selectCurrentUser);
		yield all([
			put(CurrentUserActions.fetchUser(username)),
			put(JobsActions.fetchJobs(teamspace)),
			put(JobsActions.getMyJob(teamspace)),
			put(TreeActions.startListenOnSelections()),
			put(ViewerGuiActions.startListenOnClickPin()),
			put(ViewerGuiActions.startListenOnModelLoaded()),
			put(ModelActions.fetchMetaKeys(teamspace, model)),
			put(ModelActions.fetchSettings(teamspace, model)),
{'fraction_non_alphanumeric': 0.1283549100094727, 'fraction_numerical': 0.0031575623618566467, 'mean_word_length': 4.561896400351185, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1360588', 'n_tokens_mistral': 1839, 'n_tokens_neox': 1758, 'n_words': 559}