Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Separate calls for Apps #9263

Merged
merged 39 commits into from
Mar 22, 2022
Merged

Separate calls for Apps #9263

merged 39 commits into from
Mar 22, 2022

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Oct 26, 2021

Summary

Add separate calls for each function on Apps (submit, form source, form submit and lookup). Also updated the filtering with the new logic.

This PR also piggybacks the renaming of markdow and error to text, and filtering out "white space labels" (to avoid no text labels on post options and channel header).

Notes for testing: This is a breaking change. All Apps will need to be updated to work properly. The test app will be updated to fit the new approach.

Ticket Link

https://mattermost.atlassian.net/browse/MM-39092
https://mattermost.atlassian.net/browse/MM-39096
https://mattermost.atlassian.net/browse/MM-31121
https://mattermost.atlassian.net/browse/MM-33532

Related Pull Requests

Apps Plugin: mattermost/mattermost-plugin-apps#296
Mobile: mattermost/mattermost-mobile#5877
Test App: TBD

Release Note

Breaking change for Apps: calls are now separated between submit, form, refresh and lookup calls.

@larkox larkox added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Oct 26, 2021
@DHaussermann
Copy link

@larkox just to confirm - This will create a code dependancy with mattermost/mattermost-plugin-apps#276

We would need to co-ordinate this release with an Apps plugin release. Or Should Apps 0.7.0 continue to work with this Webapp change as well (which obviously I will test for :) )

@larkox
Copy link
Contributor Author

larkox commented Oct 28, 2021

Old apps (and 0.7.0) won't work with this changes. What it is worth trying is that no crashes nor strange artifacts are seen in any 0.7.0 deployment. We might have to test the same about 0.8.0 in "older servers", or bump the minimum required server version.

Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Awesome work @larkox! LGTM, just a few suggestions not directly related to the purpose of the PR

packages/mattermost-redux/src/types/apps.ts Show resolved Hide resolved
packages/mattermost-redux/src/client/client4.ts Outdated Show resolved Hide resolved
actions/apps.ts Outdated Show resolved Hide resolved
actions/apps.ts Outdated
window.open(res.navigate_to_url);
return {data: res};
}
browserHistory.push(res.navigate_to_url.slice(getSiteURL().length));
Copy link
Member

Choose a reason for hiding this comment

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

What if the url is s relative path? I'm also concerned about using a site URL with a subpath cc @DHaussermann

Suggested change
browserHistory.push(res.navigate_to_url.slice(getSiteURL().length));
let navigateURL = res.navigate_to_url;
if (navigateURL.startsWith(getSiteURL())) {
navigateURL = navigateURL.slice(getSiteURL().length);
}
browserHistory.push(navigateURL);

Copy link
Contributor

Choose a reason for hiding this comment

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

@mickmister @hanzei I've been thinking about this, is there a reason to even allow relative URLs here? Even if we want to allow them as apps return values, we can normalize in the server, and consider them valid here. Also need to check the mobile handling.

Copy link
Member

Choose a reason for hiding this comment

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

Even if we want to allow them as apps return values, we can normalize in the server, and consider them valid here

@levb Makes sense to me

@hanzei hanzei added the Do Not Merge Should not be merged until this label is removed label Nov 16, 2021
larkox added a commit to larkox/mattermost-mobile that referenced this pull request Dec 1, 2021
@DHaussermann
Copy link

Tested and passed

  • Regression 0.7.0 Apps plugin with webapp changes. No functional regression or new dev console errors found
  • 0.8.0 Apps plugin works as expected - Some know issues are documented outside the scope of this bindings PR
  • Test-app is functional a couple issues have been documented that have no baring on this bindings webapp change
  • Start the test-app differently. Pass in var INCLUDE-INVALID invalid bindings Run-with-invalid
  • Completed authentication test with Zendesk and hello oAuth2 Apps
  • Quick look over for new latest webapp changes with both v0.7.0 and v0.8.0

@mickmister mickmister merged commit 25f31f5 into mattermost:master Mar 22, 2022
@DHaussermann
Copy link

DHaussermann commented Mar 23, 2022

@amyblais just a heads up that these changes are needed for the March 30 Cloud release and for v6.6

@mickmister can you please make a cherry-pick PR for the cloud branch?

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request CherryPick/Candidate A candidate for a quality or patch release, but not yet approved and removed 3: QA Review Requires review by a QA tester labels Mar 23, 2022
@amyblais
Copy link
Member

/cherry-pick cloud

@mattermod
Copy link
Contributor

Cherry pick is scheduled.

mattermost-build pushed a commit to mattermost-build/mattermost-webapp that referenced this pull request Mar 23, 2022
* WIP - need to restore Binding.Call

* Address missing pieces

* Re-add the submit field on calls and improve tests

* Update i18n

* apps API changes fixup

* apps API changes fixup mattermost#2: form/modal

* Address feedback

* Address feedback

* Fix lint

* Fix missing error->text change

* fix openAppsModal references

* lint, types, and i18n

* lint

* missing method

* update snapshots

* Fixed handleBindingClick, was double-wrapping .data

* fixed embedded button binding

* various fixes

* fix lookups for command parser

* sync app command parser

* types

* fix tests

* change control flow for cleaning bindings

* re-expand bindings when post is updated

* getDerivedStateFromProps to avoid lint rule

* avoid `this` usage in static function

* fix other spot with same issue

Co-authored-by: Lev Brouk <lev@mattermost.com>
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
(cherry picked from commit 25f31f5)
@mattermod mattermod added the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Mar 23, 2022
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Needed Requires documentation and removed CherryPick/Candidate A candidate for a quality or patch release, but not yet approved labels Mar 23, 2022
@amyblais amyblais added this to the v6.6.0 milestone Mar 23, 2022
mattermod added a commit to mattermost-build/mattermost-webapp that referenced this pull request Mar 23, 2022
amyblais pushed a commit that referenced this pull request Mar 23, 2022
* WIP - need to restore Binding.Call

* Address missing pieces

* Re-add the submit field on calls and improve tests

* Update i18n

* apps API changes fixup

* apps API changes fixup #2: form/modal

* Address feedback

* Address feedback

* Fix lint

* Fix missing error->text change

* fix openAppsModal references

* lint, types, and i18n

* lint

* missing method

* update snapshots

* Fixed handleBindingClick, was double-wrapping .data

* fixed embedded button binding

* various fixes

* fix lookups for command parser

* sync app command parser

* types

* fix tests

* change control flow for cleaning bindings

* re-expand bindings when post is updated

* getDerivedStateFromProps to avoid lint rule

* avoid `this` usage in static function

* fix other spot with same issue

Co-authored-by: Lev Brouk <lev@mattermost.com>
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
(cherry picked from commit 25f31f5)

Co-authored-by: Daniel Espino García <larkox@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
mickmister added a commit to mattermost/mattermost-mobile that referenced this pull request Mar 24, 2022
* Port mattermost/mattermost-webapp#9263 to mobile

* Fix forms props from commands and missing error->text change

* lint

* various fixes

* fix lookups for command parser

* update app command parser

* fixes

* fixes with embedded forms

* lint and types

* remove bindings.expanded fix for cleaning bindings on render

* lint

* re-expand bindings on post update

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
@cwarnermm
Copy link
Member

@mickmister - Given that this is a breaking change and that all Apps will need to be updated to work properly, what do we need to communicate in order for others to be successful with this change? Are changes to our app developer documentation needed?

@mickmister
Copy link
Member

Are changes to our app developer documentation needed?

@cwarnermm Yes we are due for doc updates for the Apps framework. I've created a ticket for us to triage next week. Thank you!

Willyfrog pushed a commit to Willyfrog/mattermost-webapp that referenced this pull request May 6, 2022
* WIP - need to restore Binding.Call

* Address missing pieces

* Re-add the submit field on calls and improve tests

* Update i18n

* apps API changes fixup

* apps API changes fixup mattermost#2: form/modal

* Address feedback

* Address feedback

* Fix lint

* Fix missing error->text change

* fix openAppsModal references

* lint, types, and i18n

* lint

* missing method

* update snapshots

* Fixed handleBindingClick, was double-wrapping .data

* fixed embedded button binding

* various fixes

* fix lookups for command parser

* sync app command parser

* types

* fix tests

* change control flow for cleaning bindings

* re-expand bindings when post is updated

* getDerivedStateFromProps to avoid lint rule

* avoid `this` usage in static function

* fix other spot with same issue

Co-authored-by: Lev Brouk <lev@mattermost.com>
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
@cwarnermm
Copy link
Member

@mickmister - Has the apps framework documentation been updated to address the changes introduced in this PR?

@mickmister
Copy link
Member

@cwarnermm Yes, this is being factored in to @neflyte's efforts

@cwarnermm cwarnermm added Docs/Done Required documentation has been written and removed Docs/Needed Requires documentation labels Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone Docs/Done Required documentation has been written release-note
Projects
None yet
9 participants