Commit e23597c0 authored by Eisha Chen-yen-su's avatar Eisha Chen-yen-su

room.rs: Disable room details inputs

This disables the room details dialog's inputs if the user
doesn't have the right privileges.

See https://gitlab.gnome.org/World/fractal/issues/19
parent 4381410f
......@@ -380,6 +380,16 @@ impl AppOp {
.get_object::<gtk::Entry>("room_name_entry")
.expect("Can't find room_name_entry in ui file.");
let pl = *self.active_room.clone()
.and_then(|ar| self.rooms.get(&ar))
.and_then(|r| r.power_levels.get(&self.uid.clone()?))
.unwrap_or(&0);
if pl >= 50 {
edit.set_editable(true);
} else {
edit.set_editable(false);
}
name_label.set_text(&value);
edit.set_text(&value);
......@@ -391,6 +401,16 @@ impl AppOp {
.get_object::<gtk::Entry>("room_topic_entry")
.expect("Can't find room_topic_entry in ui file.");
let pl = *self.active_room.clone()
.and_then(|ar| self.rooms.get(&ar))
.and_then(|r| r.power_levels.get(&self.uid.clone()?))
.unwrap_or(&0);
if pl >= 50 {
edit.set_editable(true);
} else {
edit.set_editable(false);
}
edit.set_text(&value);
}
_ => println!("no key {}", key),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment