Commit graph

14 commits

Author SHA1 Message Date
David Baker
6cf11a15e6 Move WidgetUtils to utils dir 2018-06-26 11:59:16 +01:00
David Baker
0f2c47937c Merge the two different widget utils files 2018-06-26 11:52:21 +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
3e6b3215cf
Update WidgetUtils.js
Fix fixed comment
2018-06-14 13:49:23 +01:00
David Baker
36574ca0fb Fix doc 2018-06-14 13:03:42 +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
Travis Ralston
98613748b6 Move Scalar Widget URL check to WidgetUtils
Signed-off-by: Travis Ralston <travpc@gmail.com>
2018-05-27 11:12:55 -06:00
Richard Lewis
11915b0cdf Fix user widget event type.
Add comments for clarity.
2018-04-02 10:02:41 +01:00
Richard Lewis
46755de962 Fix event type. 2017-08-01 11:41:41 +01:00
Richard Lewis
15f39040a0 Simplify canUserModifyWidgets API 2017-08-01 11:39:17 +01:00
Richard Lewis
6f57fe96f2 Add JS doc to indicate that the function may throw an error. 2017-07-28 16:19:20 +01:00
Richard Lewis
a901ca5308 Remove invalid OM license header. 2017-07-28 16:17:18 +01:00
Richard Lewis
ccf3c1de7a Add widget utility class. Add static method to determine if user can modify widgets in the specified room. 2017-07-27 23:37:33 +01:00