示例#1
0
        private void Load()
        {
            var pullRequestApi = _plugin.GetPullRequestApi();

            _pullRequest = pullRequestApi.GetById(_owner, _repositoryName, _id);

            Entries = new List <IDiscussionEntry>();

            GithubDiscussionEntry da = new GithubDiscussionEntry(_githubPullReqInfo.Owner, _githubPullReqInfo.Created, _githubPullReqInfo.Body);

            Entries.Add(da);

            foreach (var el in _pullRequest.Discussion)
            {
                GithubDiscussionEntry de;
                string author = GetAuthorFrom(el.User) ?? GetAuthorFrom(el.Author) ?? "!UNKNOWN!";

                if (el.Type.ToLowerInvariant() == "commit")
                {
                    de = new GithubCommitDiscussionEntry(author, el.Created, el.Message, el.Id);
                }
                else if (el.Type.ToLowerInvariant() == "issuecomment")
                {
                    de = new GithubDiscussionEntry(author, el.Created, el.Body);
                }
                else
                {
                    de = new GithubDiscussionEntry("ERROR", DateTime.Now, "COULD NOT UNDERSTAND A DISCUSSION ENTRY");
                }
                Entries.Add(de);
            }
        }
        private void Load()
        {
            var pullRequestApi = _plugin.GetPullRequestApi();
            _pullRequest = pullRequestApi.GetById(_owner, _repositoryName, _id);

            Entries = new List<IDiscussionEntry>();

            GithubDiscussionEntry da = new GithubDiscussionEntry(_githubPullReqInfo.Owner, _githubPullReqInfo.Created, _githubPullReqInfo.Body);
            Entries.Add(da);

            foreach (var el in _pullRequest.Discussion)
            {
                GithubDiscussionEntry de;
                string author;
                if (el.User == null)
                    author = string.Format("{0} ({1})", el.Author, el.Email);
                else
                    author = el.User.Login;

                if (el.Type.ToLowerInvariant() == "commit")
                    de = new GithubCommitDiscussionEntry(author, el.Created, el.Subject, el.Sha);
                else if (el.Type.ToLowerInvariant() == "issuecomment")
                    de = new GithubDiscussionEntry(author, el.Created, el.Body);
                else
                    de = new GithubDiscussionEntry("ERROR", DateTime.Now, "COULD NOT UNDERSTAND A DISCUSSION ENTRY");
                Entries.Add(de);
            }
        }
        private void Load()
        {
            var pullRequestApi = _plugin.GetPullRequestApi();
            _pullRequest = pullRequestApi.GetById(_owner, _repositoryName, _id);

            Entries = new List<IDiscussionEntry>();

            GithubDiscussionEntry da = new GithubDiscussionEntry(_githubPullReqInfo.Owner, _githubPullReqInfo.Created, _githubPullReqInfo.Body);
            Entries.Add(da);

            foreach (var el in _pullRequest.Discussion)
            {
                GithubDiscussionEntry de;
                string author = GetAuthorFrom(el.User) ?? GetAuthorFrom(el.Author) ?? "!UNKNOWN!";

                if (el.Type.ToLowerInvariant() == "commit")
                    de = new GithubCommitDiscussionEntry(author, el.Created, el.Message, el.Id);
                else if (el.Type.ToLowerInvariant() == "issuecomment")
                    de = new GithubDiscussionEntry(author, el.Created, el.Body);
                else
                    de = new GithubDiscussionEntry("ERROR", DateTime.Now, "COULD NOT UNDERSTAND A DISCUSSION ENTRY");
                Entries.Add(de);
            }
        }