Skip to content

Commit

Permalink
Fixed several bugs (#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
azaslonov authored Mar 11, 2021
1 parent 30e4fe9 commit 08399e5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
17 changes: 14 additions & 3 deletions src/persistence/mapiObjectStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ArmResource } from "../contracts/armResource";
import { AppError } from "../errors";
import { defaultPageSize } from "../constants";
import { PageContract } from "../contracts/page";
import { LocaleModel } from "@paperbits/common/localization";


const localizedContentTypes = ["page", "layout", "blogpost", "navigation", "block"];
Expand Down Expand Up @@ -374,6 +375,18 @@ export class MapiObjectStorage implements IObjectStorage {
const isLocalized = localizedContentTypes.includes(contentType);
const localeSearchPrefix = isLocalized ? `${selectedLocale}/` : "";

if (key === "locales") {
const pageOfLocales: Page<LocaleModel> = {
value: [{
key: `contentTypes/locales/contentItem/en_us`,
code: "en-us",
displayName: "English (US)"
}]
};

return <any>pageOfLocales;
}

try {
let filterQueryString = "";
let orderQueryString = "";
Expand Down Expand Up @@ -422,10 +435,8 @@ export class MapiObjectStorage implements IObjectStorage {
const paperbitsContract = this.convertArmContractToPaperbitsContract(armContract, isLocalized);
return paperbitsContract.nodes;
}
else {
return await this.loadNextPage(resource, localeSearchPrefix, filterQueryString, orderQueryString, 0, isLocalized);

}
return await this.loadNextPage(resource, localeSearchPrefix, filterQueryString, orderQueryString, 0, isLocalized);
}
catch (error) {
throw new AppError(`Could not search object '${key}'. Error: ${error.message}`, error);
Expand Down
10 changes: 8 additions & 2 deletions src/services/oauthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class OAuthService {
* @param backendUrl {string} Portal backend URL.
* @param authorizationServer {AuthorizationServer} Authorization server details.
*/
public authenticateImplicit(backendUrl: string, authorizationServer: AuthorizationServer): Promise<string> {
public authenticateImplicit(backendUrl: string, authorizationServer: AuthorizationServer): Promise<string> {
const redirectUri = `${backendUrl}/signin-oauth/implicit/callback`;
const query = {
state: Utils.guid()
Expand Down Expand Up @@ -120,7 +120,13 @@ export class OAuthService {
}

const oauthToken = await oauthClient.token.getToken(redirectUri + tokenHash);
resolve(`${oauthToken.tokenType} ${oauthToken.accessToken}`);

if (oauthToken.accessToken) {
resolve(`${oauthToken.tokenType} ${oauthToken.accessToken}`);
}
else if (oauthToken.data?.id_token) {
resolve(`Bearer ${oauthToken.data.id_token}`);
}
};

window.addEventListener("message", receiveMessage, false);
Expand Down
12 changes: 12 additions & 0 deletions src/themes/website/styles/widgets/collapsibles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,15 @@
}
}
}

.collapsible-dropdown {
position: absolute;
background: #fff;
box-shadow: 1px 1px 3px 0 rgba(0, 0, 0, 0.5);
z-index: 9000;
padding: 20px;
width: 100%;
top: 100%;
left: 0;
right: 0;
}

0 comments on commit 08399e5

Please sign in to comment.