Browse Source

Fix #1230 Disable post sharing when OMEMO is enabled with a contact

pull/1323/head
Timothée Jaussoin 2 years ago
parent
commit
14b265112f
  1. 2
      app/widgets/SendTo/SendTo.php
  2. 2
      app/widgets/SendTo/_sendto_share_contacts.tpl
  3. 12
      app/widgets/SendTo/sendto.js

2
app/widgets/SendTo/SendTo.php

@ -77,6 +77,7 @@ class SendTo extends Base
->get());
Drawer::fill('send_to_share', $view->draw('_sendto_share'));
$this->rpc('SendTo.init');
}
public function ajaxSend(string $to, $file, $muc = false, $message = false)
@ -107,6 +108,7 @@ class SendTo extends Base
{
$contacts = $this->user->session->topContacts()->with('presence')->get();
$this->rpc('MovimTpl.fill', '#sendto_share_contacts', $this->prepareContacts($contacts, $uri, ''));
$this->rpc('SendTo.init');
}
public function prepareContacts($contacts, string $uri, $openlink)

2
app/widgets/SendTo/_sendto_share_contacts.tpl

@ -4,7 +4,7 @@
</div>
</li>
{loop="$contacts"}
<li class="{if="$value->presence && $value->presence->value > 4"}faded{/if}">
<li class="{if="$value->presence && $value->presence->value > 4"}faded{/if}" data-jid="{$value->jid}">
<span class="primary icon bubble small
{if="!$value->presence || $value->presence->value > 4"}
disabled

12
app/widgets/SendTo/sendto.js

@ -1,5 +1,15 @@
var SendTo = {
shareArticle : function(link) {
init: function () {
document.querySelectorAll('#sendto_share_contacts > li[data-jid]').forEach(li => {
var store = new ChatOmemoStorage();
store.getContactState(li.dataset.jid).then(enabled => {
if (enabled) li.classList.add('disabled');
});
});
},
shareArticle: function (link) {
SendTo_ajaxShareArticle(link, typeof navigator.share == 'function');
},

Loading…
Cancel
Save