Browse Source

Add Pronouns support in vCard4

pull/1443/head
Timothée Jaussoin 5 months ago
parent
commit
7d14b1b6b6
  1. 1
      CHANGELOG.md
  2. 4
      app/Contact.php
  3. 6
      app/Widgets/ContactActions/_contactactions_drawer.tpl
  4. 6
      app/Widgets/ContactData/_contactdata_card.tpl
  5. 2
      app/Widgets/ContactData/locales.ini
  6. 1
      app/Widgets/Vcard4/Vcard4.php
  7. 9
      app/Widgets/Vcard4/_vcard4_form.tpl
  8. 21
      database/migrations/20250617191919_add_pronouns_to_contacts_table.php
  9. 6
      src/Moxl/Stanza/Vcard4.php

1
CHANGELOG.md

@ -17,6 +17,7 @@ v0.30.1 (master)
* Fix #1437 Generalize the instance nickname usage on the public blog and syndication feed, add a warning message if the instance nickname is changed
* Rename the config page to configuration
* Fix XMPP URI handling in Share
* Add Pronouns support in vCard4
v0.30
---------------------------

4
app/Contact.php

@ -248,6 +248,10 @@ class Contact extends Model
? $vcard->impp->uri
: null;
$this->pronouns = !empty($vcard->pronouns->text)
? (string)$vcard->pronouns->text
: null;
$this->adrlocality = !empty($vcard->adr->locality)
? (string)$vcard->adr->locality
: null;

6
app/Widgets/ContactActions/_contactactions_drawer.tpl

@ -84,6 +84,12 @@
<br />
{/if}
{if="$contact->pronouns"}
<i class="material-symbols icon-text">id_card</i>
{$contact->pronouns}
<br />
{/if}
{if="$contact->adrlocality != null || $contact->adrcountry != null"}
<i class="material-symbols icon-text">place</i>
{if="$contact->adrlocality != null"}

6
app/Widgets/ContactData/_contactdata_card.tpl

@ -35,6 +35,12 @@
<br />
{/if}
{if="$contact->pronouns"}
<i class="material-symbols icon-text">id_card</i>
{$contact->pronouns}
<br />
{/if}
{if="$contact->adrlocality != null || $contact->adrcountry != null"}
<i class="material-symbols icon-text">place</i>
{if="$contact->adrlocality != null"}

2
app/Widgets/ContactData/locales.ini

@ -1,6 +1,8 @@
[general]
legend = General Information
name = Name
pronouns = Pronouns
pronouns_example = "he/she/they/…"
nickname = Nickname
date_of_birth = Date of Birth
gender = Gender

1
app/Widgets/Vcard4/Vcard4.php

@ -78,6 +78,7 @@ class Vcard4 extends Base
: null;
$c->fn = $vcard->fn->value;
$c->pronouns = $vcard->pronouns->value;
$c->url = Validator::url()->notEmpty()->isValid($vcard->url->value)
? $vcard->url->value

9
app/Widgets/Vcard4/_vcard4_form.tpl

@ -19,6 +19,15 @@
<span class="supporting"><i class="material-symbols">lightbulb</i> {$c->__('vcard.nickname_info')}</span>
</div>
</li>
<li>
<span class="primary icon gray">
<i class="material-symbols">id_card</i>
</span>
<div>
<input type="pronouns" name="pronouns" value="{$contact->pronouns ?? ''}" placeholder="{$c->__('general.pronouns_example')}">
<label for="pronouns">{$c->__('general.pronouns')}</label>
</div>
</li>
<li>
<span class="primary icon gray">
<i class="material-symbols">email</i>

21
database/migrations/20250617191919_add_pronouns_to_contacts_table.php

@ -0,0 +1,21 @@
<?php
use Movim\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddPronounsToContactsTable extends Migration
{
public function up()
{
$this->schema->table('contacts', function (Blueprint $table) {
$table->string('pronouns')->nullable();
});
}
public function down()
{
$this->schema->table('contacts', function (Blueprint $table) {
$table->dropColumn('pronouns');
});
}
}

6
src/Moxl/Stanza/Vcard4.php

@ -48,6 +48,12 @@ class Vcard4
$vcard->appendChild($fn);
}
if (isset($data->pronouns)) {
$pronouns = $dom->createElement('pronouns');
$pronouns->appendChild($dom->createElement('text', $data->pronouns));
$vcard->appendChild($pronouns);
}
if (isset($data->name)) {
$nickname = $dom->createElement('nickname');
$nickname->appendChild($dom->createElement('text', $data->name));

Loading…
Cancel
Save