Skip to content

Commit

Permalink
Correct naming
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravlu committed Dec 17, 2024
1 parent fca1cf2 commit 22bf947
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ live_design! {
COLOR_PROFILE_CIRCLE = #xfff8ee
TYPING_NOTICE_ANIMATION_DURATION = 0.3

NO_POST_PERMISSION_NOTICE = "You don't have permission to post to this room."
CAN_NOT_SEND_NOTICE = "You don't have permission to post to this room."

FillerY = <View> {width: Fill}

Expand Down Expand Up @@ -916,7 +916,7 @@ live_design! {
icon_walk: {width: 18.0, height: Fit},
}
}
no_send_permission_notice = <View> {
can_not_send_message_notice = <View> {
visible: false
show_bg: true
draw_bg: {
Expand All @@ -931,7 +931,7 @@ live_design! {
color: (COLOR_TEXT)
text_style: <THEME_FONT_ITALIC>{font_size: 12.2}
}
text: (NO_POST_PERMISSION_NOTICE)
text: (CAN_NOT_SEND_NOTICE)
}
}
}
Expand Down Expand Up @@ -1734,11 +1734,11 @@ impl RoomScreen {

TimelineUpdate::CanUserSendMessage(can_user_send_message) => {
let input_bar = self.view.view(id!(input_bar));
let no_send_permission_notice = self.view.view(id!(no_send_permission_notice));
let can_not_send_message_notice = self.view.view(id!(can_not_send_message_notice));

//Set the visibility of the corresponding component for both cases.
input_bar.set_visible(can_user_send_message);
no_send_permission_notice.set_visible(!can_user_send_message);
can_not_send_message_notice.set_visible(!can_user_send_message);
}
}
}
Expand Down Expand Up @@ -1863,7 +1863,7 @@ impl RoomScreen {
/// Invoke this when this timeline is being shown,
/// e.g., when the user navigates to this timeline.
fn show_timeline(&mut self, cx: &mut Cx) {
self.check_user_post_permission();
self.check_can_user_send_message();

let room_id = self.room_id.clone()
.expect("BUG: Timeline::show_timeline(): no room_id was set.");
Expand Down Expand Up @@ -2131,7 +2131,7 @@ impl RoomScreen {
}

/// Send request as `MatrixRequest` to check post permission.
fn check_user_post_permission(&self) {
fn check_can_user_send_message(&self) {
if let Some(room_id) = self.room_id.clone() {
submit_async_request(MatrixRequest::CheckCanUserSendMessage { room_id })
}
Expand Down
4 changes: 2 additions & 2 deletions src/sliding_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,13 +794,13 @@ async fn async_worker(
let Some(client) = CLIENT.get() else { continue };
let Some(user_id) = client.user_id() else { continue };

let _check_user_send_permission_task = Handle::current().spawn(async move {
let _check_can_user_send_message_task = Handle::current().spawn(async move {
let room = timeline.room();

let can_user_send_message = room.can_user_send_message(user_id, matrix_sdk::ruma::events::MessageLikeEventType::Message).await.unwrap_or(false);

if let Err(e) = sender.send(TimelineUpdate::CanUserSendMessage(can_user_send_message)) {
error!("Failed to send the result of user send permission: {e}")
error!("Failed to send the result of if user can send message: {e}")
}
});
}
Expand Down

0 comments on commit 22bf947

Please sign in to comment.