fix(fe/state_updater): initAll always returns error for unauthed users
This commit is contained in:
parent
df801a9397
commit
87832ee1b2
2 changed files with 22 additions and 9 deletions
|
@ -541,7 +541,7 @@ export class FilesPanel extends React.Component<Props, State, {}> {
|
|||
<span onClick={() => this.select(item.name)} className="float-l">
|
||||
{isSelected
|
||||
? getIcon("RiCheckboxFill", "1.8rem", "cyan0")
|
||||
: getIcon("RiCheckboxBlankFill", "1.8rem", "grey1")}
|
||||
: getIcon("RiCheckboxBlankFill", "1.8rem", "black1")}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
|
@ -550,13 +550,13 @@ export class FilesPanel extends React.Component<Props, State, {}> {
|
|||
onClick={() => this.toggleDetail(item.name)}
|
||||
className="float-l"
|
||||
>
|
||||
{getIcon("RiInformationFill", "1.8rem", "grey1")}
|
||||
{getIcon("RiInformationFill", "1.8rem", "black1")}
|
||||
</span>
|
||||
|
||||
<span onClick={() => this.select(item.name)} className="float-l">
|
||||
{isSelected
|
||||
? getIcon("RiCheckboxFill", "1.8rem", "cyan0")
|
||||
: getIcon("RiCheckboxBlankFill", "1.8rem", "grey1")}
|
||||
: getIcon("RiCheckboxBlankFill", "1.8rem", "black1")}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -413,8 +413,11 @@ export class Updater {
|
|||
syncCwd = async (): Promise<string> => {
|
||||
if (this.props.filesInfo.dirPath.size !== 0) {
|
||||
return this.setItems(this.props.filesInfo.dirPath);
|
||||
} else if (this.props.login.authed) {
|
||||
return this.setHomeItems();
|
||||
}
|
||||
return this.setHomeItems();
|
||||
// cwd will not be synced if the user is not authned and without sharing mode
|
||||
return "";
|
||||
};
|
||||
|
||||
initCwd = async (params: URLSearchParams): Promise<string> => {
|
||||
|
@ -445,18 +448,26 @@ export class Updater {
|
|||
return isAuthedStatus;
|
||||
}
|
||||
|
||||
const getCapStatus = await this.getCaptchaID();
|
||||
if (getCapStatus !== "") {
|
||||
return getCapStatus;
|
||||
}
|
||||
|
||||
const selfStatuses = await Promise.all([this.self(), this.initCwd(params)]);
|
||||
if (selfStatuses.join("") !== "") {
|
||||
return selfStatuses.join(";");
|
||||
}
|
||||
|
||||
const getCapStatus = await this.getCaptchaID();
|
||||
if (getCapStatus !== "") {
|
||||
return getCapStatus;
|
||||
}
|
||||
|
||||
this.initUITree();
|
||||
|
||||
const isInSharingMode = this.props.ui.control.controls.get(sharingCtrl);
|
||||
if (
|
||||
this.props.login.userRole === roleVisitor &&
|
||||
isInSharingMode !== ctrlOn
|
||||
) {
|
||||
return this.initStateForVisitor();
|
||||
}
|
||||
|
||||
const cwdStatus = await this.syncCwd();
|
||||
if (cwdStatus !== "") {
|
||||
return cwdStatus;
|
||||
|
@ -472,6 +483,7 @@ export class Updater {
|
|||
if (this.props.login.userRole === roleAdmin) {
|
||||
return this.initStateForAdmin();
|
||||
} else if (this.props.login.userRole === roleVisitor) {
|
||||
// visitor under sharing mode
|
||||
return this.initStateForVisitor();
|
||||
}
|
||||
return this.initStateForAuthedUser();
|
||||
|
@ -514,6 +526,7 @@ export class Updater {
|
|||
this.props.login.preferences = resp.data.preferences;
|
||||
return "";
|
||||
} else if (resp.status === 401) {
|
||||
this.resetUser();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue