pull/332/head
tidusjar 9 years ago
parent a003068869
commit 2011b10e20

@ -42,26 +42,8 @@ namespace PlexRequests.UI.Modules
public async Task<Response> IssueCount() public async Task<Response> IssueCount()
{ {
var issues = await IssuesService.GetAllAsync(); var issues = await IssuesService.GetAllAsync();
var settings = PlexRequestSettings.GetSettings();
IEnumerable<IssueModel> myIssues;
if (IsAdmin)
{
myIssues = issues.Where(x => x.Deleted == false).SelectMany(i => i.Issues);
}
else if (settings.UsersCanViewOnlyOwnRequests)
{
myIssues = (from issuesModel in issues
from i in issuesModel.Issues
where i.UserReported.Equals(Username, StringComparison.CurrentCultureIgnoreCase)
select i).ToList();
}
else
{
myIssues = issues.Where(x => x.Deleted == false).SelectMany(i => i.Issues);
}
var myIssues = await FilterIssues(issues);
var count = myIssues.Count(); var count = myIssues.Count();
@ -125,5 +107,29 @@ namespace PlexRequests.UI.Modules
return Response.AsJson(new JsonResponseModel { Result = true }); return Response.AsJson(new JsonResponseModel { Result = true });
} }
private async Task<IEnumerable<IssueModel>> FilterIssues(IEnumerable<IssuesModel> issues)
{
var settings = await PlexRequestSettings.GetSettingsAsync();
IEnumerable<IssueModel> myIssues;
if (IsAdmin)
{
myIssues = issues.Where(x => x.Deleted == false).SelectMany(i => i.Issues);
}
else if (settings.UsersCanViewOnlyOwnRequests)
{
myIssues = (from issuesModel in issues
from i in issuesModel.Issues
where i.UserReported.Equals(Username, StringComparison.CurrentCultureIgnoreCase)
select i).ToList();
}
else
{
myIssues = issues.Where(x => x.Deleted == false).SelectMany(i => i.Issues);
}
return myIssues;
}
} }
} }

@ -513,6 +513,9 @@
<Content Include="Views\Issues\Index.cshtml"> <Content Include="Views\Issues\Index.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Views\Issues\Details.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>web.config</DependentUpon> <DependentUpon>web.config</DependentUpon>
</None> </None>

@ -0,0 +1,15 @@

<h1>Details</h1>
<h4>Issues For @Model.Title</h4>
<br />
<img src="@Model.PosterUrl" />
@foreach (var issue in Model.Issues)
{
<div>Type: @issue.Issue</div>
<div>User Reported: @issue.UserReported</div>
<div>User Note: @issue.UserNote</div>
<div>Admin Note: @issue.AdminNote</div>
<div>Status: @issue.IssueStatus</div>
}
Loading…
Cancel
Save