Skip to content
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

[BREAK] Change apps/icon endpoint to return app's icon and use it to show on Ui Kit modal #16522

Merged
merged 4 commits into from
Feb 8, 2020

Conversation

sampaiodiego
Copy link
Member

Use the endpoint to show app's icon instead of returning it via websockets

@@ -516,6 +516,33 @@ export class AppsRestApi {
},
});

this.api.addRoute('icon/:id', { authRequired: false }, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I can be hated for this because there is another endpoint :id/icon already: https://github.com/RocketChat/Rocket.Chat/pull/16522/files#diff-1d7b87614deb7cd95b3cfaa7420842a7R506

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the other one is not used anywhere? 🤔 I think I've searched for it before and haven't found anything. If that's the case, you can just change the behavior of the other one 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're targeting a major version, I could introduce this breaking change.

@@ -134,7 +133,7 @@ export const modalBlockWithContext = ({
<Modal open id={id} ref={ref}>
<Modal.Header>
{/* <Modal.Thumb url={`api/apps/${ context.appId }/icon`} /> */}
<Modal.Thumb url={thumb} />
<Modal.Thumb url={`/api/apps/icon/${ data.appId }`} />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the best way to get the full URL, pls advice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a context to set the prefix path

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found:

export const useAbsoluteUrl = () => useContext(ServerContext).absoluteUrl;

but looks like I cannot use it because you're not using ServerProvider that implements it:

export function ServerProvider({ children }) {

what should I do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk the advantages using a context, so I changed to use getURL that is widely used.

@ggazzo
Copy link
Member

ggazzo commented Feb 7, 2020

My hero

@sampaiodiego sampaiodiego added this to the 3.0.0 milestone Feb 8, 2020
@sampaiodiego sampaiodiego changed the title Use new endpoint to get app icon [BREAK] Change apps/icon endpoint to return app's icon and use it to show on Ui Kit modal Feb 8, 2020
const { name, iconFileContent } = app.getInfo();

Object.assign(interaction, {
appInfo: { name, base64Icon: iconFileContent },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

༼ つ ◕_◕ ༽つ name

@ggazzo ggazzo merged commit 6942609 into develop Feb 8, 2020
@ggazzo ggazzo deleted the improve-app-icon branch February 8, 2020 20:26
gabriellsh added a commit to ritwizsinha/Rocket.Chat that referenced this pull request Feb 13, 2020
…5997-ritwizsinha-15996

* 'develop' of github.com:RocketChat/Rocket.Chat: (181 commits)
  Update Livechat widget dependency version to 1.3.1. (RocketChat#16580)
  Update Apps-Engine version (RocketChat#16584)
  [FIX] Error when successfully joining room by invite link (RocketChat#16571)
  Add breaking notice regarding TLS (RocketChat#16575)
  [FIX] Invite links proxy URLs not working when using CDN (RocketChat#16581)
  Regression: Modal onSubmit (RocketChat#16556)
  Regression: UIkit input states (RocketChat#16552)
  [FIX] Do not stop on DM imports if one of users was not found (RocketChat#16547)
  [FIX] Introduce AppLivechatBridge.isOnlineAsync method (RocketChat#16467)
  Regression: UIKit missing select states: error/disabled (RocketChat#16540)
  [BREAK] Change apps/icon endpoint to return app's icon and use it to show on Ui Kit modal (RocketChat#16522)
  Regression: update package-lock (RocketChat#16528)
  Regression: Update Uikit (RocketChat#16515)
  Regression: UIKit - Send container info on block actions triggered on a message (RocketChat#16514)
  Use base64 for import files upload to prevent file corruption (RocketChat#16516)
  Regression: Ui Kit messaging issues RocketChat#16513
  Regression: Send app info along with interaction payload to the UI (RocketChat#16511)
  Fix: License missing from manual register handler (RocketChat#16505)
  Exclude federated and app users from active user count (RocketChat#16489)
  Remove users.info being called without need (RocketChat#16504)
  ...
@sampaiodiego sampaiodiego mentioned this pull request Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants