aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-11-16 02:54:10 +0100
committerMiquel Lionel <lionel@les-miquelots.net>2023-11-16 02:54:10 +0100
commitc87b58afca7c95f8bbc0b9a9c2e6c4a34a9214ce (patch)
tree35321c394f4c7b509c3ee159f7b4d72bb00e0eca /main/src/ui
parentc845fed2f1224fdb70a4dd5e20cf5321171f14c5 (diff)
downloaddino-c87b58afca7c95f8bbc0b9a9c2e6c4a34a9214ce.tar.gz
dino-c87b58afca7c95f8bbc0b9a9c2e6c4a34a9214ce.zip
Fix contact request notif piling upstop-duplicating-roster-subscription-box
- should close https://github.com/dino/dino/issues/1460
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/conversation_content_view/subscription_notification.vala41
1 files changed, 23 insertions, 18 deletions
diff --git a/main/src/ui/conversation_content_view/subscription_notification.vala b/main/src/ui/conversation_content_view/subscription_notification.vala
index b13301d6..f0cd7280 100644
--- a/main/src/ui/conversation_content_view/subscription_notification.vala
+++ b/main/src/ui/conversation_content_view/subscription_notification.vala
@@ -10,6 +10,7 @@ public class SubscriptionNotitication : Object {
private StreamInteractor stream_interactor;
private Conversation conversation;
private ConversationView conversation_view;
+ private bool notif_shown;
public SubscriptionNotitication(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
@@ -26,30 +27,34 @@ public class SubscriptionNotitication : Object {
public void init(Conversation conversation, ConversationView conversation_view) {
this.conversation = conversation;
this.conversation_view = conversation_view;
-
+ notif_shown = false;
if (stream_interactor.get_module(PresenceManager.IDENTITY).exists_subscription_request(conversation.account, conversation.counterpart)) {
show_notification();
}
}
private void show_notification() {
- Box box = new Box(Orientation.HORIZONTAL, 5);
- Button accept_button = new Button.with_label(_("Accept"));
- Button deny_button = new Button.with_label(_("Deny"));
- GLib.Application app = GLib.Application.get_default();
- accept_button.clicked.connect(() => {
- app.activate_action("accept-subscription", conversation.id);
- conversation_view.remove_notification(box);
- });
- deny_button.clicked.connect(() => {
- app.activate_action("deny-subscription", conversation.id);
- conversation_view.remove_notification(box);
- });
- box.append(new Label(_("This contact would like to add you to their contact list")) { margin_end=10 });
- box.append(accept_button);
- box.append(deny_button);
- conversation_view.remove_notification(box);
- conversation_view.add_notification(box);
+ if (notif_shown == false) {
+ Box box = new Box(Orientation.HORIZONTAL, 5);
+ Button accept_button = new Button.with_label(_("Accept"));
+ Button deny_button = new Button.with_label(_("Deny"));
+ GLib.Application app = GLib.Application.get_default();
+ accept_button.clicked.connect(() => {
+ app.activate_action("accept-subscription", conversation.id);
+ conversation_view.remove_notification(box);
+ notif_shown = true;
+ });
+ deny_button.clicked.connect(() => {
+ app.activate_action("deny-subscription", conversation.id);
+ conversation_view.remove_notification(box);
+ notif_shown = true;
+ });
+ box.append(new Label(_("This contact would like to add you to their contact list")) { margin_end=10 });
+ box.append(accept_button);
+ box.append(deny_button);
+ conversation_view.add_notification(box);
+ notif_shown = true;
+ }
}
}