@@ -19,19 +19,47 @@ import sdk from '../../../index';
19
19
import MatrixClientPeg from '../../../MatrixClientPeg' ;
20
20
import GeminiScrollbar from 'react-gemini-scrollbar' ;
21
21
22
+ function DeviceListEntry ( props ) {
23
+ const { userId, device} = props ;
24
+
25
+ const DeviceVerifyButtons = sdk . getComponent ( 'elements.DeviceVerifyButtons' ) ;
26
+
27
+ return (
28
+ < li >
29
+ < DeviceVerifyButtons device = { device } userId = { userId } />
30
+ { device . deviceId }
31
+ < br />
32
+ { device . getDisplayName ( ) }
33
+ </ li >
34
+ ) ;
35
+ }
36
+
37
+ DeviceListEntry . propTypes = {
38
+ userId : React . PropTypes . string . isRequired ,
39
+
40
+ // deviceinfo
41
+ device : React . PropTypes . object . isRequired ,
42
+ } ;
43
+
44
+
22
45
function UserUnknownDeviceList ( props ) {
23
- const { userDevices} = props ;
46
+ const { userId , userDevices} = props ;
24
47
25
48
const deviceListEntries = Object . keys ( userDevices ) . map ( ( deviceId ) =>
26
- < li key = { deviceId } >
27
- { deviceId } ( { userDevices [ deviceId ] . getDisplayName ( ) } )
28
- </ li > ,
49
+ < DeviceListEntry key = { deviceId } userId = { userId }
50
+ device = { userDevices [ deviceId ] } /> ,
29
51
) ;
30
52
31
- return < ul > { deviceListEntries } </ ul > ;
53
+ return (
54
+ < ul className = "mx_UnknownDeviceDialog_deviceList" >
55
+ { deviceListEntries }
56
+ </ ul >
57
+ ) ;
32
58
}
33
59
34
60
UserUnknownDeviceList . propTypes = {
61
+ userId : React . PropTypes . string . isRequired ,
62
+
35
63
// map from deviceid -> deviceinfo
36
64
userDevices : React . PropTypes . object . isRequired ,
37
65
} ;
@@ -43,7 +71,7 @@ function UnknownDeviceList(props) {
43
71
const userListEntries = Object . keys ( devices ) . map ( ( userId ) =>
44
72
< li key = { userId } >
45
73
< p > { userId } :</ p >
46
- < UserUnknownDeviceList userDevices = { devices [ userId ] } />
74
+ < UserUnknownDeviceList userId = { userId } userDevices = { devices [ userId ] } />
47
75
</ li > ,
48
76
) ;
49
77
@@ -60,6 +88,8 @@ export default React.createClass({
60
88
displayName : 'UnknownEventDialog' ,
61
89
62
90
propTypes : {
91
+ room : React . PropTypes . object . isRequired ,
92
+
63
93
// map from userid -> deviceid -> deviceinfo
64
94
devices : React . PropTypes . object . isRequired ,
65
95
onFinished : React . PropTypes . func . isRequired ,
@@ -76,24 +106,48 @@ export default React.createClass({
76
106
} ,
77
107
78
108
render : function ( ) {
109
+ const client = MatrixClientPeg . get ( ) ;
110
+ const blacklistUnverified = client . getGlobalBlacklistUnverifiedDevices ( ) ||
111
+ this . props . room . getBlacklistUnverifiedDevices ( ) ;
112
+
113
+ let warning ;
114
+ if ( blacklistUnverified ) {
115
+ warning = (
116
+ < h4 >
117
+ You are currently blacklisting unverified devices; to send
118
+ messages to these devices you must verify them.
119
+ </ h4 >
120
+ ) ;
121
+ } else {
122
+ warning = (
123
+ < div >
124
+ < p >
125
+ This means there is no guarantee that the devices
126
+ belong to the users they claim to.
127
+ </ p >
128
+ < p >
129
+ We recommend you go through the verification process
130
+ for each device before continuing, but you can resend
131
+ the message without verifying if you prefer.
132
+ </ p >
133
+ </ div >
134
+ ) ;
135
+ }
136
+
79
137
const BaseDialog = sdk . getComponent ( 'views.dialogs.BaseDialog' ) ;
80
138
return (
81
139
< BaseDialog className = 'mx_UnknownDeviceDialog'
82
140
onFinished = { this . props . onFinished }
83
141
title = 'Room contains unknown devices'
84
142
>
85
143
< GeminiScrollbar autoshow = { false } className = "mx_Dialog_content" >
86
- < h4 > This room contains devices which have not been
87
- verified.</ h4 >
88
- < p >
89
- This means there is no guarantee that the devices belong
90
- to a rightful user of the room.
91
- </ p > < p >
92
- We recommend you go through the verification process
93
- for each device before continuing, but you can resend
94
- the message without verifying if you prefer.
95
- </ p >
96
- < p > Unknown devices:</ p >
144
+ < h4 >
145
+ This room contains unknown devices which have not been
146
+ verified.
147
+ </ h4 >
148
+ { warning }
149
+ Unknown devices:
150
+
97
151
< UnknownDeviceList devices = { this . props . devices } />
98
152
</ GeminiScrollbar >
99
153
< div className = "mx_Dialog_buttons" >
@@ -104,5 +158,7 @@ export default React.createClass({
104
158
</ div >
105
159
</ BaseDialog >
106
160
) ;
161
+ // XXX: do we want to give the user the option to enable blacklistUnverifiedDevices for this room (or globally) at this point?
162
+ // It feels like confused users will likely turn it on and then disappear in a cloud of UISIs...
107
163
} ,
108
164
} ) ;
0 commit comments