-
Notifications
You must be signed in to change notification settings - Fork 5
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
added a feature of quick create from the input box itself.. #23
base: main
Are you sure you want to change the base?
Conversation
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 is alot of thing's that make no sense, try to make a PR that is clear and not bloated it, Ideally a PR should not have move then 200-300 line of code.
src/commands/CommandUtility.ts
Outdated
IModify, | ||
IPersistence, | ||
IRead, | ||
IHttp, |
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.
remove these spaces
src/commands/CommandUtility.ts
Outdated
public persis: IPersistence; | ||
public triggerId?: string; | ||
public threadId?: string; | ||
public app: QuickRepliesApp; |
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.
remove
src/commands/CommandUtility.ts
Outdated
const subCommand = this.params[0].toLowerCase(); | ||
|
||
if ( | ||
subCommand === CommandParam.CREATE || |
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.
why are we creating team in all the command ? explain me this
src/commands/CommandUtility.ts
Outdated
await this.handleSingleParam(handler); | ||
break; | ||
} | ||
default: { |
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.
this should not be in default
src/commands/CommandUtility.ts
Outdated
} | ||
} | ||
} | ||
private async handleQuickCreate(handler: Handler, args: string[]): Promise<void> { |
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.
we already handled default cases
); | ||
|
||
if (args.length < 3) { | ||
await sendUsageMessage(modify, room, sender); |
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.
what is this ?
src/handlers/Handler.ts
Outdated
return; | ||
} | ||
} | ||
public app: QuickRepliesApp; |
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.
too much bloated code remove all these spaces
room: IRoom, | ||
user: IUser, | ||
): Promise<void> { | ||
const text = '/quick-create <replyName> "<replyBody>"'; |
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.
why we have this code ?
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.
Make requested changes
9612a78
to
db79d2c
Compare
Hi @VipinDevelops so i reflected the changes you asked for and made them as per the requirements Note |
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 is still a lot of room for improvement basically you are repeating a lot of code and not following best practice.
@@ -77,7 +77,13 @@ export class CommandUtility implements ICommandUtility { | |||
break; | |||
} | |||
default: { | |||
await handler.sendDefault(); | |||
const subCommand = this.params[0].toLowerCase(); |
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.
you don't have to put this in switch case you can handle this in global
src/commands/CommandUtility.ts
Outdated
@@ -107,4 +113,23 @@ export class CommandUtility implements ICommandUtility { | |||
} | |||
} | |||
} | |||
|
|||
private async handleQuickCreate(handler: Handler, args: string[]): Promise<void> { |
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.
why dont use the function we already have for creating new replies ?
src/commands/CommandUtility.ts
Outdated
return; | ||
} | ||
|
||
switch (args[0].toLowerCase()) { |
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.
why switch case in a function that is made to create a reply ?
src/commands/CommandUtility.ts
Outdated
await handler.CreateQuickReply(args); | ||
break; | ||
} | ||
default: { |
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.
this is the third place where you please .sendDefault() is there any other way to achieve check without repeating this
src/handlers/Handler.ts
Outdated
@@ -206,4 +207,20 @@ export class Handler implements IHandler { | |||
return; | |||
} | |||
} | |||
public async CreateQuickReply(args: string[]): Promise<void> { |
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.
we do have a method already for this
Also, update the documentation accordingly. |
db79d2c
to
7d8d7b0
Compare
hey @VipinDevelops made changes as you asked..! now i believe the code looks much cleaner to be merged... |
Hey @not-meet Can you explain a little about changes you have made and use the code we have already for creating replies I have seen you writing some code again that already exist Either reuse the function we have or make something new that can be use in both old and new code. |
hey!! @VipinDevelops I wrote new logic instead of modifying the existing modal to avoid conflicts. While I understand the concern about calling the handler in the default switch case instead of passing it globally, doing so avoids issues where the global call still triggers the switch case unintentionally. |
Issue(s)
Closes #22
##This PR introduces a new feature that allows users to create quick replies directly from the message input box using the /quick create command, eliminating the need for an input modal.
Acceptance Criteria fulfillment
Proposed changes (including videos or screenshots)
/quick create
Demo
Screencast from 2024-11-22 10-32-50.webm
up for any changes and learning :)