mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-28 18:45:51 -05:00
Load initial members state via WHO when channel is selected
Closes: https://todo.sr.ht/~emersion/gamja/13
This commit is contained in:
parent
e815295503
commit
90a2c91651
2 changed files with 18 additions and 1 deletions
|
@ -578,6 +578,10 @@ export default class App extends Component {
|
|||
this.whoUserBuffer(buf.name, buf.server);
|
||||
}
|
||||
|
||||
if (buf.type === BufferType.CHANNEL && !buf.hasInitialWho) {
|
||||
this.whoChannelBuffer(buf.name, buf.server);
|
||||
}
|
||||
|
||||
if (buf.type !== BufferType.SERVER) {
|
||||
document.title = buf.name + ' · ' + this.baseTitle;
|
||||
} else {
|
||||
|
@ -1349,6 +1353,16 @@ export default class App extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
whoChannelBuffer(target, serverID) {
|
||||
let client = this.clients.get(serverID);
|
||||
|
||||
client.who(target, {
|
||||
fields: ["flags", "hostname", "nick", "realname", "username", "account"],
|
||||
}).then(() => {
|
||||
this.setBufferState({ name: target, server: serverID }, { hasInitialWho: true });
|
||||
});
|
||||
}
|
||||
|
||||
open(target, serverID, password) {
|
||||
if (!serverID) {
|
||||
serverID = State.getActiveServerID(this.state);
|
||||
|
@ -1359,7 +1373,9 @@ export default class App extends Component {
|
|||
this.switchBuffer({ server: serverID });
|
||||
} else if (client.isChannel(target)) {
|
||||
this.switchToChannel = target;
|
||||
client.join(target, password).catch((err) => {
|
||||
client.join(target, password).then(() => {
|
||||
this.whoChannelBuffer(target, serverID);
|
||||
}).catch((err) => {
|
||||
this.showError(err);
|
||||
});
|
||||
} else {
|
||||
|
|
1
state.js
1
state.js
|
@ -343,6 +343,7 @@ export const State = {
|
|||
serverInfo: null, // if server
|
||||
joined: false, // if channel
|
||||
topic: null, // if channel
|
||||
hasInitialWho: false, // if channel
|
||||
members: new irc.CaseMapMap(null, client.cm), // if channel
|
||||
messages: [],
|
||||
unread: Unread.NONE,
|
||||
|
|
Loading…
Reference in a new issue