Skip to content

Commit

Permalink
Merge pull request #187 from Expensify/tgolen-improve-starred
Browse files Browse the repository at this point in the history
Show on the K2 dashboard when someone else is the issue owner
  • Loading branch information
cristipaval authored May 1, 2024
2 parents 214638b + a590b45 commit 69926cf
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#1.3.63
- Allow for code owners to be assigned when there is only one person assigned
- Show on the K2 dashboard if an issue has an owner, and you're not the owner
- Add a filter for issues not owned by you

#1.3.62
- Design improvements for light and dark mode.

Expand Down
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "K2 for GitHub",
"version": "1.3.62",
"version": "1.3.63",
"description": "Manage your Kernel Scheduling from directly inside GitHub",

"browser_specific_settings": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "k2-extension",
"version": "1.3.62",
"version": "1.3.63",
"description": "A Chrome Extension for Kernel Schedule",
"private": true,
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/js/component/list-item/ListItemIssue.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class ListItemIssue extends React.Component {
{'★ '}
</span>
)}
{this.issueHasOwner && !this.isCurrentUserOwner && (
<span>
{'☆ '}
</span>
)}
<a
href={this.props.issue.url}
className={this.getClassName()}
Expand Down
13 changes: 12 additions & 1 deletion src/js/component/panel/PanelIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ const propTypes = {
/** If there are no issues to list in the panel, hide the panel entirely */
hideOnEmpty: PropTypes.bool,

/** If the issue is on HOLD, hide it */
hideIfHeld: PropTypes.bool,

/** If the issue is under review, hide it */
hideIfUnderReview: PropTypes.bool,

/** If the issue is owned by someone else, hide it */
hideIfOwnedBySomeoneElse: PropTypes.bool,
};
const defaultProps = {
filters: {
Expand All @@ -42,15 +47,17 @@ const defaultProps = {
hideOnEmpty: false,
hideIfHeld: false,
hideIfUnderReview: false,
hideIfOwnedBySomeoneElse: false,
};

function PanelIssues(props) {
let filteredData = props.data;

if (props.hideIfHeld || props.hideIfUnderReview) {
if (props.hideIfHeld || props.hideIfUnderReview || props.hideIfOwnedBySomeoneElse) {
filteredData = _.filter(props.data, (item) => {
const isHeld = item.title.toLowerCase().indexOf('[hold') > -1 ? ' hold' : '';
const isUnderReview = _.find(item.labels, label => label.name.toLowerCase() === 'reviewing');
const isOwnedBySomeoneElse = item.issueHasOwner && !item.currentUserIsOwner;

if (isHeld && props.hideIfHeld) {
return false;
Expand All @@ -60,6 +67,10 @@ function PanelIssues(props) {
return false;
}

if (isOwnedBySomeoneElse && props.hideIfOwnedBySomeoneElse) {
return false;
}

return true;
});
}
Expand Down
8 changes: 1 addition & 7 deletions src/js/lib/pages/github/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ const refreshAssignees = () => {
// Always start by erasing whatever was drawn before (so it always starts from a clean slate)
$('.js-issue-assignees .k2-element').remove();

// Do nothing if there is only one person assigned. Owners can only be set when there are
// multiple assignees
if ($('.js-issue-assignees > p > span').length <= 1) {
return;
}

// Check if there is an owner for the issue
const ghDescription = $('.comment-body').text();
const regexResult = ghDescription.match(/Current Issue Owner:\s@(?<owner>\S+)/i);
Expand All @@ -97,7 +91,7 @@ const refreshAssignees = () => {
} else {
$(el).append(`
<button type="button" class="Button flex-md-order-2 m-0 k2-element k2-button k2-button-make-owner" data-owner="${assignee}">
</button>
`);
}
Expand Down
5 changes: 5 additions & 0 deletions src/js/module/dashboard/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ function Legend() {
{' '}
Issue owner
</div>
<div>
<span></span>
{' '}
Issue is owned by someone else
</div>
<div className="issue">
<sup>I</sup>
{' '}
Expand Down
17 changes: 17 additions & 0 deletions src/js/module/dashboard/ListIssuesAssigned.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ class ListIssuesAssigned extends React.Component {

this.state = {shouldHideHeldIssues: false};
this.state = {shouldHideUnderReviewIssues: false};
this.state = {shouldHideOwnedBySomeoneElseIssues: false};
this.fetch = this.fetch.bind(this);
this.toggleHeldFilter = this.toggleHeldFilter.bind(this);
this.toggleUnderReviewFilter = this.toggleUnderReviewFilter.bind(this);
this.toggleOwnedBySomeoneElseFilter = this.toggleOwnedBySomeoneElseFilter.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -56,6 +58,10 @@ class ListIssuesAssigned extends React.Component {
this.setState(prevState => ({shouldHideUnderReviewIssues: !prevState.shouldHideUnderReviewIssues}));
}

toggleOwnedBySomeoneElseFilter() {
this.setState(prevState => ({shouldHideOwnedBySomeoneElseIssues: !prevState.shouldHideOwnedBySomeoneElseIssues}));
}

render() {
if (!this.props.issues) {
return (
Expand Down Expand Up @@ -90,6 +96,12 @@ class ListIssuesAssigned extends React.Component {
Under Review
</label>
</div>
<div className="checkbox">
<label>
<input type="checkbox" name="shouldHideIfUnderReview" id="shouldHideIfUnderReview" onChange={this.toggleOwnedBySomeoneElseFilter} />
Owned by Someone Else
</label>
</div>
</form>
</div>
<div className="d-flex flex-row">
Expand All @@ -100,6 +112,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Hourly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3 pr-3">
Expand All @@ -109,6 +122,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Daily'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3 pr-3">
Expand All @@ -118,6 +132,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Weekly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3">
Expand All @@ -127,6 +142,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Monthly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
</div>
Expand All @@ -139,6 +155,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.intersection(_.map(issue.labels, label => label.name), ['Hourly', 'Daily', 'Weekly', 'Monthly']).length === 0)}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
</div>
Expand Down

0 comments on commit 69926cf

Please sign in to comment.