소스 검색

fix(breakout-rooms): Fix polls usage.

factor2
Дамян Минков 3 년 전
부모
커밋
32aa40b396

+ 1
- 0
doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example 파일 보기

@@ -124,4 +124,5 @@ Component "lobby.jitmeet.example.com" "muc"
124 124
     muc_room_default_public_jids = true
125 125
     modules_enabled = {
126 126
         "muc_rate_limit";
127
+        "polls";
127 128
     }

+ 9
- 0
react/features/polls/actionTypes.js 파일 보기

@@ -10,6 +10,15 @@
10 10
  */
11 11
 export const CHANGE_VOTE = 'CHANGE_VOTE';
12 12
 
13
+/**
14
+ * The type of the action which signals that we need to clear all polls from the state.
15
+ * For example we are moving to another conference.
16
+ *
17
+ * {
18
+ *     type: CLEAR_POLLS
19
+ * }
20
+ */
21
+export const CLEAR_POLLS = 'CLEAR_POLLS';
13 22
 
14 23
 /**
15 24
  * The type of the action which signals that a new Poll was received.

+ 12
- 0
react/features/polls/actions.js 파일 보기

@@ -2,6 +2,7 @@
2 2
 
3 3
 import {
4 4
     CHANGE_VOTE,
5
+    CLEAR_POLLS,
5 6
     RESET_NB_UNREAD_POLLS,
6 7
     RECEIVE_ANSWER,
7 8
     RECEIVE_POLL,
@@ -10,6 +11,17 @@ import {
10 11
 } from './actionTypes';
11 12
 import type { Answer, Poll } from './types';
12 13
 
14
+/**
15
+ * Action to signal that existing polls needs to be cleared from state.
16
+ *
17
+ * @returns {{
18
+ *     type: CLEAR_POLLS
19
+ * }}
20
+ */
21
+export const clearPolls = () => {
22
+    return { type: CLEAR_POLLS };
23
+};
24
+
13 25
 /**
14 26
  * Action to signal that a poll's vote will be changed.
15 27
  *

+ 8
- 0
react/features/polls/reducer.js 파일 보기

@@ -4,6 +4,7 @@ import { ReducerRegistry } from '../base/redux';
4 4
 
5 5
 import {
6 6
     CHANGE_VOTE,
7
+    CLEAR_POLLS,
7 8
     RECEIVE_POLL,
8 9
     RECEIVE_ANSWER,
9 10
     REGISTER_VOTE,
@@ -38,6 +39,13 @@ ReducerRegistry.register('features/polls', (state = INITIAL_STATE, action) => {
38 39
         };
39 40
     }
40 41
 
42
+    case CLEAR_POLLS: {
43
+        return {
44
+            ...state,
45
+            ...INITIAL_STATE
46
+        };
47
+    }
48
+
41 49
     // Reducer triggered when a poll is received
42 50
     case RECEIVE_POLL: {
43 51
         const newState = {

+ 4
- 1
react/features/polls/subscriber.js 파일 보기

@@ -9,7 +9,7 @@ import {
9 9
     showNotification
10 10
 } from '../notifications';
11 11
 
12
-import { receiveAnswer, receivePoll } from './actions';
12
+import { clearPolls, receiveAnswer, receivePoll } from './actions';
13 13
 import { COMMAND_NEW_POLL, COMMAND_ANSWER_POLL, COMMAND_OLD_POLLS } from './constants';
14 14
 import type { Answer, Poll } from './types';
15 15
 
@@ -122,6 +122,9 @@ StateListenerRegistry.register(
122 122
 
123 123
             conference.on(JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, receiveMessage);
124 124
             conference.on(JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, receiveMessage);
125
+
126
+            // clean old polls
127
+            store.dispatch(clearPolls());
125 128
         }
126 129
     }
127 130
 );

Loading…
취소
저장