-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[MM-50111] Use /install-listed
path directly to install marketplace apps
#12079
Conversation
E2E tests not automatically triggered, because PR has no approval yet. Please ask a developer to review and then try again to attach the QA label. |
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.
Thanks for cleanin up my messy code 👍
I leave a few comment, but nothing blocking.
actions/marketplace.ts
Outdated
const channelID = getCurrentChannelId(state); | ||
const teamID = getCurrentTeamId(state); | ||
const context = createCallContext('apps', '/marketplace', channelID, teamID); |
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.
Is /marketplace
the location here? What is the location used in other form calls?
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.
@hanzei Yes I kind of made this new location up here. The location in other form calls would be something like /command/jira/issue/create
. 0/5 on what the location should be here, or if we should include one at all
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.
Can we just not use a location at all?
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.
@hanzei I think there are tradeoffs between including or not including a location. I think we have the convention that all calls come from a location, but I think that can be avoided in this case. Do you see value in including the location? We can instead have it be an empty string.
|
||
const callResp = res.data!; | ||
if (callResp.type === AppCallResponseTypes.FORM && callResp.form) { | ||
dispatch(openAppsModal(callResp.form, creq.context)); | ||
} | ||
|
||
if (callResp.text) { | ||
dispatch(postEphemeralCallResponseForContext(callResp, callResp.text, context)); | ||
} | ||
|
||
return true; |
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.
Can we de-duplicate the code used here? Is there a way to throw the call response in the normal event pipeline?
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.
@hanzei We purposely have the logic different in each binding location case, so special cases can easily be handled. We could have a "default" handler to be used that does these sort of actions shown above. A "nothing special" call response handler function
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.
I think this is out of scope of this PR though.
There is an improvement I made in the mobile app for this https://github.com/mattermost/mattermost-mobile/blob/aa6c1ff0583751085967c9fdffd67789f7b24421/app/hooks/apps.ts#L21-L26
export type UseAppBindingConfig = {
onSuccess: (callResponse: AppCallResponse, message: string) => void;
onError: (callResponse: AppCallResponse, message: string) => void;
onForm?: (form: AppForm) => void;
onNavigate?: (callResp: AppCallResponse) => void;
}
This allows the caller to supply at least onSuccess
and onError
, and things like opening a form is done automatically. I made a ticket to add this to the webapp https://mattermost.atlassian.net/browse/MM-50197
/update-branch |
/install-listed
path directly to install marketplace apps/install-listed
path directly to install marketplace apps
/install-listed
path directly to install marketplace apps/install-listed
path directly to install marketplace apps
…attermost/mattermost-webapp into marketplace-install-listed-app
/update-branch |
@levb @DHaussermann Kind note to prioritize this PR review if this is needed for v7.8. |
@mickmister can you clarify if this will have a code dependancy on what version of the Apps framework plugin is running? Or would existing version of the Apps framework also be functional with this code change? I can of course test this - I'm just curious about the expected behavior here. |
@DHaussermann This change is backwards compatible with the framework. No changes are needed on the framework side |
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.
I don't understand the apps logic enough to review that fully, but the code itself looks good to me from what I can tell
/update-branch |
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.
Tested and passed
- Tested that marketplace install button works consistently now
- Cloud license and non-cloud license
- Apps
1.2.0
as well as newest1.2.1
(not yet released) - In all cases the marketplace UI button works now
- Regression tested installing via command line as a precaution
- Regression tested HTTP installs as a precaution
LGTM!
Summary
As we are transitioning to support HTTP apps in Cloud servers, we need to have a consistent install path across all environments.
At the moment, the frontend has conditional logic of how to install marketplace apps. This PR makes it so the App framework can instead have this logic.
Ticket Link
Fixes https://mattermost.atlassian.net/browse/MM-50111