Переглянути джерело

Staging (#2927)

* Created localized exception.php (DE)

* Update German translation

* Update German translation

* Update de localization, Create New Post -> New

* Formatting

* Update site.php (#2889)

Co-authored-by: daniel <danielsupernault@gmail.com>

* Formatting

* Update controllers, fixes #2906

* Update NotificationService, fix 500 bug

* Update changelog

Co-authored-by: forenta <ueblesurmeli-github@yahoo.de>
Co-authored-by: Tomas Brabenec <tomas@brabenec.net>
daniel 3 роки тому
батько
коміт
68437e614d

+ 4 - 1
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.1...dev)
 
+### Updated
+- Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3))
+-  ([](https://github.com/pixelfed/pixelfed/commit/))
+
 ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)
 ### Added
 - WebP Support ([069a0e4a](https://github.com/pixelfed/pixelfed/commit/069a0e4a))
@@ -112,7 +116,6 @@
 - Updated DirectMessageController, fix autocomplete bug. ([0f00be4d](https://github.com/pixelfed/pixelfed/commit/0f00be4d))
 - Updated StoryService, fix division by zero bug. ([6ae1ba0a](https://github.com/pixelfed/pixelfed/commit/6ae1ba0a))
 - Updated ApiV1Controller, fix empty public timeline bug. ([0584f9ee](https://github.com/pixelfed/pixelfed/commit/0584f9ee))
--  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0)
 ### Added

+ 7 - 4
app/Http/Controllers/Import/Instagram.php

@@ -15,10 +15,13 @@ use App\Jobs\ImportPipeline\ImportInstagram;
 
 trait Instagram
 {
-    public function instagram()
-    {
-      return view('settings.import.instagram.home');
-    }
+	public function instagram()
+	{
+		if(config_cache('pixelfed.import.instagram.enabled') != true) {
+			abort(404, 'Feature not enabled');
+		}
+		return view('settings.import.instagram.home');
+	}
 
     public function instagramStart(Request $request)
     {	

+ 7 - 4
app/Http/Controllers/Import/Mastodon.php

@@ -6,8 +6,11 @@ use Illuminate\Http\Request;
 
 trait Mastodon
 {
-    public function mastodon()
-    {
-      return view('settings.import.mastodon.home');
-    }
+	public function mastodon()
+	{
+		if(config_cache('pixelfed.import.instagram.enabled') != true) {
+			abort(404, 'Feature not enabled');
+		}
+		return view('settings.import.mastodon.home');
+	}
 }

+ 0 - 4
app/Http/Controllers/ImportController.php

@@ -11,10 +11,6 @@ class ImportController extends Controller
 	public function __construct()
 	{
 		$this->middleware('auth');
-
-		if(config_cache('pixelfed.import.instagram.enabled') != true) {
-			abort(404, 'Feature not enabled');
-		}
 	}
 
 }

+ 3 - 5
app/Http/Controllers/PollController.php

@@ -11,14 +11,10 @@ use App\Services\FollowerService;
 
 class PollController extends Controller
 {
-
-	public function __construct()
+	public function getPoll(Request $request, $id)
 	{
 		abort_if(!config_cache('instance.polls.enabled'), 404);
-	}
 
-	public function getPoll(Request $request, $id)
-	{
 		$poll = Poll::findOrFail($id);
 		$status = Status::findOrFail($poll->status_id);
 		if($status->scope != 'public') {
@@ -34,6 +30,8 @@ class PollController extends Controller
 
     public function vote(Request $request, $id)
     {
+		abort_if(!config_cache('instance.polls.enabled'), 404);
+
     	abort_unless($request->user(), 403);
 
     	$this->validate($request, [

+ 18 - 4
app/Services/NotificationService.php

@@ -27,7 +27,10 @@ class NotificationService {
 			$ids = self::coldGet($id, $start, $stop);
 		}
 		foreach($ids as $id) {
-			$res->push(self::getNotification($id));
+			$n = self::getNotification($id);
+			if($n != null) {
+				$res->push($n);
+			}
 		}
 		return $res;
 	}
@@ -56,7 +59,10 @@ class NotificationService {
 
 		$res = collect([]);
 		foreach($ids as $id) {
-			$res->push(self::getNotification($id));
+			$n = self::getNotification($id);
+			if($n != null) {
+				$res->push($n);
+			}
 		}
 		return $res->toArray();
 	}
@@ -71,7 +77,10 @@ class NotificationService {
 
 		$res = collect([]);
 		foreach($ids as $id) {
-			$res->push(self::getNotification($id));
+			$n = self::getNotification($id);
+			if($n != null) {
+				$res->push($n);
+			}
 		}
 		return $res->toArray();
 	}
@@ -129,7 +138,12 @@ class NotificationService {
 	public static function getNotification($id)
 	{
 		return Cache::remember('service:notification:'.$id, now()->addDays(3), function() use($id) {
-			$n = Notification::with('item')->findOrFail($id);
+			$n = Notification::with('item')->find($id);
+
+			if(!$n) {
+				return null;
+			}
+
 			$fractal = new Fractal\Manager();
 			$fractal->setSerializer(new ArraySerializer());
 			$resource = new Fractal\Resource\Item($n, new NotificationTransformer());

+ 4 - 2
resources/lang/cs/site.php

@@ -1,7 +1,6 @@
 <?php
 
 return [
-
 	'about'			=> 'O nás',
 	'help'			=> 'Nápověda',
 	'language'		=> 'Jazyk',
@@ -12,5 +11,8 @@ return [
 	'l10nWip'		=> 'Stále pracujeme na podpoře lokalizací',
 	'currentLocale' => 'Aktuální jazyk',
 	'selectLocale'  => 'Vyberte si jeden z podporovaných jazyků',
-
+	'contact'		=> 'Kontakt',
+	'contact-us'	=> 'Kontaktujte nás',
+	'places'		=> 'Místa',
+	'profiles'		=> 'Profily',
 ];

+ 11 - 0
resources/lang/de/exception.php

@@ -0,0 +1,11 @@
+<?php
+
+return [
+
+	'compose' => [
+		'invalid' => [
+			'album' => 'Mindestens 1 Foto oder Video muss enthalten sein.',
+		],
+	],
+
+];

+ 1 - 2
resources/lang/de/navmenu.php

@@ -1,7 +1,6 @@
 <?php
 
 return [
-
     'search'         => 'Suche',
     'home'           => 'Heim',
     'local'          => 'Lokal',
@@ -16,5 +15,5 @@ return [
     'admin'          => 'Administration',
     'logout'         => 'Abmelden',
     'directMessages' => 'Privatnachrichten',
-
+    'composePost'	 => 'Neu',
 ];

+ 1 - 1
resources/lang/de/site.php

@@ -15,5 +15,5 @@ return [
 	'contact'		=> 'Kontakt',
 	'contact-us'	=> 'Kontaktiere uns',
 	'places'		=> 'Orte',
-
+	'profiles'		=> 'Profile',
 ];