@@ -35,15 +35,15 @@ class MessageItem extends Component {
35
35
} ;
36
36
37
37
render ( ) {
38
- const { message, onRemoveMessage } = this . props ;
38
+ const { authUser , message, onRemoveMessage } = this . props ;
39
39
const { editMode, editText } = this . state ;
40
40
41
41
return (
42
42
< Feed . Event >
43
43
< Feed . Content >
44
44
< Feed . Summary >
45
45
< Feed . User as = { Link } to = { `/` } >
46
- { message . user . username || message . user . userId }
46
+ { message . userId }
47
47
</ Feed . User >
48
48
< Feed . Date >
49
49
< TimeAgo time = { message . createdAt } />
@@ -68,26 +68,30 @@ class MessageItem extends Component {
68
68
) }
69
69
</ Feed . Extra >
70
70
< Feed . Meta >
71
- { editMode ? (
72
- < span >
73
- < Button icon onClick = { this . onSaveEditText } >
74
- < Icon color = "green" name = "save outline" />
75
- </ Button >
76
- < Button icon onClick = { this . onToggleEditMode } >
77
- < Icon color = "blue" name = "undo alternate" />
78
- </ Button >
79
- </ span >
80
- ) : (
71
+ { authUser . uid === message . userId && (
81
72
< span >
82
- < Button icon onClick = { this . onToggleEditMode } >
83
- < Icon color = "blue" name = "edit outline" />
84
- </ Button >
85
- < Button
86
- icon
87
- onClick = { ( ) => onRemoveMessage ( message . uid ) }
88
- >
89
- < Icon color = "red" name = "trash alternate" />
90
- </ Button >
73
+ { editMode ? (
74
+ < span >
75
+ < Button icon onClick = { this . onSaveEditText } >
76
+ < Icon color = "green" name = "save outline" />
77
+ </ Button >
78
+ < Button icon onClick = { this . onToggleEditMode } >
79
+ < Icon color = "blue" name = "undo alternate" />
80
+ </ Button >
81
+ </ span >
82
+ ) : (
83
+ < span >
84
+ < Button icon onClick = { this . onToggleEditMode } >
85
+ < Icon color = "blue" name = "edit outline" />
86
+ </ Button >
87
+ < Button
88
+ icon
89
+ onClick = { ( ) => onRemoveMessage ( message . uid ) }
90
+ >
91
+ < Icon color = "red" name = "trash alternate" />
92
+ </ Button >
93
+ </ span >
94
+ ) }
91
95
</ span >
92
96
) }
93
97
</ Feed . Meta >
0 commit comments