Browse Source

Unblocking

pull/197/head
Sarah Jamie Lewis 6 months ago
parent
commit
0d6dd0e7ed

+ 15
- 4
go/gothings/gcd.go View File

@@ -52,11 +52,12 @@ type GrandCentralDispatcher struct {
_ func(str string) `signal:"InvokePopup"`
_ func(zoom, locale string) `signal:"SupplySettings"`
_ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"`
_ func(onion, nick string) `signal:"SupplyPeerSettings"`
_ func(onion, nick string, blocked bool) `signal:"SupplyPeerSettings"`

// signals emitted from the ui (written in go, below)
_ func(message string, mid string) `signal:"sendMessage,auto"`
_ func(onion string) `signal:"blockPeer,auto"`
_ func(onion string) `signal:"unblockPeer,auto"`
_ func(onion string) `signal:"loadMessagesPane,auto"`
_ func(signal string) `signal:"broadcast,auto"` // convenience relay signal
_ func(str string) `signal:"importString,auto"`
@@ -285,18 +286,18 @@ func (this *GrandCentralDispatcher) requestPeerSettings() {
contact := the.Peer.GetContact(this.CurrentOpenConversation())
if contact == nil {
log.Errorf("error: requested settings for unknown contact %v?", this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), false)
return
}

name, exists := contact.GetAttribute("nick")
if !exists {
log.Errorf("error: couldn't find contact %v", this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation())
this.SupplyPeerSettings(this.CurrentOpenConversation(), this.CurrentOpenConversation(), contact.Blocked)
return
}

this.SupplyPeerSettings(contact.Onion, name)
this.SupplyPeerSettings(contact.Onion, name, contact.Blocked)
}

func (this *GrandCentralDispatcher) savePeerSettings(onion, nick string) {
@@ -492,6 +493,16 @@ func (this *GrandCentralDispatcher) blockPeer(onion string) {
this.UIState.UpdateContact(onion)
}

func (this *GrandCentralDispatcher) unblockPeer(onion string) {
err := the.Peer.UnblockPeer(onion)
if err != nil {
this.InvokePopup("Error Unblocking Peer: " + err.Error())
}
the.Peer.PeerWithOnion(onion)
this.UIState.UpdateContact(onion)
}


func (this *GrandCentralDispatcher) inviteToGroup(onion, groupID string) {
err := the.Peer.InviteOnionToGroup(onion, groupID)
if err != nil {

+ 6
- 0
go/gothings/uistate.go View File

@@ -177,6 +177,12 @@ func (this *InterfaceState) UpdateContact(handle string) {
c.Blocked = contact.Blocked
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading)
}
} else {
cif, found := this.contacts.Load(handle)
if found {
c := cif.(*gobjects.Contact)
this.parentGcd.UpdateContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted, c.Blocked, c.Loading)
}
}
}


+ 6
- 1
i18n/translation_de.ts View File

@@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>löschen</translation>
</message>

BIN
i18n/translation_en.qm View File


+ 6
- 1
i18n/translation_en.ts View File

@@ -255,7 +255,12 @@
<translation>Block Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation>Unblock Peer</translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Delete</translation>
</message>

+ 6
- 1
i18n/translation_fr.ts View File

@@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Effacer</translation>
</message>

+ 6
- 1
i18n/translation_pt.ts View File

@@ -255,7 +255,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="94"/>
<location filename="../qml/panes/PeerSettingsPane.qml" line="85"/>
<source>unblock-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/PeerSettingsPane.qml" line="99"/>
<source>delete-btn</source>
<translation>Deletar</translation>
</message>

+ 1
- 1
qml/overlays/BulletinOverlay.qml View File

@@ -92,7 +92,7 @@ ColumnLayout {
}
}

onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
if (_loading == true) {
newposttitle.enabled = false

+ 1
- 1
qml/overlays/ChatOverlay.qml View File

@@ -110,7 +110,7 @@ ColumnLayout {
messagesListView.positionViewAtEnd()
}

onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
// Group is Synced OR p2p is Authenticated
if ( (_handle.length == 32 && _status == 4) || _status == 3) {

+ 1
- 1
qml/overlays/ListOverlay.qml View File

@@ -96,7 +96,7 @@ ColumnLayout {
}
}

onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _loading) {
onUpdateContact: function(_handle, _displayName, _image, _server, _badge, _status, _trusted, _blocked, _loading) {
if (gcd.currentOpenConversation == _handle) {
if (_loading == true) {
newposttitle.enabled = false

+ 10
- 4
qml/panes/PeerSettingsPane.qml View File

@@ -12,7 +12,7 @@ import "../styles"
ColumnLayout { // peerSettingsPane
id: root
anchors.fill: parent
property bool blocked

StackToolbar {
id: toolbar
@@ -82,10 +82,15 @@ ColumnLayout { // peerSettingsPane

SimpleButton {
icon: "solid/hand-paper"
text: qsTr("block-btn")
text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn")

onClicked: {
gcd.blockPeer(txtOnion.text)
if (root.blocked) {
gcd.unblockPeer(txtOnion.text)
} else {
gcd.blockPeer(txtOnion.text)
}
root.blocked = !root.blocked
}
}

@@ -106,10 +111,11 @@ ColumnLayout { // peerSettingsPane
Connections {
target: gcd

onSupplyPeerSettings: function(onion, nick) {
onSupplyPeerSettings: function(onion, nick, blocked) {
toolbar.text = nick
txtOnion.text = onion
txtDisplayName.text = nick
root.blocked = blocked
}
}
}

+ 1
- 1
qml/widgets/ContactList.qml View File

@@ -56,9 +56,9 @@ ColumnLayout {
"_badge": badge,
"_status": status,
"_trusted": trusted,
"_blocked": blocked,
"_deleted": false,
"_loading": loading,
"_blocked": blocked
})
}


Loading…
Cancel
Save