Skip to content

Commit

Permalink
Merge pull request #1166 from h3poteto/feat/notification/account
Browse files Browse the repository at this point in the history
Ignore notifications that does not have account field
  • Loading branch information
h3poteto authored Sep 26, 2023
2 parents bde708f + b6559b9 commit f2416c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src-tauri/src/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub async fn start_user(
);
let instance = client.get_instance().await.map_err(|e| e.to_string())?;
let Some(urls) = instance.json.urls else {
return Err("Streaming does not exist".to_string())
return Err("Streaming does not exist".to_string());
};
let streaming_url = urls.streaming_api;

Expand Down Expand Up @@ -100,15 +100,17 @@ pub async fn start_user(
}
Message::Notification(mes) => {
log::debug!("receive notification");
app_handle
.emit_all(
"receive-notification",
ReceiveNotificationPayload {
server_id,
notification: mes,
},
)
.expect("Failed to send receive-notification event");
if mes.account.is_some() {
app_handle
.emit_all(
"receive-notification",
ReceiveNotificationPayload {
server_id,
notification: mes,
},
)
.expect("Failed to send receive-notification event");
}
}
Message::StatusUpdate(mes) => {
log::debug!("receive status updated");
Expand Down Expand Up @@ -160,7 +162,7 @@ pub async fn start(
);
let instance = client.get_instance().await.map_err(|e| e.to_string())?;
let Some(urls) = instance.json.urls else {
return Err("Streaming does not exist".to_string())
return Err("Streaming does not exist".to_string());
};
let streaming_url = urls.streaming_api;

Expand Down
2 changes: 1 addition & 1 deletion src/components/timelines/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const Notifications: React.FC<Props> = props => {
options = Object.assign({}, options, { max_id: maxId })
}
const res = await client.getNotifications(options)
return res.data
return res.data.filter(n => !!n.account)
}

const closeOptionPopover = () => triggerRef?.current.close()
Expand Down

0 comments on commit f2416c3

Please sign in to comment.