Commit graph

75 commits

Author SHA1 Message Date
David Baker
0f2c47937c Merge the two different widget utils files 2018-06-26 11:52:21 +01:00
David Baker
069080e7ed lint 2018-06-26 09:41:20 +01:00
David Baker
5c8eeff08a Refactor widgets code
Split logic out of setWidget & re-use it when we add jitsi widgets.

Also fix the detection of existing jitsi widgets and make that use
getRoomWidgets() too.

Add error message when a jitsi call is already in process.
2018-06-25 15:30:04 +01:00
David Baker
94125fb566 Fix widgets re-appearing after being deleted
Widgets would sometimes briefly re-appear after having been deleted.
This was because of the following race:
 * User presses delete, send POST req, we set `deleting`. Widget hides.
 * POST request completes, we unset `deleting` so widget unhides.
 * State event comes down sync so widget hides again.

This fixes this by introducing `waitForRoomWidget` and using it to
wait until the state event comes down the sync until clearing the
`deleting` flag.

Since we now have `waitForRoomWidget`, this also uses it when adding
a widget so the 'widget saved' appears at the same time the widget
does.
2018-06-13 15:50:19 +01:00
David Baker
1cb794753e Simplify & refactor some widget stuff
* ScalarMessaging onMessage was getting the current room ID by listening
  for view_and remembering the room id or alias, and so having to look up
  the alias if it was alias. We have RoomViewStore for this.
 * Move waitForUserWidget into WidgetUtils
 * s/require/import/
2018-06-13 10:39:52 +01:00
David Baker
fadf264a1b Rename uses of function too 2018-05-15 17:34:02 +01:00
David Baker
e4a221e42d More helpful function name 2018-05-15 17:28:55 +01:00
David Baker
bb5ae741bc Wait for deletion of widgets as well addition
We were previously waiting for them to appear which is silly if we
were deleting them.
2018-05-15 17:12:59 +01:00
David Baker
9d5ba25131 oh, sendError does support sending the error 2018-05-15 15:19:28 +01:00
David Baker
464e093f40 log exception 2018-05-15 15:14:33 +01:00
David Baker
5b781043a5 just use the one if statement 2018-05-15 15:02:24 +01:00
David Baker
7bfe84f8be Catch errors adding widget 2018-05-15 14:53:49 +01:00
David Baker
e9336eab63 lint 2018-05-15 14:18:02 +01:00
David Baker
d0ec467c34 Oops, actually get account data event.
Also ignore any account data events that aren;t widgets.
2018-05-15 14:13:56 +01:00
David Baker
f4d69e26e9 PR feedback 2018-05-15 12:06:23 +01:00
David Baker
142ce4c256 better comment 2018-05-15 11:50:24 +01:00
David Baker
2956c049d6 Wait for echo from server when adding user widgets
As hopefully all explained in comments.

Fixes https://github.com/vector-im/riot-web/issues/6727
2018-05-15 11:41:16 +01:00
Richard Lewis
44ea11d386 Fix 'state_key' field name. 2018-05-09 16:55:49 +01:00
Richard Lewis
11915b0cdf Fix user widget event type.
Add comments for clarity.
2018-04-02 10:02:41 +01:00
Richard Lewis
9a3f3562e1 Wait for setAccountData to complete. 2018-03-29 20:07:26 +01:00
Richard Lewis
7d13edc67a Get user widgets by default (if roomID is not specified). 2018-03-13 11:58:18 +00:00
Richard Lewis
a81269cba8 Check if user widget. 2018-03-13 10:07:27 +00:00
Richard Lewis
a33859326e Use getUserWidgets where possible. 2018-03-09 09:15:16 +00:00
Richard Lewis
ee4310cc41 Avoid potential NPE. 2018-02-25 21:47:23 +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
46f94b3c5a Ensure that roomId is validated before accessing room-based widgets. 2018-02-23 14:53:52 +00:00
Matthew Hodgson
2d5a2a9d48 improve origin check of ScalarMessaging postmessage API.
ensures that https://scalar.ve can't access the API.
many thanks to @rugk for pointing out the potential vuln.
cc @rxl881 in case this bug has been transplanted elsewhere.
2018-02-17 00:02:38 +00:00
Richard Lewis
234ca8b062 Remove top padding from app tile. 2018-02-08 17:50:30 +00:00
Richard Lewis
393236ba34 Update / remove stickerpacks 2018-02-07 09:23:00 +00:00
Richard Lewis
e508f06765 Add asset add / remove messaging clauses. 2018-02-05 11:50:25 +00:00
Richard Lewis
1a994b88f5 Move widget utility functions in to their own file. 2018-01-11 10:32:37 +00:00
Richard Lewis
9e9de765dc Handle user widgets. 2018-01-09 14:37:45 +00:00
Richard Lewis
60e7646f92 Save user widgets in accountData 2018-01-08 16:47:49 +00:00
Richard Lewis
adebf71a1d Set user widgets on application data. 2018-01-08 15:38:01 +00:00
Richard Lewis
b5f6d97fa2 Ignore postmessage requests with api field set. 2017-12-19 15:39:13 +00:00
Richard Lewis
597a71fa9d Add messaging endpoint for room encryption status. 2017-12-05 11:59:02 +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
Kegsay
5274cf59a0 Hook up the edit widget button (#1218)
* Hook up the edit widget button

* Review comments
2017-07-14 11:17:59 +01:00
Kegsay
6369253142 Scalar messaging: Add can_send_event operation (#1204)
This is mainly for use to pre-emptively show/hide buttons.
2017-07-11 15:20:33 +01:00
Kegsay
cf158530f5 Implement new widget API (#1201)
* Implement new widget API

This allows clients to see who provisioned which widgets.

* Update to make state_key the wid

* Update to latest API

* Only show widgets which have required fields

* Don't constantly show apps dialog

* Fix example to include data key
2017-07-11 12:15:27 +01:00
Kegan Dougal
f2d243443b Suppress more errors from spurious postMessage calls on the demo instance 2017-07-07 17:44:25 +01:00
Kegsay
11309f34e3 Reference count calls to start/stopListening on ScalarMessaging (#1164)
Otherwise component mounting/unmounting can race and you end up with nothing
listening.
2017-06-30 15:42:51 +01:00
Kegan Dougal
34d7d793b7 Handle M_NOT_FOUND 2017-06-09 15:06:09 +01:00
Kegan Dougal
b70881f078 Rejig to support deletions better 2017-06-09 12:34:19 +01:00
Kegan Dougal
6d1d435247 Scalar: add in set_widget and get_widgets 2017-06-09 11:21:37 +01:00
Kegsay
5c1866c1c6 Add get_membership_count scalar API (#1043) 2017-06-06 16:41:08 +01:00
David Baker
43d8ccf128 Hopefully sort out strings with appended '.'s 2017-05-25 19:21:18 +01:00
David Baker
5c359e63ab Bulk change counterpart imports
to use languageHandler wrapper func
2017-05-25 11:39:08 +01:00
David Baker
d419c42a4f Squash merge https://github.com/matrix-org/matrix-react-sdk/pull/801 2017-05-23 15:16:31 +01:00
David Baker
18d4d3392a Fix a bunch of linting errors
eslint --fix and a few manual ones
2017-01-20 14:22:27 +00:00