Open Closed

Chat User table not updating when user details updating from Tenant #4557


User avatar
0
raju.thinnaluri@gmail.com created

Hi,

We are using Microservice Modal.

When user details are updating as a SaaS user chat users table data updating. but as a Tenant if updated the user details not updating the respective tenant user data in Chat user table.

  • ABP Framework version: v5.3.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it.

  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The problem was fixed: https://github.com/abpframework/abp/pull/14022

    You can upgrade your project to the latest version.

    you can try this if you don't want to upgrade project:

    [ExposeServices(typeof(ChatUserSynchronizer), typeof(MyChatUserSynchronizer))]
    public class MyChatUserSynchronizer :
        ChatUserSynchronizer
    {
        protected ICurrentTenant CurrentTenant { get; }
    
    
        public MyChatUserSynchronizer(
            IChatUserRepository userRepository,
            IChatUserLookupService userLookupService,
            ICurrentTenant currentTenant) : base(userRepository, userLookupService)
        {
            CurrentTenant = currentTenant;
        }
    
        public override async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData)
        {
            using(CurrentTenant.Change(eventData.Entity.TenantId))
            {
                var user = await UserRepository.FindAsync(eventData.Entity.Id);
                if (user == null)
                {
                    user = await UserLookupService.FindByIdAsync(eventData.Entity.Id);
                    if (user == null)
                    {
                        return;
                    }
                }
    
                if (user.Update(eventData.Entity))
                {
                    await UserRepository.UpdateAsync(user);
                }
            }
    
        }
    }
    
  • User Avatar
    0
    raju.thinnaluri@gmail.com created

    Hi,

    The problem was fixed: https://github.com/abpframework/abp/pull/14022

    You can upgrade your project to the latest version.

    you can try this if you don't want to upgrade project:

    [ExposeServices(typeof(ChatUserSynchronizer), typeof(MyChatUserSynchronizer))] 
    public class MyChatUserSynchronizer : 
        ChatUserSynchronizer 
    { 
        protected ICurrentTenant CurrentTenant { get; } 
     
     
        public MyChatUserSynchronizer( 
            IChatUserRepository userRepository, 
            IChatUserLookupService userLookupService, 
            ICurrentTenant currentTenant) : base(userRepository, userLookupService) 
        { 
            CurrentTenant = currentTenant; 
        } 
     
        public override async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData) 
        { 
            using(CurrentTenant.Change(eventData.Entity.TenantId)) 
            { 
                var user = await UserRepository.FindAsync(eventData.Entity.Id); 
                if (user == null) 
                { 
                    user = await UserLookupService.FindByIdAsync(eventData.Entity.Id); 
                    if (user == null) 
                    { 
                        return; 
                    } 
                } 
     
                if (user.Update(eventData.Entity)) 
                { 
                    await UserRepository.UpdateAsync(user); 
                } 
            } 
     
        } 
    } 
    

    Thank You. Now it's working fine.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11