diff --git a/app/Http/Controllers/Settings/HomeSettings.php b/app/Http/Controllers/Settings/HomeSettings.php index 23d434d3..5d7f907b 100644 --- a/app/Http/Controllers/Settings/HomeSettings.php +++ b/app/Http/Controllers/Settings/HomeSettings.php @@ -17,7 +17,6 @@ use Mail; use Purify; use App\Mail\PasswordChange; use Illuminate\Http\Request; -use App\Services\PronounService; trait HomeSettings { @@ -32,9 +31,8 @@ trait HomeSettings $storage['percentUsed'] = ceil($storage['used'] / $storage['limit'] * 100); $storage['limitPretty'] = PrettyNumber::size($storage['limit']); $storage['usedPretty'] = PrettyNumber::size($storage['used']); - $pronouns = PronounService::get($id); - return view('settings.home', compact('storage', 'pronouns')); + return view('settings.home', compact('storage')); } public function homeUpdate(Request $request) @@ -43,8 +41,7 @@ trait HomeSettings 'name' => 'required|string|max:'.config('pixelfed.max_name_length'), 'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'), 'website' => 'nullable|url', - 'language' => 'nullable|string|min:2|max:5', - 'pronouns' => 'nullable|array|max:4' + 'language' => 'nullable|string|min:2|max:5' ]); $changes = false; @@ -54,8 +51,6 @@ trait HomeSettings $language = $request->input('language'); $user = Auth::user(); $profile = $user->profile; - $pronouns = $request->input('pronouns'); - $existingPronouns = PronounService::get($profile->id); $layout = $request->input('profile_layout'); if($layout) { $layout = !in_array($layout, ['metro', 'moment']) ? 'metro' : $layout; @@ -88,14 +83,6 @@ trait HomeSettings $user->language = $language; session()->put('locale', $language); } - - if($existingPronouns != $pronouns) { - if($pronouns && in_array('Select Pronoun(s)', $pronouns)) { - PronounService::clear($profile->id); - } else { - PronounService::put($profile->id, $pronouns); - } - } } if ($changes === true) { diff --git a/app/Models/UserPronoun.php b/app/Models/UserPronoun.php deleted file mode 100644 index 9fbf77d7..00000000 --- a/app/Models/UserPronoun.php +++ /dev/null @@ -1,11 +0,0 @@ -addHours(12); - - return Cache::remember($key, $ttl, function() use($id) { - $res = UserPronoun::whereProfileId($id)->first(); - return $res ? json_decode($res->pronouns, true) : []; - }); - } - - public static function put($id, $pronouns) - { - $res = UserPronoun::whereProfileId($id)->first(); - $key = 'user:pronouns:' . $id; - - if($res) { - $res->pronouns = json_encode($pronouns); - $res->save(); - Cache::forget($key); - AccountService::del($id); - return $res->pronouns; - } - - $res = new UserPronoun; - $res->profile_id = $id; - $res->pronouns = json_encode($pronouns); - $res->save(); - Cache::forget($key); - AccountService::del($id); - return $res->pronouns; - } - - public static function clear($id) - { - $res = UserPronoun::whereProfileId($id)->first(); - if($res) { - $res->pronouns = null; - $res->save(); - } - $key = 'user:pronouns:' . $id; - Cache::forget($key); - AccountService::del($id); - } - - public static function pronouns() - { - return [ - 'co', - 'cos', - 'e', - 'ey', - 'em', - 'eir', - 'fae', - 'faer', - 'he', - 'him', - 'his', - 'her', - 'hers', - 'hir', - 'mer', - 'mers', - 'ne', - 'nir', - 'nirs', - 'nee', - 'ner', - 'ners', - 'per', - 'pers', - 'she', - 'they', - 'them', - 'theirs', - 'thon', - 'thons', - 've', - 'ver', - 'vis', - 'vi', - 'vir', - 'xe', - 'xem', - 'xyr', - 'ze', - 'zir', - 'zie' - ]; - } -} diff --git a/app/Transformer/Api/AccountTransformer.php b/app/Transformer/Api/AccountTransformer.php index 6e6d9ea1..14731aed 100644 --- a/app/Transformer/Api/AccountTransformer.php +++ b/app/Transformer/Api/AccountTransformer.php @@ -5,7 +5,6 @@ namespace App\Transformer\Api; use Auth; use App\Profile; use League\Fractal; -use App\Services\PronounService; class AccountTransformer extends Fractal\TransformerAbstract { @@ -38,7 +37,6 @@ class AccountTransformer extends Fractal\TransformerAbstract 'created_at' => $profile->created_at->toJSON(), 'header_bg' => $profile->header_bg, 'last_fetched_at' => optional($profile->last_fetched_at)->toJSON(), - 'pronouns' => PronounService::get($profile->id), 'location' => $profile->location ]; } diff --git a/database/migrations/2021_05_12_042153_create_user_pronouns_table.php b/database/migrations/2021_05_12_042153_create_user_pronouns_table.php deleted file mode 100644 index 9e394e2b..00000000 --- a/database/migrations/2021_05_12_042153_create_user_pronouns_table.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->unsignedInteger('user_id')->nullable()->unique()->index(); - $table->bigInteger('profile_id')->unique()->index(); - $table->json('pronouns')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('user_pronouns'); - } -} diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 7fe5ba75..b9ff31be 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -141,8 +141,7 @@

- {{profile.display_name}} - {{profile.pronouns.join('/')}} + {{profile.display_name}}

{{formatWebsite(profile.website)}}

@@ -420,7 +419,6 @@ - -
- -
- -

Select up to 4 pronouns that will appear on your profile.

-
-
@if(config_cache('pixelfed.enforce_account_limit'))

Storage Usage