Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/GitHub.InlineReviews/Services/PullRequestStatusBarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async Task RefreshCurrentSession(LocalRepositoryModel repository, IPullRequestSe
return;
}

var viewModel = CreatePullRequestStatusViewModel(session);
var viewModel = CreatePullRequestStatusViewModel(repository, session);
ShowStatus(viewModel);
}

Expand Down Expand Up @@ -155,13 +155,15 @@ async Task<bool> IsDotComOrEnterpriseRepository(LocalRepositoryModel repository)
return false;
}

PullRequestStatusViewModel CreatePullRequestStatusViewModel(IPullRequestSession session)
PullRequestStatusViewModel CreatePullRequestStatusViewModel(LocalRepositoryModel repository, IPullRequestSession session)
{
var pullRequestStatusViewModel = new PullRequestStatusViewModel(openPullRequestsCommand, showCurrentPullRequestCommand);
var pullRequest = session?.PullRequest;
pullRequestStatusViewModel.Number = pullRequest?.Number;
pullRequestStatusViewModel.Title = pullRequest?.Title;
return pullRequestStatusViewModel;
return new PullRequestStatusViewModel(openPullRequestsCommand, showCurrentPullRequestCommand)
{
Number = session?.PullRequest?.Number,
Title = session?.PullRequest?.Title,
RepositoryName = repository?.Name,
RepositoryOwner = repository?.Owner,
};
}

PullRequestStatusView ShowStatus(PullRequestStatusViewModel pullRequestStatusViewModel = null)
Expand Down
28 changes: 28 additions & 0 deletions src/GitHub.InlineReviews/ViewModels/PullRequestStatusViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class PullRequestStatusViewModel : INotifyPropertyChanged
{
int? number;
string title;
string repositoryName;
string repositoryOwner;

public PullRequestStatusViewModel(ICommand openPullRequestsCommand, ICommand showCurrentPullRequestCommand)
{
Expand Down Expand Up @@ -41,6 +43,32 @@ public string Title
}
}

public string RepositoryOwner
{
get { return repositoryOwner; }
set
{
if (repositoryOwner != value)
{
repositoryOwner = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryOwner)));
}
}
}

public string RepositoryName
{
get { return repositoryName; }
set
{
if (repositoryName != value)
{
repositoryName = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RepositoryName)));
}
}
}

public ICommand OpenPullRequestsCommand { get; }
public ICommand ShowCurrentPullRequestCommand { get; }

Expand Down
5 changes: 4 additions & 1 deletion src/GitHub.InlineReviews/Views/PullRequestStatusView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
Fill="White"
VerticalAlignment="Bottom"
Margin="0 0 4 0 "
Icon="git_pull_request" />
Icon="mark_github" />
<TextBlock VerticalAlignment="Center">
<Run Text="{Binding RepositoryOwner}" /> / <Run Text="{Binding RepositoryName}" />
</TextBlock>
</StackPanel>
</Button>
<Grid.ToolTip>
Expand Down