-
Notifications
You must be signed in to change notification settings - Fork 25
[ Bug ] Removed emojis from the app #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
9c67f0e
7f75205
da8f382
af90315
2a4ca7a
eed2116
56b7798
b7b34b7
77d9103
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -218,15 +218,15 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| if (response instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(response); | ||||||||||||||||
| message = `🚫 Something went wrong while creating Database in **${workspace_name}**.`; | ||||||||||||||||
| message = `Something went wrong while creating Database in **${workspace_name}**.`; | ||||||||||||||||
|
|
||||||||||||||||
| await sendNotification(this.read, this.modify, user, room, { | ||||||||||||||||
| message: message, | ||||||||||||||||
| }); | ||||||||||||||||
| } else { | ||||||||||||||||
| const name: string = response.name; | ||||||||||||||||
| const link: string = response.link; | ||||||||||||||||
| message = `✨ Your Database [**${name}**](${link}) is created successfully in **${workspace_name}**.`; | ||||||||||||||||
| message = `Your Database [**${name}**](${link}) is created successfully in **${workspace_name}**.`; | ||||||||||||||||
|
|
||||||||||||||||
| await sendNotificationWithAttachments( | ||||||||||||||||
| this.read, | ||||||||||||||||
|
|
@@ -341,6 +341,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| const parentType: string = parent.type; | ||||||||||||||||
|
|
||||||||||||||||
| if (parentType.includes(NotionObjectTypes.PAGE_ID)) { | ||||||||||||||||
|
|
||||||||||||||||
| return this.handleCreationOfPage( | ||||||||||||||||
| tokenInfo, | ||||||||||||||||
| room, | ||||||||||||||||
|
|
@@ -349,7 +350,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| Objects as IPage | ||||||||||||||||
| ); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| return this.handleCreationOfRecord( | ||||||||||||||||
| tokenInfo, | ||||||||||||||||
| room, | ||||||||||||||||
|
|
@@ -384,10 +385,10 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| if (createdPage instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(createdPage.message); | ||||||||||||||||
| message = `🚫 Something went wrong while creating page in **${workspace_name}**.`; | ||||||||||||||||
| message = `Something went wrong while creating page in **${workspace_name}**.`; | ||||||||||||||||
| } else { | ||||||||||||||||
| const { name, link, title, pageId } = createdPage; | ||||||||||||||||
| message = `✨ Your Page [**${title}**](${link}) is created successfully as a subpage in **${name}**.`; | ||||||||||||||||
| message = `Your Page [**${title}**](${link}) is created successfully as a subpage in **${name}**.`; | ||||||||||||||||
|
|
||||||||||||||||
| const preserveMessage = await modalInteraction.getInputElementState( | ||||||||||||||||
| ActionButton.SEND_TO_NEW_PAGE_MESSAGE_ACTION | ||||||||||||||||
|
|
@@ -410,7 +411,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| if (appendBlock instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(appendBlock.message); | ||||||||||||||||
| message = `🚫 Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| message = `Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| await sendNotification(this.read, this.modify, user, room, { | ||||||||||||||||
| message, | ||||||||||||||||
| }); | ||||||||||||||||
|
|
@@ -430,7 +431,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| )) as ICredential; | ||||||||||||||||
|
|
||||||||||||||||
| const messageLink = `${siteUrl}/${urlPath}/${displayName}?msg=${id}`; | ||||||||||||||||
| const preserveText = `📝 Created New Page [**${title}**](${link}) and Preserved Following [Message](${messageLink}) `; | ||||||||||||||||
| const preserveText = `Created New Page [**${title}**](${link}) and Preserved Following [Message](${messageLink}) `; | ||||||||||||||||
|
|
||||||||||||||||
| await sendMessage( | ||||||||||||||||
| this.read, | ||||||||||||||||
|
|
@@ -463,6 +464,13 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| const { NotionSdk } = this.app.getUtils(); | ||||||||||||||||
| const { access_token, workspace_name, owner } = tokenInfo; | ||||||||||||||||
| const username = owner.user.name; | ||||||||||||||||
| const newDatabase = { | ||||||||||||||||
| ...database, | ||||||||||||||||
| info: { | ||||||||||||||||
| name: database.info.name.replace("📚 ",""), | ||||||||||||||||
| link: database.info.link, | ||||||||||||||||
| }, | ||||||||||||||||
| } | ||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe, you overriding this due to when sending message to channel it was showing 📚. can't directly we can have
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that is better. I am making the changes. |
||||||||||||||||
|
|
||||||||||||||||
| const properties = (await modalInteraction.getInputElementState( | ||||||||||||||||
| SearchPageAndDatabase.ACTION_ID | ||||||||||||||||
|
|
@@ -479,20 +487,20 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| const createdRecord = await NotionSdk.createRecord( | ||||||||||||||||
| access_token, | ||||||||||||||||
| database, | ||||||||||||||||
| newDatabase, | ||||||||||||||||
| data | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| let message: string; | ||||||||||||||||
|
|
||||||||||||||||
| if (createdRecord instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(createdRecord.message); | ||||||||||||||||
| message = `🚫 Something went wrong while creating record in **${workspace_name}**.`; | ||||||||||||||||
| message = `Something went wrong while creating record in **${workspace_name}**.`; | ||||||||||||||||
| await sendNotification(this.read, this.modify, user, room, { | ||||||||||||||||
| message, | ||||||||||||||||
| }); | ||||||||||||||||
| } else { | ||||||||||||||||
| const { info } = database; | ||||||||||||||||
| const { info } = newDatabase; | ||||||||||||||||
| const databasename = info.name; | ||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, as i mentioned above.
Suggested change
|
||||||||||||||||
| const databaselink = info.link; | ||||||||||||||||
| const title: string = | ||||||||||||||||
|
|
@@ -501,7 +509,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| ]; | ||||||||||||||||
| const { fields, url, pageId } = createdRecord; | ||||||||||||||||
|
|
||||||||||||||||
| message = `✨ Created [**${title}**](${url}) in [**${databasename}**](${databaselink})`; | ||||||||||||||||
| message = `Created [**${title}**](${url}) in [**${databasename}**](${databaselink})`; | ||||||||||||||||
|
|
||||||||||||||||
| const messageId = await sendMessageWithAttachments( | ||||||||||||||||
| this.read, | ||||||||||||||||
|
|
@@ -533,7 +541,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| if (appendBlock instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(appendBlock.message); | ||||||||||||||||
| message = `🚫 Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| message = `Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| await sendNotification(this.read, this.modify, user, room, { | ||||||||||||||||
| message, | ||||||||||||||||
| }); | ||||||||||||||||
|
|
@@ -554,7 +562,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| )) as ICredential; | ||||||||||||||||
|
|
||||||||||||||||
| const messageLink = `${siteUrl}/${urlPath}/${displayName}?msg=${id}`; | ||||||||||||||||
| const preserveText = `📝 Created [**${title}**](${url}) Page and Preserved Following [Message](${messageLink}) `; | ||||||||||||||||
| const preserveText = `Created [**${title}**](${url}) Page and Preserved Following [Message](${messageLink}) `; | ||||||||||||||||
|
|
||||||||||||||||
| await sendMessage( | ||||||||||||||||
| this.read, | ||||||||||||||||
|
|
@@ -814,7 +822,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| const { name, parent, url } = pageInfo; | ||||||||||||||||
|
|
||||||||||||||||
| const message = `✨ Sharing [**${name}**](${url}) from **${workspace_name}**`; | ||||||||||||||||
| const message = `Sharing [**${name}**](${url}) from **${workspace_name}**`; | ||||||||||||||||
|
|
||||||||||||||||
| await sendMessage(this.read, this.modify, user, room, { | ||||||||||||||||
| message, | ||||||||||||||||
|
|
@@ -878,7 +886,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
|
|
||||||||||||||||
| if (appendBlock instanceof Error) { | ||||||||||||||||
| this.app.getLogger().error(appendBlock.message); | ||||||||||||||||
| const message = `🚫 Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| const message = `Something went wrong while appending message in **${workspace_name}**.`; | ||||||||||||||||
| await sendNotification(this.read, this.modify, user, room, { | ||||||||||||||||
| message, | ||||||||||||||||
| }); | ||||||||||||||||
|
|
@@ -913,7 +921,7 @@ export class ExecuteViewSubmitHandler { | |||||||||||||||
| )) as ICredential; | ||||||||||||||||
|
|
||||||||||||||||
| const messageLink = `${siteUrl}/${urlPath}/${displayName}?msg=${id}`; | ||||||||||||||||
| const preserveText = `📝 Preserved Following [Message](${messageLink}) in [**${name}**](${url}) `; | ||||||||||||||||
| const preserveText = `Preserved Following [Message](${messageLink}) in [**${name}**](${url}) `; | ||||||||||||||||
|
|
||||||||||||||||
| await sendMessage( | ||||||||||||||||
| this.read, | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -15,6 +15,7 @@ export function getSelectDatabaseLayout( | |||
|
|
||||
| const database_name = properties.name; | ||||
| const database_url = properties.link; | ||||
| const databaseNameWithoutEmoji = database_name.replace("📚 ", "") | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can directly replace emoji in
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad |
||||
|
|
||||
| const elementBuilder = new ElementBuilder(appId); | ||||
| const blockBuilder = new BlockBuilder(appId); | ||||
|
|
@@ -26,8 +27,8 @@ export function getSelectDatabaseLayout( | |||
| : undefined; | ||||
| const thumb = workspace_icon_url ? { url: workspace_icon_url } : undefined; | ||||
| const title = [ | ||||
| `**📋 Database Name**`, | ||||
| `[**${database_name}**](${database_url})`, | ||||
| `**Database Name**`, | ||||
| `[**${databaseNameWithoutEmoji}**](${database_url})`, | ||||
| ]; | ||||
| const description = [""]; | ||||
| const avatarElement = elementBuilder.addImage({ | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -120,7 +120,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
|
|
||||||||||||||
| const result: Array<IPage> = []; | ||||||||||||||
| results.forEach(async (item) => { | ||||||||||||||
| const pageObject = await this.getPageObjectFromResults(item); | ||||||||||||||
| const pageObject = await this.getPageObjectFromResults(item, false); | ||||||||||||||
| if (pageObject) { | ||||||||||||||
| result.push(pageObject); | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -132,7 +132,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| private async getPageObjectFromResults(item): Promise<IPage | null> { | ||||||||||||||
| private async getPageObjectFromResults(item, emoji:boolean=false): Promise<IPage | null> { | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you are making changes in this file with suggestions, make a indentation with other methods too which has default value of emoji.
Suggested change
|
||||||||||||||
| const typesWithTitleProperty = [ | ||||||||||||||
| NotionObjectTypes.WORKSPACE.toString(), | ||||||||||||||
| NotionObjectTypes.PAGE_ID.toString(), | ||||||||||||||
|
|
@@ -145,7 +145,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| const pageName: string = | ||||||||||||||
| properties.title.title[0]?.text?.content || | ||||||||||||||
| NotionObjectTypes.UNTITLED; | ||||||||||||||
| return this.returnPage(pageName, pageId); | ||||||||||||||
| return this.returnPage(pageName, pageId, emoji); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // title property either be at first or last position | ||||||||||||||
|
|
@@ -161,7 +161,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| const name: string = | ||||||||||||||
| properties[firstColumn].title[0]?.text?.content || | ||||||||||||||
| NotionObjectTypes.UNTITLED; | ||||||||||||||
| return this.returnPage(name, pageId); | ||||||||||||||
| return this.returnPage(name, pageId, emoji); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| //title at last position and has subpage | ||||||||||||||
|
|
@@ -172,15 +172,15 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| const name: string = | ||||||||||||||
| properties[lastColumn].title[0]?.text?.content || | ||||||||||||||
| NotionObjectTypes.UNTITLED; | ||||||||||||||
| return this.returnPage(name, pageId); | ||||||||||||||
| return this.returnPage(name, pageId, emoji); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return null; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| private returnPage(name: string, page_id: string): IPage { | ||||||||||||||
| private returnPage(name: string, page_id: string, emoji: boolean=false): IPage { | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
| return { | ||||||||||||||
| name: `📄 ${name}`, | ||||||||||||||
| name: `${emoji ? "📄" : ""} ${name}`, | ||||||||||||||
| parent: { | ||||||||||||||
| type: NotionObjectTypes.PAGE_ID, | ||||||||||||||
| page_id, | ||||||||||||||
|
|
@@ -520,15 +520,16 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| const objectType: string = item?.[NotionObjectTypes.OBJECT]; | ||||||||||||||
| if (objectType.includes(NotionObjectTypes.PAGE)) { | ||||||||||||||
| const pageObject = await this.getPageObjectFromResults( | ||||||||||||||
| item | ||||||||||||||
| item, | ||||||||||||||
| true | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| if (pageObject) { | ||||||||||||||
| result.push(pageObject); | ||||||||||||||
| } | ||||||||||||||
| } else { | ||||||||||||||
| const databaseObject = | ||||||||||||||
| await this.getDatabaseObjectFromResults(item); | ||||||||||||||
| await this.getDatabaseObjectFromResults(item, true); | ||||||||||||||
|
|
||||||||||||||
| result.push(databaseObject); | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -540,7 +541,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| private async getDatabaseObjectFromResults(item): Promise<IDatabase> { | ||||||||||||||
| private async getDatabaseObjectFromResults(item, emoji:boolean=false): Promise<IDatabase> { | ||||||||||||||
| const databaseNameTitleObject = item?.[NotionObjectTypes.TITLE]; | ||||||||||||||
| const name: string = databaseNameTitleObject.length | ||||||||||||||
| ? databaseNameTitleObject[0]?.plain_text | ||||||||||||||
|
|
@@ -549,7 +550,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
|
|
||||||||||||||
| return { | ||||||||||||||
| info: { | ||||||||||||||
| name: `📚 ${name}`, | ||||||||||||||
| name: `${emoji ? "📚":""} ${name}`, | ||||||||||||||
| link: item?.url, | ||||||||||||||
| }, | ||||||||||||||
| parent: { | ||||||||||||||
|
|
@@ -567,6 +568,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| try { | ||||||||||||||
| const { name, parent } = page; | ||||||||||||||
| const { title } = prop; | ||||||||||||||
| const nameWithoutEmoji = name.replace("📄", ""); | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can avoid long variable name here, make neccessary changes which would affect this below.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oki |
||||||||||||||
|
|
||||||||||||||
| const data = { | ||||||||||||||
| parent, | ||||||||||||||
|
|
@@ -597,7 +599,7 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
|
|
||||||||||||||
| let result: INotionPage = { | ||||||||||||||
| link: response?.data?.url, | ||||||||||||||
| name, | ||||||||||||||
| name: nameWithoutEmoji, | ||||||||||||||
| title, | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -989,7 +991,8 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
|
|
||||||||||||||
| const pageInfo = response.data; | ||||||||||||||
| const page = (await this.getPageObjectFromResults( | ||||||||||||||
| pageInfo | ||||||||||||||
| pageInfo, | ||||||||||||||
| false | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oki making the changes |
||||||||||||||
| )) as IPage; | ||||||||||||||
| const url: string = pageInfo?.url; | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -1089,7 +1092,8 @@ export class NotionSDK implements INotionSDK { | |||||||||||||
| results.forEach(async (item) => { | ||||||||||||||
| const objectType: string = item?.[NotionObjectTypes.OBJECT]; | ||||||||||||||
| const databaseObject = await this.getDatabaseObjectFromResults( | ||||||||||||||
| item | ||||||||||||||
| item, | ||||||||||||||
| false | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| result.push(databaseObject); | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add the emojis in the documentation?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, revert changes of docs.