File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -762,7 +762,7 @@ export default class App extends Component {
762762
763763 // Open a new buffer if the message doesn't come from me or is a
764764 // self-message
765- if ( ( ! client . isMyNick ( msg . prefix . name ) || client . isMyNick ( bufName ) ) && ( msg . command !== "PART" && msg . comand !== "QUIT" && msg . command !== irc . RPL_MONONLINE && msg . command !== irc . RPL_MONOFFLINE ) ) {
765+ if ( ( ! client . isMyNick ( msg . prefix . name ) || client . isMyNick ( bufName ) ) && ( msg . command !== "PART" && msg . command !== "QUIT" && msg . command !== irc . RPL_MONONLINE && msg . command !== irc . RPL_MONOFFLINE ) ) {
766766 this . createBuffer ( serverID , bufName ) ;
767767 }
768768
@@ -1075,6 +1075,7 @@ export default class App extends Component {
10751075 case "ACK" :
10761076 case "BOUNCER" :
10771077 case "MARKREAD" :
1078+ case "REDACT" :
10781079 // Ignore these
10791080 return [ ] ;
10801081 default :
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ function canFoldMessage(msg) {
9494
9595class LogLine extends Component {
9696 shouldComponentUpdate ( nextProps ) {
97- return this . props . message !== nextProps . message ;
97+ return this . props . message !== nextProps . message || this . props . redacted !== nextProps . redacted ;
9898 }
9999
100100 render ( ) {
@@ -143,13 +143,18 @@ class LogLine extends Component {
143143 ` ;
144144 }
145145 } else {
146- lineClass = "talk" ;
147146 let prefix = "<" , suffix = ">" ;
148147 if ( msg . command === "NOTICE" ) {
149148 lineClass += " notice" ;
150149 prefix = suffix = "-" ;
151150 }
152- content = html `< span class ="nick-caret "> ${ prefix } </ span > ${ createNick ( msg . prefix . name ) } < span class ="nick-caret "> ${ suffix } </ span > ${ linkify ( stripANSI ( text ) , onChannelClick ) } ` ;
151+ if ( this . props . redacted ) {
152+ content = html `< i > This message has been deleted.</ i > ` ;
153+ } else {
154+ content = html `${ linkify ( stripANSI ( text ) , onChannelClick ) } ` ;
155+ lineClass += " talk" ;
156+ }
157+ content = html `< span class ="nick-caret "> ${ prefix } </ span > ${ createNick ( msg . prefix . name ) } < span class ="nick-caret "> ${ suffix } </ span > ${ content } ` ;
153158 }
154159
155160 let allowedPrefixes = server . statusMsg ;
@@ -710,6 +715,7 @@ export default class Buffer extends Component {
710715 message=${ msg }
711716 buffer=${ buf }
712717 server=${ server }
718+ redacted=${ buf . redacted . has ( msg . tags . msgid ) }
713719 onChannelClick=${ onChannelClick }
714720 onNickClick=${ onNickClick }
715721 onVerifyClick=${ onVerifyClick }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ const permanentCaps = [
2121 "draft/account-registration" ,
2222 "draft/chathistory" ,
2323 "draft/extended-monitor" ,
24+ "draft/message-redaction" ,
2425 "draft/read-marker" ,
2526
2627 "soju.im/bouncer-networks" ,
Original file line number Diff line number Diff line change @@ -361,6 +361,7 @@ export const State = {
361361 hasInitialWho : false , // if channel
362362 members : new irc . CaseMapMap ( null , client . cm ) , // if channel
363363 messages : [ ] ,
364+ redacted : new Set ( ) ,
364365 unread : Unread . NONE ,
365366 prevReadReceipt : null ,
366367 } ) ;
@@ -665,6 +666,14 @@ export const State = {
665666
666667 return { members } ;
667668 } ) ;
669+ case "REDACT" :
670+ target = msg . params [ 0 ] ;
671+ if ( client . isMyNick ( target ) ) {
672+ target = msg . prefix . name ;
673+ }
674+ return updateBuffer ( target , ( buf ) => {
675+ return { redacted : new Set ( buf . redacted ) . add ( msg . params [ 1 ] ) } ;
676+ } ) ;
668677 case irc . RPL_MONONLINE :
669678 case irc . RPL_MONOFFLINE :
670679 targets = msg . params [ 1 ] . split ( "," ) ;
You can’t perform that action at this time.
0 commit comments