Browse Source

Updated recipients' key tooltip

Will Browning 3 years ago
parent
commit
5dd1742f2a

+ 1 - 0
app/Http/Controllers/ShowRecipientController.php

@@ -38,6 +38,7 @@ class ShowRecipientController extends Controller
             'recipients' => $recipients,
             'aliasesUsingDefault' => user()->aliasesUsingDefault()->take(5)->get(),
             'aliasesUsingDefaultCount' => user()->aliasesUsingDefault()->count(),
+            'user' => user()->load('defaultUsername')
         ]);
     }
 }

+ 1 - 0
app/Http/Resources/UserResource.php

@@ -26,6 +26,7 @@ class UserResource extends JsonResource
             'banner_location' => $this->banner_location,
             'bandwidth' => $this->bandwidth,
             'username_count' => $this->username_count,
+            'default_username_id' => $this->default_username_id,
             'default_recipient_id' => $this->default_recipient_id,
             'default_alias_domain' => $this->default_alias_domain,
             'default_alias_format' => $this->default_alias_format,

+ 0 - 16
app/Models/User.php

@@ -309,22 +309,6 @@ class User extends Authenticatable implements MustVerifyEmail
         });
     }
 
-    /**
-     * Disable catch-all for the user.
-     */
-    public function disableCatchAll()
-    {
-        $this->update(['catch_all' => false]);
-    }
-
-    /**
-     * Enable catch-all for the user.
-     */
-    public function enableCatchAll()
-    {
-        $this->update(['catch_all' => true]);
-    }
-
     /**
      * Send the email verification notification.
      *

+ 6 - 6
composer.lock

@@ -9166,16 +9166,16 @@
         },
         {
             "name": "composer/semver",
-            "version": "3.3.0",
+            "version": "3.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/semver.git",
-                "reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b"
+                "reference": "5d8e574bb0e69188786b8ef77d43341222a41a71"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/semver/zipball/f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
-                "reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
+                "url": "https://api.github.com/repos/composer/semver/zipball/5d8e574bb0e69188786b8ef77d43341222a41a71",
+                "reference": "5d8e574bb0e69188786b8ef77d43341222a41a71",
                 "shasum": ""
             },
             "require": {
@@ -9227,7 +9227,7 @@
             "support": {
                 "irc": "irc://irc.freenode.org/composer",
                 "issues": "https://github.com/composer/semver/issues",
-                "source": "https://github.com/composer/semver/tree/3.3.0"
+                "source": "https://github.com/composer/semver/tree/3.3.1"
             },
             "funding": [
                 {
@@ -9243,7 +9243,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-03-15T08:35:57+00:00"
+            "time": "2022-03-16T11:22:07+00:00"
         },
         {
             "name": "composer/xdebug-handler",

+ 2 - 2
config/version.yml

@@ -5,9 +5,9 @@ current:
   major: 0
   minor: 11
   patch: 1
-  prerelease: 1-g2340e25
+  prerelease: 2-gdfb7809
   buildmetadata: ''
-  commit: '2340e2'
+  commit: dfb780
   timestamp:
     year: 2020
     month: 10

+ 18 - 18
package-lock.json

@@ -1885,9 +1885,9 @@
             }
         },
         "node_modules/@types/json-schema": {
-            "version": "7.0.9",
-            "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
-            "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ=="
+            "version": "7.0.10",
+            "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz",
+            "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A=="
         },
         "node_modules/@types/mime": {
             "version": "1.3.2",
@@ -3147,9 +3147,9 @@
             }
         },
         "node_modules/collect.js": {
-            "version": "4.31.3",
-            "resolved": "https://registry.npmjs.org/collect.js/-/collect.js-4.31.3.tgz",
-            "integrity": "sha512-pHXhGzo5qftTTlEj88MCRXN8YuhARhmEnCOmc7wzBlI+5fVVC5VZ9Z/Z5KEDuM90Fgwv025Fc2Gk4VpFKMrzQA=="
+            "version": "4.32.0",
+            "resolved": "https://registry.npmjs.org/collect.js/-/collect.js-4.32.0.tgz",
+            "integrity": "sha512-Ro0fspulC0J325cgFdkzFEkRDs6MmclMy2Fy5adhdFKg5QqMv1nn1zLpCdAxiehlur6Ep08Wr1f7ldNv+fB6+Q=="
         },
         "node_modules/color-convert": {
             "version": "2.0.1",
@@ -4042,9 +4042,9 @@
             "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
         },
         "node_modules/electron-to-chromium": {
-            "version": "1.4.85",
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.85.tgz",
-            "integrity": "sha512-K9AsQ41WS2bjZUFpRWfvaS4RjEcRCamEkBJN1Z1TQILBfP1H8QnJ9ti0wiLiMv0sRjX3EHKzgs9jDnmGFx2jXg=="
+            "version": "1.4.86",
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.86.tgz",
+            "integrity": "sha512-EVTZ+igi8x63pK4bPuA95PXIs2b2Cowi3WQwI9f9qManLiZJOD1Lash1J3W4TvvcUCcIR4o/rgi9o8UicXSO+w=="
         },
         "node_modules/elliptic": {
             "version": "6.5.4",
@@ -10858,9 +10858,9 @@
             }
         },
         "@types/json-schema": {
-            "version": "7.0.9",
-            "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
-            "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ=="
+            "version": "7.0.10",
+            "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz",
+            "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A=="
         },
         "@types/mime": {
             "version": "1.3.2",
@@ -11863,9 +11863,9 @@
             }
         },
         "collect.js": {
-            "version": "4.31.3",
-            "resolved": "https://registry.npmjs.org/collect.js/-/collect.js-4.31.3.tgz",
-            "integrity": "sha512-pHXhGzo5qftTTlEj88MCRXN8YuhARhmEnCOmc7wzBlI+5fVVC5VZ9Z/Z5KEDuM90Fgwv025Fc2Gk4VpFKMrzQA=="
+            "version": "4.32.0",
+            "resolved": "https://registry.npmjs.org/collect.js/-/collect.js-4.32.0.tgz",
+            "integrity": "sha512-Ro0fspulC0J325cgFdkzFEkRDs6MmclMy2Fy5adhdFKg5QqMv1nn1zLpCdAxiehlur6Ep08Wr1f7ldNv+fB6+Q=="
         },
         "color-convert": {
             "version": "2.0.1",
@@ -12547,9 +12547,9 @@
             "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
         },
         "electron-to-chromium": {
-            "version": "1.4.85",
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.85.tgz",
-            "integrity": "sha512-K9AsQ41WS2bjZUFpRWfvaS4RjEcRCamEkBJN1Z1TQILBfP1H8QnJ9ti0wiLiMv0sRjX3EHKzgs9jDnmGFx2jXg=="
+            "version": "1.4.86",
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.86.tgz",
+            "integrity": "sha512-EVTZ+igi8x63pK4bPuA95PXIs2b2Cowi3WQwI9f9qManLiZJOD1Lash1J3W4TvvcUCcIR4o/rgi9o8UicXSO+w=="
         },
         "elliptic": {
             "version": "6.5.4",

+ 1 - 1
resources/js/pages/Recipients.vue

@@ -55,7 +55,7 @@
           Key
           <span
             class="tooltip outline-none"
-            :data-tippy-content="`Use this to attach recipients to new aliases as they are created e.g. alias+key@${user.username}.anonaddy.com. You can attach multiple recipients by doing alias+2.3.4@${user.username}.anonaddy.com. Separating each key by a full stop.`"
+            :data-tippy-content="`Use this to attach recipients to new aliases as they are created e.g. alias+key@${user.default_username.username}.anonaddy.com. You can attach multiple recipients by doing alias+2.3.4@${user.default_username.username}.anonaddy.com. Separating each key by a full stop.`"
           >
             <icon name="info" class="inline-block w-4 h-4 text-grey-300 fill-current" />
           </span>

+ 1 - 1
resources/views/recipients/index.blade.php

@@ -4,6 +4,6 @@
     <div class="container py-8">
         @include('shared.status')
 
-        <recipients :user="{{json_encode(Auth::user())}}" :initial-recipients="{{json_encode($recipients)}}" :aliases-using-default="{{json_encode($aliasesUsingDefault)}}" :aliases-using-default-count="{{$aliasesUsingDefaultCount}}" domain="{{config('anonaddy.domain')}}" />
+        <recipients :user="{{json_encode($user)}}" :initial-recipients="{{json_encode($recipients)}}" :aliases-using-default="{{json_encode($aliasesUsingDefault)}}" :aliases-using-default-count="{{$aliasesUsingDefaultCount}}" domain="{{config('anonaddy.domain')}}" />
     </div>
 @endsection

+ 10 - 5
tests/Feature/Api/UsernamesTest.php

@@ -17,6 +17,11 @@ class UsernamesTest extends TestCase
     {
         parent::setUp();
         parent::setUpPassport();
+
+        $this->user->recipients()->save($this->user->defaultRecipient);
+        $this->user->usernames()->save($this->user->defaultUsername);
+        $this->user->defaultUsername->username = 'johndoe';
+        $this->user->defaultUsername->save();
     }
 
     /** @test */
@@ -32,7 +37,7 @@ class UsernamesTest extends TestCase
 
         // Assert
         $response->assertSuccessful();
-        $this->assertCount(3, $response->json()['data']);
+        $this->assertCount(4, $response->json()['data']);
     }
 
     /** @test */
@@ -85,7 +90,7 @@ class UsernamesTest extends TestCase
 
         $response->assertStatus(403);
         $this->assertEquals(3, $this->user->username_count);
-        $this->assertCount(3, $this->user->usernames);
+        $this->assertCount(4, $this->user->usernames);
     }
 
     /** @test */
@@ -186,7 +191,7 @@ class UsernamesTest extends TestCase
         $response = $this->json('DELETE', '/api/v1/active-usernames/'.$username->id);
 
         $response->assertStatus(204);
-        $this->assertFalse($this->user->usernames[0]->active);
+        $this->assertFalse($this->user->usernames[1]->active);
     }
 
     /** @test */
@@ -216,7 +221,7 @@ class UsernamesTest extends TestCase
         $response = $this->json('DELETE', '/api/v1/catch-all-usernames/'.$username->id);
 
         $response->assertStatus(204);
-        $this->assertFalse($this->user->usernames[0]->catch_all);
+        $this->assertFalse($this->user->usernames[1]->catch_all);
     }
 
     /** @test */
@@ -244,7 +249,7 @@ class UsernamesTest extends TestCase
         $response = $this->json('DELETE', '/api/v1/usernames/'.$username->id);
 
         $response->assertStatus(204);
-        $this->assertEmpty($this->user->usernames);
+        $this->assertCount(1, $this->user->usernames);
 
         $this->assertEquals(DeletedUsername::first()->username, $username->username);
     }