Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Dynamic.ExpandoObject do not have definition for UserId exception throws when go to project detail page #2

Open
david0718 opened this issue Feb 10, 2017 · 4 comments

Comments

@david0718
Copy link

Parts.DashboardActivityStream-ProjectLastActivityStream.cshtml
This file's part as below
<a href="@Url.Action("Display", "User", new { userId = item.UserId, area = "Orchard.CRM.Project" })">

@item.UserFullName

The cause:
If we create ticket from email, there is no UserId assigned to dynamic object as below code snippets from
ActivityStreamService.cs

if (item.User != null)
{
var user = this.basicDataService.GetOperatorOrCustomerUser(item.User.Id);
itemModel.User = user;
itemModel.UserId = item.User.Id;
itemModel.UserFullName = user != null ? CRMHelper.GetFullNameOfUser(user) : item.User.UserName;
}
else
{
itemModel.UserFullName = T("System").Text;
}

It could be quick fixed by

if (item.User != null)
{
var user = this.basicDataService.GetOperatorOrCustomerUser(item.User.Id);
itemModel.User = user;
itemModel.UserId = item.User.Id;
itemModel.UserFullName = user != null ? CRMHelper.GetFullNameOfUser(user) : item.User.UserName;
}
else
{
itemModel.UserId = 0;
itemModel.UserFullName = T("System").Text;
}
How do you think of this?
If you agree I could send a merge request.
Thanks
David

@david0718
Copy link
Author

I also found issue on other page because of such kind of issue, I will update this post later.

@david0718
Copy link
Author

I think we should add a System user, then we could use it here?
Or other suggestion?

@david0718
Copy link
Author

            var user = _memebershipService.GetUser(services.WorkContext.CurrentSite.SuperUser);
            itemModel.User = user;
            itemModel.UserId = user.Id;
            itemModel.UserFullName = T("System").Text;

For temp option I assign SuperUser to this System account now.
:) Waiting your feedback.

@siyamandayubi
Copy link
Owner

Thanks for finding the bug. I think using the SuperUser is a good solution. Please send the pull request if possible, or let me know, then I will apply the changes later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants