Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/handlers/ExecuteBlockActionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,8 @@ export class ExecuteBlockActionHandler {
oAuth2Storage: OAuth2Storage,
roomInteractionStorage: RoomInteractionStorage
) {
const { user } = this.context.getInteractionData();
const PropertyName = `${DatabaseModal.PROPERTY_NAME_ACTION}-${uuid()}`;
const PropertyType = `${
DatabaseModal.PROPERTY_TYPE_SELECT_ACTION
}-${uuid()}`;
const PropertyType = `${DatabaseModal.PROPERTY_TYPE_SELECT_ACTION}-${uuid()}`;

await modalInteraction.storeInteractionActionId({
PropertyType,
Expand Down Expand Up @@ -911,7 +908,7 @@ export class ExecuteBlockActionHandler {
.getInteractionResponder()
.updateModalViewResponse(modal);
}

// update the modal if database is selected
const database = Object as IDatabase;

Expand Down
27 changes: 18 additions & 9 deletions src/lib/NotionSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ export class NotionSDK implements INotionSDK {
cursor?: string
): Promise<Array<IPage> | Error> {
try {
const data = {
filter: {
value: NotionObjectTypes.PAGE,
const data: {
filter?: any;
start_cursor?: string | undefined;
} = {};

if (cursor !== undefined) {
data.start_cursor = cursor;
data.filter = {
value: NotionObjectTypes.DATABASE,
property: NotionObjectTypes.PROPERTY,
},
start_cursor: cursor,
};
}
}

const response = await this.http.post(NotionApi.SEARCH, {
data,
Expand Down Expand Up @@ -507,9 +512,13 @@ export class NotionSDK implements INotionSDK {
cursor?: string
): Promise<Array<IPage | IDatabase> | Error> {
try {
const data = {
start_cursor: cursor,
};
const data: {
start_cursor?: string;
} = {};

if (cursor !== undefined) {
data.start_cursor = cursor;
}

const response = await this.http.post(NotionApi.SEARCH, {
data,
Expand Down
22 changes: 12 additions & 10 deletions src/modals/common/DropDownComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ export function DropDownComponent(
dispatchActionConfig.push(Modals.dispatchActionConfigOnInput);
}

const dropDown = elementBuilder.addDropDown(
{
placeholder,
const inputBlock = blockBuilder.createInputBlock({
text: text,
element: {
type: 'static_select',
blockId: blockId,
options: dropDownOption,
dispatchActionConfig,
initialValue
appId: app.getID(),
actionId: actionId,
placeholder: {
type: 'plain_text',
text: placeholder,
},
dispatchActionConfig: [Modals.dispatchActionConfigOnSelect]
},
{ blockId, actionId }
);
const inputBlock = blockBuilder.createInputBlock({
text,
element: dropDown,
optional: false,
});

Expand Down
22 changes: 13 additions & 9 deletions src/modals/common/searchPageComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@ export async function searchPageComponent(
};
});
const dropDownOption = elementBuilder.createDropDownOptions(options);
const dropDown = elementBuilder.addDropDown(
{
placeholder: SearchPage.PLACEHOLDER,
options: dropDownOption,
dispatchActionConfig: [Modals.dispatchActionConfigOnSelect],
},
{ blockId: SearchPage.BLOCK_ID, actionId }
);
const inputBlock = blockBuilder.createInputBlock({
text: SearchPage.LABEL,
element: dropDown,
element: {
type: 'static_select',
blockId: SearchPage.BLOCK_ID,
options: dropDownOption,
appId: app.getID(),
actionId: actionId,
placeholder: {
type: 'plain_text',
text: SearchPage.PLACEHOLDER,
},
dispatchActionConfig: [Modals.dispatchActionConfigOnSelect]
},
optional: false,
});


return inputBlock;
}
23 changes: 13 additions & 10 deletions src/modals/common/searchPageOrDatabaseComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function searchPageOrDatabaseComponent(

const options: StaticSelectOptionsParam = accesiblePagesAndDatabase.map(
(item) => {

const info = NotionObjectTypes.INFO.toString();
const name = NotionObjectTypes.NAME.toString();

Expand All @@ -51,17 +51,20 @@ export async function searchPageOrDatabaseComponent(
);

const dropDownOption = elementBuilder.createDropDownOptions(options);
const dropDown = elementBuilder.addDropDown(
{
placeholder: SearchPageAndDatabase.PLACEHOLDER,
options: dropDownOption,
dispatchActionConfig: [Modals.dispatchActionConfigOnSelect],
},
{ blockId: SearchPageAndDatabase.BLOCK_ID, actionId }
);
const inputBlock = blockBuilder.createInputBlock({
text: SearchPageAndDatabase.LABEL,
element: dropDown,
element: {
type: 'static_select',
blockId: SearchPageAndDatabase.BLOCK_ID,
options: dropDownOption,
appId: app.getID(),
actionId: actionId,
placeholder: {
type: 'plain_text',
text: SearchPageAndDatabase.PLACEHOLDER,
},
dispatchActionConfig: [Modals.dispatchActionConfigOnSelect]
},
optional: false,
});

Expand Down