Example #1
0
        public async Task Save(PullRequestLocator prInfo, IRepoHistoryPersist persist)
        {
            if (!prInfo.IsValid())
            {
                return;
            }

            var newPrInfo = new PullRequestLocator()
            {
                Owner             = prInfo.Owner,
                Repository        = prInfo.Repository,
                PullRequestNumber = prInfo.PullRequestNumber,
            };

            if (PullRequests.Contains(prInfo))
            {
                PullRequests.Remove(prInfo);
            }
            PullRequests.Insert(0, newPrInfo);

            if (!Owners.Contains(prInfo.Owner))
            {
                Owners.Insert(0, prInfo.Owner);
            }
            if (!Repositories.Contains(prInfo.Repository))
            {
                Repositories.Insert(0, prInfo.Repository);
            }

            await persist.Save(ToContainer());
        }
Example #2
0
        private async Task SaveCommentsWithoutChangeBusyStatus(PullRequestLocator request)
        {
            if (request == null || !request.IsValid())
            {
                return;
            }
            var commentsContainer = _loadedComments;

            if (_loadedComments != null)
            {
                commentsContainer.AddComments(Diffs.ToList(), GeneralComments);
            }
            else
            {
                commentsContainer = CommentsContainer.From(Diffs, GeneralComments);
            }
            await _commentsPersist.Save(request, commentsContainer);
        }