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 #204 from tahnik/hotfix_3
Browse files Browse the repository at this point in the history
Hotfix 3
  • Loading branch information
tahnik authored Oct 10, 2017
2 parents ac89c41 + 672aca5 commit c15d737
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 40 deletions.
8 changes: 0 additions & 8 deletions app/src/js/actions/notifs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
10 changes: 9 additions & 1 deletion app/src/js/components/item/item_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -156,7 +164,7 @@ class ItemCard extends Component {
<span
key={object}
className="tag"
onClick={() => this.props.history.replace(`/search/${object}`)}
onClick={() => this.handleTagClick(object)}
>{object}</span>
))}
</div>}
Expand Down
10 changes: 6 additions & 4 deletions app/src/js/components/notifs/notif_bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -56,7 +58,7 @@ class Notification extends Component {
className="notif_bubble"
>
<div className={`notif_badge ${notif.read === 1 ? 'read' : ''}`}>
<img alt="" src={imageSource} className="notif_image" style={{ background: `#${user.avatar.b}` }} />
<img alt="" src={imageSource} className="notif_image" style={{ background: `#${avatarBack}` }} />
<i
className={`${icon} ${notif.read === 1 || unread === 0 ? 'read' : ''}`}
/>
Expand All @@ -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,
};
Expand Down
32 changes: 28 additions & 4 deletions app/src/js/components/weekly/weekly.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,39 @@ 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 });
this.setState({ selection: res.length - (week === -1 ? res.length : week) });
});
}
onClick(week = 67) {
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 });
}
render() {
const { weeks, selection, expanded } = this.state;
const { theme } = this.props;
const selectedWeek = weeks[selection] || weeks[weeks.length - 1];

return (
<div className="weekly_container">
Expand All @@ -43,7 +57,10 @@ class Weekly extends Component {
>
<div className="weekly_option">
<div className="weekDesc">
{weeks.length !== 0 ? (<span><b>wk{weeks[selection].week}</b> {weeks[selection].prompt}</span>) : 'Loading weeks...'}
{weeks.length !== 0 ?
(<span><b>wk{selectedWeek.week}</b> {selectedWeek.prompt}</span>)
: 'Loading weeks...'
}
</div>
<i className={`selBtn ${expanded ? 'ion-chevron-up' : 'ion-chevron-down'}`} />
</div>
Expand All @@ -68,7 +85,12 @@ class Weekly extends Component {
)}
</div>

<Column {...this.props} />
<Column
{...this.props}
fetch={
(sort, range, id, refresh, itemType) => this.fetch(sort, range, id, refresh, itemType)
}
/>
</div>
);
}
Expand All @@ -78,6 +100,8 @@ Weekly.propTypes = {
fetch: PropTypes.func.isRequired,
column: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
itemType: PropTypes.string.isRequired,
};

export default Weekly;
2 changes: 1 addition & 1 deletion app/src/js/consts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
rants: '/rants',
collabs: '/collabs',
stories: '/stories',
weekly: '/weekly',
weekly: '/weekly/latest',
settings: '/settings',
custom: '/custom',
search: '/search/Cw0DCAAHDAcOBg8MBAIDAA',
Expand Down
2 changes: 1 addition & 1 deletion app/src/js/routes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const MainRoutes = props => (
)}
/>
<Route
path="/weekly"
path="/weekly/:week"
render={() => (
<Weekly />
)}
Expand Down
4 changes: 2 additions & 2 deletions app/src/res/sass/modules/dropdown.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/res/sass/modules/weekly.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
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": "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": {
Expand Down
22 changes: 6 additions & 16 deletions update.md
Original file line number Diff line number Diff line change
@@ -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!

0 comments on commit c15d737

Please sign in to comment.