Commit graph

46 commits

Author SHA1 Message Date
Travis Ralston
1d9d0cd7be Convert a bunch more js-sdk imports to absolute paths
Turns out a lot of the typescript warnings about improper warnings were correct. TypeScript appears to be pulling in two copies of the js-sdk when we do this, which can lead to type conflicts (or worse: the wrong code entirely). We fix this at the webpack level by explicitly importing from `src`, but some alternative build structures have broken tests because of this - jest ends up pulling in the "wrong" js-sdk, breaking things.
2021-03-18 20:50:34 -06:00
Travis Ralston
35dd892dce
Merge pull request #4458 from matrix-org/travis/fix-sticker-picker-add
Use WidgetType more often to avoid breaking new sticker pickers
2020-04-23 08:18:12 -06:00
Travis Ralston
3a360b91b9 Update logging for unmanaged widgets, and add TODO comments for other areas
Just a minor thing that is bothersome. Renaming classes and functions is a bit more of an impact than is worth right now, so have settled for littering TODO comments all over the place.
2020-04-22 00:34:08 -06:00
Travis Ralston
f54e99c708 Use WidgetType more often to avoid breaking new sticker pickers
Turns out that setUserWidget() wasn't updated to take a real WidgetType, but the code in ScalarMessaging thought it did. This leads to integration managers trying to add sticker widgets with an object `type` rather than a string `type`, which doesn't work.

This updates other code paths which call into the various widget classes to use WidgetType more often. The actual code path for fixing widgets is resolved in WidgetUtils for the setUserWidget function body.
2020-04-21 16:01:10 -06:00
Travis Ralston
f1ac3d2f64 Convert imports to ES6 from CommonJS
This is needed because `require()` means something different in webpack - it ends up importing the module as something we didn't expect (and is occasionally async)
2019-12-22 21:16:06 -07:00
Travis Ralston
042bd35d79 Fix MatrixClientPeg imports 2019-12-22 21:15:54 -07:00
Travis Ralston
a5dadda63b Convert SdkConfig to TypeScript as a proof of concept 2019-12-12 14:37:32 -07:00
Michael Telatynski
d4d51dc61f Rip out the remainder of Bluebird 2019-11-18 10:03:05 +00:00
Travis Ralston
ffa49df889 Refactor integration manager handling into a common place
It was already in a common place, but this is the boilerplate for supporting multiple integration managers, and multiple integration manager sources. 

For https://github.com/vector-im/riot-web/issues/4913 / https://github.com/vector-im/riot-web/issues/10161
2019-08-09 16:08:06 -06:00
J. Ryan Stinnett
39d5aa7cf4 Avoid visual glitch when terms appear for IM
This avoids a visual glitch where the Integration Manager portal would briefly
appear, but then be replaced by a smaller Terms dialog when there's something to
agree to.

To resolve this minimal code churn, this cheats a bit and customises the size of
the terms dialog to match the IM portal modal when terms are shown for IM
purposes.

Fixes https://github.com/vector-im/riot-web/issues/10386
2019-07-23 15:11:38 +01:00
David Baker
1b0d8510a2 Add note from commit message as a comment 2019-07-23 10:09:16 +01:00
David Baker
7d7878245b Strip path component from IM rest url
before passing to js-sdk. We continue to use the full URL for the
calls done by matrix-react-sdk, but the standard terms API called
by the js-sdk lives on the standard _matrix path. This means we
don't support running IMs on a non-root path, but it's the only
realistic way of transitioning to _matrix paths since configs in
the wild contain bits of the API path.

Once we've fully transitioned to _matrix URLs, we can give people
a grace period to update their configs, then use the rest url as
a regular base url.
2019-07-22 18:54:04 +01:00
David Baker
7c43f0bcef Don't retry on terms error 2019-07-15 14:05:39 +01:00
David Baker
69fa34d71f Fix ScalarAuthClient to refresh tokens if they fail
Also add a test to make sure it does it
2019-07-11 16:00:24 +01:00
David Baker
189dd4c7b1 SERVICE_TYPES 2019-07-10 12:08:26 +01:00
David Baker
54aaabac74 Initial support for ToS dialogs for IS/IM
as per MSC2140
2019-07-09 18:51:56 +01:00
David Baker
7d40ccfdbe De-lint ScalarAuthClient 2019-07-04 12:59:20 +01:00
Travis Ralston
a5f296457f Make the Manage Integrations Button defer scalar auth to the manager
This moves the responsibility of creating a URL to open from the button (and other components) to the integrations manager dialog itself.

By doing this, we also cut down on scalar API calls because we don't pick up on account information until the user opens the dialog.
2019-06-17 15:29:28 -06:00
Jason Robinson
2aba18faaf Add versioning to integration manager API /register and /account calls
Current used version will be 1.1.

Signed-off-by: Jason Robinson <jasonr@matrix.org>
2019-03-13 12:39:47 +02:00
Aaron Raimist
49ce4ef117
eslint --fix src/
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-26 22:50:38 -05:00
Aaron Raimist
58488c076e
Fix more lint errors
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-11 21:54:55 -05:00
Aaron Raimist
ef3d1a611a
Fix Promise.defer warning in ScalarAuthClient.js
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-01 19:57:27 -05:00
Richard Lewis
20a442c962 Add comment. 2018-02-25 23:00:46 +00:00
Richard Lewis
86461bc88f Disable all widget assets on widget removal. 2018-02-24 00:10:28 +00:00
Richard Lewis
b2bf4d4709 Merge branch 'develop' of https://github.com/matrix-org/matrix-react-sdk into rxl881/snapshot 2018-02-23 15:37:33 +00:00
Richard Lewis
9e3c1fbc7a Pass room name. 2018-02-09 11:44:27 +00:00
David Baker
84da19c544
Merge pull request #1668 from turt2live/travis/re-register-scalar-token
Attempt to re-register for a scalar token if ours is invalid
2018-01-11 11:01:04 +00:00
Travis Ralston
678d87ef20 Give the current theme to the integration manager
For integration managers which would like to theme themselves to match Riot.

Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-12-16 20:13:27 -07:00
Travis Ralston
dca6fb6b81 Attempt to re-register for a scalar token if ours is invalid
This mostly helps with people migrating between integration managers where their old scalar token may no longer be valid. This also solves the problem of people switching between scalar and scalar-staging in the wild.

Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-12-16 20:04:32 -07:00
Richard Lewis
24db57bfb6 Fix api prefix. 2017-12-08 18:47:00 +00:00
Richard Lewis
d62520482a fix typo. 2017-12-05 21:57:28 +00:00
Richard Lewis
fc3287c49f Fix error message. 2017-12-05 21:56:35 +00:00
Richard Lewis
d5d5397959 Set custom widget title. 2017-12-05 21:41:44 +00:00
Luke Barnard
d3f9a3aeb5 Run eslint --fix
Fixing 1000s of lint issues. Some rules cannot be `--fix`ed but this goes some way to linting the entire codebase.
2017-10-11 17:56:17 +01:00
Richard Lewis
74ab7c9bb3 Fix encoding 2017-08-22 09:59:27 +01:00
Matthew Hodgson
d7f5295949 untested WIP for supporting multiple widgets properly 2017-08-18 18:40:00 +01:00
Richard van der Hoff
0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff
a06bd84213 replace imports of q with bluebird
update `package.json`

```
find src test -name '*.js' |
   xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
   xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 18:05:08 +01:00
Richard Lewis
d091550ccb Use app ID for element key and pass screen parameter to scalar. 2017-07-06 15:59:59 +01:00
Kegan Dougal
45ada1887d Implement starter link support
This involves modal dialogs because browsers are *terrible*.
2016-09-02 16:36:43 +01:00
Kegan Dougal
6ec7e5df28 Move scalar auth stuff to ScalarAuthClient from RoomSettings 2016-09-02 16:03:24 +01:00
Luke Barnard
46d306a217 Change register response access_token to scalar_token 2016-08-17 17:16:19 +01:00
David Baker
15dccd9871 Handle errors with scalar-oauthing
Handle error getting the scalar token and check for non-success status codes in the response handler (because apparently browser-request doesn't consider that an error).
2016-06-06 17:55:45 +01:00
David Baker
bb9316edfa Pass the room id to scalar 2016-05-06 14:42:00 +01:00
David Baker
6da4b9d671 Add suport for showing the scalar UI 2016-05-06 14:19:56 +01:00