Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #263 from tahnik/bugfix69
Browse files Browse the repository at this point in the history
Bugfix69
  • Loading branch information
tahnik authored May 11, 2018
2 parents 0ca0524 + be92927 commit 30973b9
Show file tree
Hide file tree
Showing 6 changed files with 4,162 additions and 3,812 deletions.
22 changes: 21 additions & 1 deletion app/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ let mainWindow;

console.time('startup'); //eslint-disable-line


/* eslint-disable */
function isInt(value) {
return !isNaN(value) &&
parseInt(Number(value)) === value &&
!isNaN(parseInt(value, 10));
}
/* eslint-enable */

function openRantComposer() {
mainWindow.show();
mainWindow.webContents.send('compose_rant');
Expand All @@ -54,7 +63,17 @@ function quitApp() {
const handleRedirect = (e, link) => {
if (url !== mainWindow.webContents.getURL()) {
e.preventDefault();
shell.openExternal(link);
if (link.indexOf('devrant.io') !== -1 || link.indexOf('devrant.com') !== -1) {
const pathArray = link.split( '/' );
const rantid = pathArray[pathArray.length - 1];
if (Number.isInteger(rantid)) {
shell.openExternal(link);
} else {
mainWindow.webContents.send('open-rant', { rantid });
}
} else {
shell.openExternal(link);
}
}
};

Expand Down Expand Up @@ -169,6 +188,7 @@ const shouldQuit = app.makeSingleInstance(() => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.show();
mainWindow.focus();
}
});
Expand Down
5 changes: 4 additions & 1 deletion app/src/js/components/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Item extends Component {
getItemCard() {
const { item } = this.state;
const {
theme, vote, cardItem, auth, open, showToast,
theme, vote, cardItem, auth, open, showToast, close
} = this.props;
const type = item.rant.rt === 2 ? ITEM.COLLAB.NAME : cardItem.type;
return (
Expand All @@ -149,8 +149,10 @@ class Item extends Component {
itemType={type}
auth={auth}
open={open}
close={close}
showToast={showToast}
fetchitem={() => this.fetchitem()}
history={this.props.history}
onEdit={(id, value) => this.onEdit(id, value, true)}
/>
);
Expand Down Expand Up @@ -254,6 +256,7 @@ Item.propTypes = {
open: PropTypes.func.isRequired,
showToast: PropTypes.func.isRequired,
fetchNotifs: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
};

export default Item;
4 changes: 4 additions & 0 deletions app/src/js/components/item/item_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ class ItemCard extends Component {
}
handleTagClick(term) {
const weekly = /(#?)wk(\d{0,3})/;
if (this.props.modal) {
this.props.close();
}
if (weekly.test(term)) {
this.props.history.replace(`/weekly/${term}`);
return;
Expand Down Expand Up @@ -354,6 +357,7 @@ ItemCard.propTypes = {
addMention: PropTypes.func,
fetchitem: PropTypes.func,
history: PropTypes.object,
close: PropTypes.func
};


Expand Down
6 changes: 6 additions & 0 deletions app/src/js/utils/ipcHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ export default (store) => {
.catch(() => {
});
});

ipcRenderer.on('open-rant', (e, args) => {
store.dispatch(
openModal(ITEM.RANT.NAME, args.rantid)
);
})
};

Loading

0 comments on commit 30973b9

Please sign in to comment.