"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "services/galley/src/Galley/Data/Services.hs" between
wire-server-2020-06-10.tar.gz and wire-server-2020-06-19.tar.gz

About: Wire (server) offers end-to-end encrypted messaging, file-sharing, video and voice calls, and guest rooms for external communication (back-end server).

Services.hs  (wire-server-2020-06-10):Services.hs  (wire-server-2020-06-19)
skipping to change at line 49 skipping to change at line 49
import Galley.Data (newMember) import Galley.Data (newMember)
import Galley.Data.Instances () import Galley.Data.Instances ()
import Galley.Data.Queries import Galley.Data.Queries
import Galley.Types hiding (Conversation) import Galley.Types hiding (Conversation)
import Galley.Types.Bot import Galley.Types.Bot
import Galley.Types.Conversations.Roles import Galley.Types.Conversations.Roles
import Imports import Imports
-- BotMember ------------------------------------------------------------------ -- BotMember ------------------------------------------------------------------
newtype BotMember = BotMember {fromBotMember :: Member} -- | For now we assume bots to always be local
--
-- FUTUREWORK(federation): allow remote bots
newtype BotMember = BotMember {fromBotMember :: LocalMember}
newBotMember :: Member -> Maybe BotMember newBotMember :: LocalMember -> Maybe BotMember
newBotMember m = const (BotMember m) <$> memService m newBotMember m = const (BotMember m) <$> memService m
botMemId :: BotMember -> BotId botMemId :: BotMember -> BotId
botMemId = BotId . memId . fromBotMember botMemId = BotId . memId . fromBotMember
botMemService :: BotMember -> ServiceRef botMemService :: BotMember -> ServiceRef
botMemService = fromJust . memService . fromBotMember botMemService = fromJust . memService . fromBotMember
addBotMember :: UserId -> ServiceRef -> BotId -> ConvId -> UTCTime -> Galley (Ev ent, BotMember) addBotMember :: UserId -> ServiceRef -> BotId -> ConvId -> UTCTime -> Galley (Ev ent, BotMember)
addBotMember orig s bot cnv now = do addBotMember orig s bot cnv now = do
let pid = s ^. serviceRefProvider let pid = s ^. serviceRefProvider
let sid = s ^. serviceRefId let sid = s ^. serviceRefId
retry x5 $ batch $ do retry x5 $ batch $ do
setType BatchLogged setType BatchLogged
setConsistency Quorum setConsistency Quorum
addPrepQuery insertUserConv (botUserId bot, cnv) addPrepQuery insertUserConv (botUserId bot, makeIdOpaque cnv, Nothing, Nothi ng)
addPrepQuery insertBot (cnv, bot, sid, pid) addPrepQuery insertBot (cnv, bot, sid, pid)
let e = Event MemberJoin cnv orig now (Just . EdMembersJoin . SimpleMembers $ (fmap toSimpleMember [botUserId bot])) let e = Event MemberJoin cnv orig now (Just . EdMembersJoin . SimpleMembers $ (fmap toSimpleMember [botUserId bot]))
let mem = (newMember (botUserId bot)) {memService = Just s} let mem = (newMember (botUserId bot)) {memService = Just s}
return (e, BotMember mem) return (e, BotMember mem)
where where
toSimpleMember :: UserId -> SimpleMember toSimpleMember :: UserId -> SimpleMember
toSimpleMember u = SimpleMember u roleNameWireAdmin toSimpleMember u = SimpleMember u roleNameWireAdmin
-- Service -------------------------------------------------------------------- -- Service --------------------------------------------------------------------
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)