From 91f03970d2f9215b615ec56a26c8f3dfe2904d84 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Tue, 10 Oct 2017 12:08:27 +0100 Subject: [PATCH 1/8] Fixed deleted user in notifications causing crash --- app/src/js/components/notifs/notif_bubble.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/js/components/notifs/notif_bubble.js b/app/src/js/components/notifs/notif_bubble.js index a6c8c42b..509a6534 100644 --- a/app/src/js/components/notifs/notif_bubble.js +++ b/app/src/js/components/notifs/notif_bubble.js @@ -30,10 +30,12 @@ class Notification extends Component { let icon; let imageSource = 'res/images/invis.png'; - if (user.avatar.i) { + if (user && user.avatar.i) { imageSource = `https://avatars.devrant.io/${user.avatar.i}`; } - const notifText = getNotifText(notif.type, user.name); + const username = user ? user.name : 'Deleted user'; + const avatarBack = user ? user.avatar.b : '#FFF'; + const notifText = getNotifText(notif.type, username); switch (notif.type) { case 'comment_mention': icon = 'ion-chatbubble-working'; @@ -56,7 +58,7 @@ class Notification extends Component { className="notif_bubble" >
- + @@ -71,7 +73,7 @@ class Notification extends Component { Notification.propTypes = { notif: PropTypes.object.isRequired, - user: PropTypes.object.isRequired, + user: PropTypes.object, open: PropTypes.func.isRequired, unread: PropTypes.number.isRequired, }; From 77568e3ea3432282688c832005207d27686bb922 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Tue, 10 Oct 2017 12:08:53 +0100 Subject: [PATCH 2/8] Fixed weekly reverting back to latest one when clicked on one of the filters --- app/src/js/components/weekly/weekly.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/js/components/weekly/weekly.js b/app/src/js/components/weekly/weekly.js index 52b51606..9b1f83cd 100644 --- a/app/src/js/components/weekly/weekly.js +++ b/app/src/js/components/weekly/weekly.js @@ -22,9 +22,13 @@ class Weekly extends Component { const { column } = this.props; const { weeks } = this.state; this.expand(); - this.props.fetch(column.sort, column.range, column.id, true, column.itemType, week); + this.props.fetch(column.sort, column.range, column.id, true, this.props.itemType, week); this.setState({ selection: weeks.length - week }); } + fetch(sort, range, id = 0, refresh = false, itemType) { + const { weeks } = this.state; + this.props.fetch(sort, range, id, refresh, itemType, weeks.length - this.state.selection); + } expand() { this.setState({ expanded: !this.state.expanded }); } @@ -68,7 +72,12 @@ class Weekly extends Component { )}
- + this.fetch(sort, range, id, refresh, itemType) + } + /> ); } @@ -78,6 +87,7 @@ Weekly.propTypes = { fetch: PropTypes.func.isRequired, column: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, + itemType: PropTypes.string.isRequired, }; export default Weekly; From 0d9c6d26a27c596ee81b0e12759b3b1f2138ead5 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Tue, 10 Oct 2017 12:12:51 +0100 Subject: [PATCH 3/8] fixed weekly staying on top on notifications --- app/src/res/sass/modules/weekly.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/res/sass/modules/weekly.sass b/app/src/res/sass/modules/weekly.sass index dde9e327..39ee2c9c 100644 --- a/app/src/res/sass/modules/weekly.sass +++ b/app/src/res/sass/modules/weekly.sass @@ -10,7 +10,7 @@ overflow-y: scroll width: calc(27rem + 2px) position: absolute - z-index: 100 + z-index: 89 top: 4rem margin-left: -0.5rem padding: 0.5rem From 9c4756aabae75bb5b7be8a9f478afc7a81a9c166 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Tue, 10 Oct 2017 14:50:25 +0100 Subject: [PATCH 4/8] Weekly now supports route params --- app/src/js/components/weekly/weekly.js | 22 ++++++++++++++++++++-- app/src/js/consts/routes.js | 2 +- app/src/js/routes/main.js | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/src/js/components/weekly/weekly.js b/app/src/js/components/weekly/weekly.js index 9b1f83cd..ddff7c5c 100644 --- a/app/src/js/components/weekly/weekly.js +++ b/app/src/js/components/weekly/weekly.js @@ -12,10 +12,20 @@ class Weekly extends Component { expanded: false, }; } - componentDidMount() { + componentWillMount() { + const regex = /wk(\d{0,3})/; + const weekString = this.props.match.params.week; + let week = -1; + if (regex.test(weekString)) { + const { column } = this.props; + week = weekString.replace(/^\D+/g, ''); + this.props.fetch(column.sort, column.range, column.id, true, this.props.itemType, week); + } rantscript.listWeekly() .then((res) => { this.setState({ weeks: res }); + console.log(week); + this.setState({ selection: res.length - (week === -1 ? res.length : week) }); }); } onClick(week = 67) { @@ -35,6 +45,10 @@ class Weekly extends Component { render() { const { weeks, selection, expanded } = this.state; const { theme } = this.props; + const selectedWeek = weeks[selection] || weeks[weeks.length - 1]; + + console.log(selectedWeek); + console.log(selection); return (
@@ -47,7 +61,10 @@ class Weekly extends Component { >
- {weeks.length !== 0 ? (wk{weeks[selection].week} {weeks[selection].prompt}) : 'Loading weeks...'} + {weeks.length !== 0 ? + (wk{selectedWeek.week} {selectedWeek.prompt}) + : 'Loading weeks...' + }
@@ -87,6 +104,7 @@ Weekly.propTypes = { fetch: PropTypes.func.isRequired, column: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, + match: PropTypes.object.isRequired, itemType: PropTypes.string.isRequired, }; diff --git a/app/src/js/consts/routes.js b/app/src/js/consts/routes.js index 65fcb1a2..ced673bd 100644 --- a/app/src/js/consts/routes.js +++ b/app/src/js/consts/routes.js @@ -2,7 +2,7 @@ export default { rants: '/rants', collabs: '/collabs', stories: '/stories', - weekly: '/weekly', + weekly: '/weekly/latest', settings: '/settings', custom: '/custom', search: '/search/Cw0DCAAHDAcOBg8MBAIDAA', diff --git a/app/src/js/routes/main.js b/app/src/js/routes/main.js index f52363aa..c0c9875c 100644 --- a/app/src/js/routes/main.js +++ b/app/src/js/routes/main.js @@ -57,7 +57,7 @@ const MainRoutes = props => ( )} /> ( )} From ecc68381b74ceabe9ae1002ca6548511568f31bf Mon Sep 17 00:00:00 2001 From: rekkyrek Date: Tue, 10 Oct 2017 17:27:07 +0200 Subject: [PATCH 5/8] Changed dropdown animation a bit --- app/src/res/sass/modules/dropdown.sass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/res/sass/modules/dropdown.sass b/app/src/res/sass/modules/dropdown.sass index d2bb0cde..f23525a3 100644 --- a/app/src/res/sass/modules/dropdown.sass +++ b/app/src/res/sass/modules/dropdown.sass @@ -28,8 +28,8 @@ padding: 8px background-color: #40415A opacity: 0 - transform: translateY(-10px) - transition: all 0.4s + transform: translateY(-24px) + transition: all 0.2s cubic-bezier(0.65, 0, 0.35, 1) position: absolute width: 100% pointer-events: none From 3901da2343d73007a98c2ad4c3af805c10464813 Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Tue, 10 Oct 2017 23:00:06 +0100 Subject: [PATCH 6/8] Clicking weekly tags will now take to weekly page --- app/src/js/components/item/item_card.js | 10 +++++++++- app/src/js/components/weekly/weekly.js | 6 +----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/js/components/item/item_card.js b/app/src/js/components/item/item_card.js index 494227a2..a2357427 100644 --- a/app/src/js/components/item/item_card.js +++ b/app/src/js/components/item/item_card.js @@ -144,6 +144,14 @@ class ItemCard extends Component { } shell.openExternal(fURL); } + handleTagClick(term) { + const weekly = /(#?)wk(\d{0,3})/; + if (weekly.test(term)) { + this.props.history.replace(`/weekly/${term}`); + return; + } + this.props.history.replace(`/search/${term}`); + } getTags() { const { item } = this.props; if (!item.tags) { @@ -156,7 +164,7 @@ class ItemCard extends Component { this.props.history.replace(`/search/${object}`)} + onClick={() => this.handleTagClick(object)} >{object} ))}
} diff --git a/app/src/js/components/weekly/weekly.js b/app/src/js/components/weekly/weekly.js index ddff7c5c..f3f04737 100644 --- a/app/src/js/components/weekly/weekly.js +++ b/app/src/js/components/weekly/weekly.js @@ -13,7 +13,7 @@ class Weekly extends Component { }; } componentWillMount() { - const regex = /wk(\d{0,3})/; + const regex = /(#?)wk(\d{0,3})/; const weekString = this.props.match.params.week; let week = -1; if (regex.test(weekString)) { @@ -24,7 +24,6 @@ class Weekly extends Component { rantscript.listWeekly() .then((res) => { this.setState({ weeks: res }); - console.log(week); this.setState({ selection: res.length - (week === -1 ? res.length : week) }); }); } @@ -47,9 +46,6 @@ class Weekly extends Component { const { theme } = this.props; const selectedWeek = weeks[selection] || weeks[weeks.length - 1]; - console.log(selectedWeek); - console.log(selection); - return (
Date: Tue, 10 Oct 2017 23:00:36 +0100 Subject: [PATCH 7/8] Testing notif without setting check_time --- app/src/js/actions/notifs.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/src/js/actions/notifs.js b/app/src/js/actions/notifs.js index e0ecc1ba..963972f2 100644 --- a/app/src/js/actions/notifs.js +++ b/app/src/js/actions/notifs.js @@ -54,14 +54,6 @@ const fetchNotifs = (refresh = false) => (dispatch, getState) => { && newNumUnread === currentNumUnread) && newItems.length === 0 ) { - const notifs = { - ...prevNotifs, - num_unread: newNumUnread, - }; - dispatch({ - type: NOTIFS.FETCH, - notifs, - }); return; } if ( From 672aca5300e8210e1550822e76e19a996ba458fa Mon Sep 17 00:00:00 2001 From: Tahnik Mustasin Date: Wed, 11 Oct 2017 00:11:33 +0100 Subject: [PATCH 8/8] updated packege version and update.md --- package-lock.json | 2 +- package.json | 2 +- update.md | 22 ++++++---------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf6e13ef..f8d6538a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "devrantron", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5f9b74ae..3fea2424 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "devrantron", - "version": "1.4.1", + "version": "1.4.2", "main": "./build/app/app.js", "description": "An open source cross platform desktop application for devRant", "scripts": { diff --git a/update.md b/update.md index d02cad38..ab74b2c0 100644 --- a/update.md +++ b/update.md @@ -1,22 +1,12 @@ # What's new? ![devRantron](https://i.imgur.com/RteqoFG.png) -## Weekly -You can now browse weekly +## Weekly fix +* Fixed a bug where clicking on a filter would change weekly to the most recent week +* Clicking on a week tag will now open weekly +* Fixed a bug where weekly popup would appear over notifications if left open -## Edit rants and comments -Now you can edit rants and comments in desktop! - -## Save draft rants -Rants will be automatically saved if it is not posted. You can also save drafts of rants now so that you can post them later - -## Performance optimization -Optimized notifications and updated react to v16. Also, we changed how webpack compiles our app and it optimizes a lot more than before - -## Confirmation before deleting rants or comments -We now show confirmation dialog before deleting rants or comments - -## Release info and update notifications for macOS and linux -App will now show release notes before updating. macOS and linux users should also receive updates. +## Deleted user causing crash +* If a user caused a notification and has removed their account, the app would crash. Fixed that bug And a lot more bugfixes and optimizations. We hope you enjoy!