mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 11:33:41 +03:00
publish: handle read notifications properly
This commit is contained in:
parent
0e9ea8c039
commit
fd01162397
@ -54,6 +54,18 @@ export class Note extends Component {
|
||||
{
|
||||
window.api.fetchNote(this.props.ship, this.props.book, this.props.note);
|
||||
}
|
||||
if ((prevProps.book !== this.props.book) ||
|
||||
(prevProps.note !== this.props.note) ||
|
||||
(prevProps.ship !== this.props.ship)) {
|
||||
let readAction = {
|
||||
read: {
|
||||
who: this.props.ship.slice(1),
|
||||
book: this.props.book,
|
||||
note: this.props.note,
|
||||
}
|
||||
}
|
||||
window.api.action("publish", "publish-action", readAction);
|
||||
}
|
||||
}
|
||||
|
||||
onScroll() {
|
||||
|
@ -230,7 +230,10 @@ export class PrimaryReducer {
|
||||
state.notebooks[host][book].notes &&
|
||||
state.notebooks[host][book].notes[noteId])
|
||||
{
|
||||
state.notebooks[host][book].notes[noteId]["read"] = true;
|
||||
if (!state.notebooks[host][book].notes[noteId]["read"]) {
|
||||
state.notebooks[host][book].notes[noteId]["read"] = true;
|
||||
state.notebooks[host][book]["num-unread"] -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user