fix some power level checks, fixes #19
This commit is contained in:
parent
7d8b267986
commit
e310f0f60e
2 changed files with 136 additions and 115 deletions
|
|
@ -91,7 +91,9 @@ class ChatBox extends HookConsumerWidget {
|
|||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: canSendMessages
|
||||
? [
|
||||
EmojiPickerButton(
|
||||
context: context,
|
||||
onSelection: (_) => node?.requestFocus(),
|
||||
|
|
@ -138,16 +140,17 @@ class ChatBox extends HookConsumerWidget {
|
|||
triggerCharacter.value = newTriggerCharacter;
|
||||
query.value = newQuery;
|
||||
},
|
||||
triggerCharacterAndStyles: {"@": style, "#": style},
|
||||
triggerCharacterAndStyles: {
|
||||
"@": style,
|
||||
"#": style,
|
||||
},
|
||||
builder: (context, key) => TextFormField(
|
||||
enabled: canSendMessages,
|
||||
maxLines: 12,
|
||||
minLines: 1,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
hintText: canSendMessages
|
||||
? "Your message here..."
|
||||
: "You don't have permission to send messages in this room...",
|
||||
hintText: "Your message here...",
|
||||
border: InputBorder.none,
|
||||
),
|
||||
controller: controller.value,
|
||||
|
|
@ -165,6 +168,14 @@ class ChatBox extends HookConsumerWidget {
|
|||
icon: Icon(Icons.send),
|
||||
tooltip: "Send message",
|
||||
),
|
||||
]
|
||||
: [
|
||||
Padding(
|
||||
padding: EdgeInsetsGeometry.all(8),
|
||||
child: Text(
|
||||
"You don't have permission to send messages in this room...",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -87,6 +87,11 @@ class RoomChat extends HookConsumerWidget {
|
|||
List<PopupMenuEntry> getMessageOptions(Message message) {
|
||||
final isSentByMe = message.authorId == userId;
|
||||
return [
|
||||
if (ref.watch(
|
||||
PowerLevelController.provider(
|
||||
PowerLevelConfig(eventType: "m.reaction"),
|
||||
),
|
||||
))
|
||||
PopupMenuItem(
|
||||
child: Row(
|
||||
children: [
|
||||
|
|
@ -126,6 +131,11 @@ class RoomChat extends HookConsumerWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
if (ref.watch(
|
||||
PowerLevelController.provider(
|
||||
PowerLevelConfig(eventType: "m.room.message"),
|
||||
),
|
||||
))
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
relatedMessage.value = message;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue