Merge branch 'la-unread' (#2064)

* origin/la-unread:
  chat-js: fix unread counts and indentation

Signed-off-by: Jared Tobin <jared@tlon.io>
This commit is contained in:
Jared Tobin 2019-12-10 17:05:43 +08:00
commit d21310ace8
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4
5 changed files with 265 additions and 257 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,6 @@ import _ from 'lodash';
import { Route, Link } from "react-router-dom";
import { store } from "/store";
import { Message } from '/components/lib/message';
import { SidebarSwitcher } from '/components/lib/icons/icon-sidebar-switch.js';
import { ChatTabBar } from '/components/lib/chat-tabbar';
@ -80,7 +79,7 @@ export class ChatScreen extends Component {
updateReadNumber() {
const { props, state } = this;
if (props.read < props.envelopes.length) {
if (props.read < props.length) {
props.api.chat.read(state.station);
}
}
@ -89,13 +88,13 @@ export class ChatScreen extends Component {
const { props, state } = this;
if (
state.numPages * 100 < props.envelopes.length - 400 ||
state.numPages * 100 < props.length - 400 ||
this.hasAskedForMessages
) {
return;
}
if (props.envelopes.length > 0) {
if (props.length > 0) {
let end = props.envelopes[0].number;
if (end > 0) {
let start = end - 400 > 0 ? end - 400 : 0;

View File

@ -22,8 +22,16 @@ export class SidebarInvite extends Component {
{props.invite.text}
</p>
</div>
<a className="dib pointer pa2 f9 bg-green2 white mt4" onClick={this.onAccept.bind(this)}>Accept Invite</a>
<a className="dib pointer ml4 pa2 f9 bg-black white mt4" onClick={this.onDecline.bind(this)}>Decline</a>
<a
className="dib pointer pa2 f9 bg-green2 white mt4"
onClick={this.onAccept.bind(this)}>
Accept Invite
</a>
<a
className="dib pointer ml4 pa2 f9 bg-black white mt4"
onClick={this.onDecline.bind(this)}>
Decline
</a>
</div>
)
}

View File

@ -133,7 +133,7 @@ export class Root extends Component {
let station = `/${props.match.params.ship}/${props.match.params.station}`;
let mailbox = state.inbox[station] || {
config: {
read: -1,
read: 0,
length: 0
},
envelopes: []
@ -154,6 +154,7 @@ export class Root extends Component {
api={api}
subscription={subscription}
read={mailbox.config.read}
length={mailbox.config.length}
envelopes={mailbox.envelopes}
inbox={state.inbox}
group={write}