@@ -698,9 +698,6 @@ func (u *User) addUserToChannelWorker(channels <-chan *bridge.ChannelInfo, throt
698698 // traverse the order in reverse
699699 for i := len (mmPostList .Order ) - 1 ; i >= 0 ; i -- {
700700 p := mmPostList.Posts [mmPostList.Order [i ]]
701- if p .Type == model .PostTypeJoinLeave {
702- continue
703- }
704701
705702 if p .DeleteAt > p .CreateAt {
706703 continue
@@ -725,8 +722,31 @@ func (u *User) addUserToChannelWorker(channels <-chan *bridge.ChannelInfo, throt
725722 nick = botname
726723 }
727724
728- if p .Type == model .PostTypeAddToTeam || p .Type == model .PostTypeRemoveFromTeam {
725+ switch {
726+ case p .Type == model .PostTypeAddToTeam :
727+ nick = systemUser
728+ ghost := u .createUserFromInfo (user )
729+ u .Srv .Channel (brchannel .ID ).Join (ghost ) //nolint:errcheck
730+ case p .Type == model .PostTypeRemoveFromTeam :
729731 nick = systemUser
732+ ghost := u .createUserFromInfo (user )
733+ u .Srv .Channel (brchannel .ID ).Part (ghost , "" ) //nolint:errcheck
734+ case p .Type == model .PostTypeJoinChannel :
735+ ghost := u .createUserFromInfo (user )
736+ u .Srv .Channel (brchannel .ID ).Join (ghost ) //nolint:errcheck
737+ case p .Type == model .PostTypeLeaveChannel :
738+ ghost := u .createUserFromInfo (user )
739+ u .Srv .Channel (brchannel .ID ).Part (ghost , "" ) //nolint:errcheck
740+ case p .Type == model .PostTypeAddToChannel :
741+ if addedUserId , ok := props ["addedUserId" ].(string ); ok {
742+ ghost := u .createUserFromInfo (u .br .GetUser (addedUserId ))
743+ u .Srv .Channel (brchannel .ID ).Join (ghost ) //nolint:errcheck
744+ }
745+ case p .Type == model .PostTypeRemoveFromChannel :
746+ if removedUserId , ok := props ["removedUserId" ].(string ); ok {
747+ ghost := u .createUserFromInfo (u .br .GetUser (removedUserId ))
748+ u .Srv .Channel (brchannel .ID ).Part (ghost , "" ) //nolint:errcheck
749+ }
730750 }
731751
732752 for _ , post := range strings .Split (p .Message , "\n " ) {
0 commit comments