Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit d28c340

Browse files
committed
Use readonly collections where appropriate.
1 parent e22daa8 commit d28c340

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/GitHub.App/Models/PullRequestModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public string Body
158158
public DateTimeOffset CreatedAt { get; set; }
159159
public DateTimeOffset UpdatedAt { get; set; }
160160
public IAccount Author { get; set; }
161-
public IList<IPullRequestFileModel> ChangedFiles { get; set; } = new IPullRequestFileModel[0];
161+
public IReadOnlyCollection<IPullRequestFileModel> ChangedFiles { get; set; } = new IPullRequestFileModel[0];
162162

163163
IAccount assignee;
164164
[AllowNull]

src/GitHub.App/Services/ModelService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public IObservable<IPullRequestModel> GetPullRequest(ILocalRepositoryModel repo,
187187
apiClient.GetPullRequest(repo.CloneUrl.Owner, repo.CloneUrl.RepositoryName, number),
188188
apiClient.GetPullRequestFiles(repo.CloneUrl.Owner, repo.CloneUrl.RepositoryName, number).ToList(),
189189
(pr, files) => new { PullRequest = pr, Files = files })
190-
.Select(x => PullRequestCacheItem.Create(x.PullRequest, x.Files)),
190+
.Select(x => PullRequestCacheItem.Create(x.PullRequest, (IReadOnlyList<PullRequestFile>)x.Files)),
191191
TimeSpan.Zero,
192192
TimeSpan.FromDays(7))
193193
.Select(Create);
@@ -459,7 +459,7 @@ public static PullRequestCacheItem Create(PullRequest pr)
459459
return new PullRequestCacheItem(pr, new PullRequestFile[0]);
460460
}
461461

462-
public static PullRequestCacheItem Create(PullRequest pr, IList<PullRequestFile> files)
462+
public static PullRequestCacheItem Create(PullRequest pr, IReadOnlyList<PullRequestFile> files)
463463
{
464464
return new PullRequestCacheItem(pr, files);
465465
}
@@ -471,7 +471,7 @@ public PullRequestCacheItem(PullRequest pr)
471471
{
472472
}
473473

474-
public PullRequestCacheItem(PullRequest pr, IList<PullRequestFile> files)
474+
public PullRequestCacheItem(PullRequest pr, IReadOnlyList<PullRequestFile> files)
475475
{
476476
Title = pr.Title;
477477
Number = pr.Number;

src/GitHub.App/ViewModels/PullRequestDetailViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public async Task Load(IPullRequestModel pullRequest)
315315
IsBusy = false;
316316
}
317317

318-
static IEnumerable<IPullRequestFileNode> CreateChangedFilesList(IList<IPullRequestFileModel> files)
318+
static IEnumerable<IPullRequestFileNode> CreateChangedFilesList(IEnumerable<IPullRequestFileModel> files)
319319
{
320320
return files.Select(x => new PullRequestFileNode(x.FileName, x.Status));
321321
}

src/GitHub.Exports/Models/IPullRequestModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public interface IPullRequestModel : ICopyable<IPullRequestModel>,
3131
DateTimeOffset UpdatedAt { get; }
3232
IAccount Author { get; }
3333
IAccount Assignee { get; }
34-
IList<IPullRequestFileModel> ChangedFiles { get; }
34+
IReadOnlyCollection<IPullRequestFileModel> ChangedFiles { get; }
3535
}
3636
}

0 commit comments

Comments
 (0)