mirror of https://github.com/mastodon/flodgatt
Remove language filter from home timeline (#97)
Previously, the language filter was incorrectly applied to all `update` messages. With this change, it is only applied to public timelines (i.e., the local timeline and the federated timeline) which is the behavior described in the docs.
This commit is contained in:
parent
2096e1348b
commit
8c6b8e87f5
|
@ -18,7 +18,7 @@
|
||||||
use super::{message::Message, receiver::Receiver};
|
use super::{message::Message, receiver::Receiver};
|
||||||
use crate::{
|
use crate::{
|
||||||
config,
|
config,
|
||||||
parse_client_request::user::{PgPool, Subscription},
|
parse_client_request::user::{PgPool, Stream::Public, Subscription, Timeline},
|
||||||
};
|
};
|
||||||
use futures::{
|
use futures::{
|
||||||
Async::{self, NotReady, Ready},
|
Async::{self, NotReady, Ready},
|
||||||
|
@ -34,7 +34,6 @@ use uuid::Uuid;
|
||||||
pub struct ClientAgent {
|
pub struct ClientAgent {
|
||||||
receiver: sync::Arc<sync::Mutex<Receiver>>,
|
receiver: sync::Arc<sync::Mutex<Receiver>>,
|
||||||
id: uuid::Uuid,
|
id: uuid::Uuid,
|
||||||
// pub current_timeline: String,
|
|
||||||
subscription: Subscription,
|
subscription: Subscription,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,13 +107,15 @@ impl futures::stream::Stream for ClientAgent {
|
||||||
use Message::*;
|
use Message::*;
|
||||||
match result {
|
match result {
|
||||||
Ok(Async::Ready(Some(json))) => match Message::from_json(json) {
|
Ok(Async::Ready(Some(json))) => match Message::from_json(json) {
|
||||||
Update(status) if status.language_not_allowed(allowed_langs) => block,
|
Update(status) => match self.subscription.timeline {
|
||||||
Update(status) if status.involves_blocked_user(blocked_users) => block,
|
_ if status.involves_blocked_user(blocked_users) => block,
|
||||||
Update(status) if status.from_blocked_domain(blocked_domains) => block,
|
_ if status.from_blocked_domain(blocked_domains) => block,
|
||||||
Update(status) if status.from_blocking_user(blocking_users) => block,
|
_ if status.from_blocking_user(blocking_users) => block,
|
||||||
Update(status) => send(Update(status)),
|
Timeline(Public, _, _) if status.language_not_allowed(allowed_langs) => block,
|
||||||
Notification(notification) => send(Notification(notification)),
|
_ => send(Update(status)),
|
||||||
Conversation(notification) => send(Conversation(notification)),
|
},
|
||||||
|
Notification(payload) => send(Notification(payload)),
|
||||||
|
Conversation(payload) => send(Conversation(payload)),
|
||||||
Delete(status_id) => send(Delete(status_id)),
|
Delete(status_id) => send(Delete(status_id)),
|
||||||
FiltersChanged => send(FiltersChanged),
|
FiltersChanged => send(FiltersChanged),
|
||||||
Announcement(content) => send(Announcement(content)),
|
Announcement(content) => send(Announcement(content)),
|
||||||
|
|
Loading…
Reference in New Issue