mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 14:13:21 +00:00
confirm chat delete & redirect, show msg form in single message view
This commit is contained in:
parent
f68da66aef
commit
4c2d417834
@ -265,6 +265,7 @@ function getMyName() { return myName; }
|
||||
function getMyProfilePhoto() { return myProfilePhoto; }
|
||||
|
||||
async function logOut() {
|
||||
route('/');
|
||||
if (State.electron) {
|
||||
State.electron.get('user').put(null);
|
||||
}
|
||||
@ -283,7 +284,6 @@ async function logOut() {
|
||||
}
|
||||
clearIndexedDB();
|
||||
localStorage.clear();
|
||||
route('/');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
|
@ -284,8 +284,8 @@ async (serialized, a, b, event) => {
|
||||
${(this.props.showReplies || s.showReplyForm) && s.sortedReplies && s.sortedReplies.length ? s.sortedReplies.map(r =>
|
||||
html`<${PublicMessage} measure=${this.props.measure} key=${r.hash} hash=${r.hash} asReply=${true} showName=${true} showReplies=${true} />`
|
||||
) : ''}
|
||||
${s.showReplyForm ? html`
|
||||
<${FeedMessageForm} replyingTo=${this.props.hash} replyingToUser=${s.msg.info.from} />
|
||||
${this.props.standalone || s.showReplyForm ? html`
|
||||
<${FeedMessageForm} autofocus=${!this.props.standalone} replyingTo=${this.props.hash} replyingToUser=${s.msg.info.from} />
|
||||
` : ''}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1218,6 +1218,18 @@ class Channel {
|
||||
gun.user().get('channels').get(channelId).put(null);
|
||||
gun.user().get('channels').get(channelId).off();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static async deleteGroup(gun, key, uuid) {
|
||||
const mySecret = await Gun.SEA.secret(key.epub, key);
|
||||
const mySecretHash = await util.getHash(mySecret);
|
||||
const mySecretUuid = await util.getHash(mySecretHash + uuid);
|
||||
gun.user().auth(key);
|
||||
gun.user().get('channels').get(mySecretUuid).put(null);
|
||||
gun.user().get('channels').get(mySecretUuid).off();
|
||||
}
|
||||
}
|
||||
|
||||
export default Channel;
|
||||
|
@ -15,11 +15,11 @@ import $ from 'jquery';
|
||||
import QRCode from '../lib/qrcode.min';
|
||||
import iris from '../iris-lib';
|
||||
|
||||
function deleteChat(pub) {
|
||||
function deleteChat(uuid) {
|
||||
if (confirm("Delete chat?")) {
|
||||
iris.Channel.deleteChannel(State.public, Session.getKey(), pub);
|
||||
delete Session.channels[pub];
|
||||
State.local.get('channels').get(pub).put(null);
|
||||
iris.Channel.deleteGroup(State.public, Session.getKey(), uuid);
|
||||
delete Session.channels[uuid];
|
||||
State.local.get('channels').get(uuid).put(null);
|
||||
route('/chat');
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ class Message extends View {
|
||||
}
|
||||
|
||||
renderView() {
|
||||
|
||||
let content;
|
||||
if (this.props.hash === 'new') {
|
||||
content = html`
|
||||
|
@ -22,9 +22,12 @@ import {Helmet} from "react-helmet";
|
||||
import {SMS_VERIFIER_PUB} from '../SMS';
|
||||
|
||||
function deleteChat(pub) {
|
||||
iris.Channel.deleteChannel(State.public, Session.getKey(), pub);
|
||||
delete Session.channels[pub];
|
||||
State.local.get('channels').get(pub).put(null);
|
||||
if (confirm(`${t('delete_chat')}?`)) {
|
||||
iris.Channel.deleteChannel(State.public, Session.getKey(), pub);
|
||||
delete Session.channels[pub];
|
||||
State.local.get('channels').get(pub).put(null);
|
||||
route(`/chat`);
|
||||
}
|
||||
}
|
||||
|
||||
class Profile extends View {
|
||||
|
Loading…
Reference in New Issue
Block a user