Update render to include user info.
This commit is contained in:
		
							parent
							
								
									36e663e1ed
								
							
						
					
					
						commit
						3c6ea15d47
					
				@ -51,7 +51,17 @@ class ChannelMessageService(BaseService):
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    async def save(self, model):
 | 
			
		||||
        context = model.record  
 | 
			
		||||
        context = {}
 | 
			
		||||
        content.update(model.record)
 | 
			
		||||
        user = await self.app.services.user.get(model['user_uid'])
 | 
			
		||||
        context.update(
 | 
			
		||||
            {
 | 
			
		||||
                "user_uid": user["uid"],
 | 
			
		||||
                "username": user["username"],
 | 
			
		||||
                "user_nick": user["nick"],
 | 
			
		||||
                "color": user["color"],
 | 
			
		||||
            }
 | 
			
		||||
        )
 | 
			
		||||
        template = self.app.jinja2_env.get_template("message.html")
 | 
			
		||||
        model["html"] = template.render(**context)
 | 
			
		||||
        return await super().save(model)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user