import { MessageTweakerPlugin } from "./basePlugin" ; export default class HideUrlPreviews extends MessageTweakerPlugin { protected processXHRMessages ( messages ) { messages = messages . map ( m => { if ( m . attachments ) { m . attachments = m . attachments . filter ( a => ! a . from_url ) ; if ( ! m . attachments . length ) { delete m . attachments ; } } return m ; } ) ; return messages ; } protected processWSMessage ( data ) { if ( data . message && data . message . attachments ) { data . message . attachments = data . message . attachments . filter ( m => ! m . from_url ) ; if ( ! data . message . attachments . length ) { delete data . message . attachments ; } } return data ; } }