Explorar el Código

Merge pull request #773 from pixelfed/frontend-ui-refactor

Frontend ui refactor
daniel hace 6 años
padre
commit
cb872373e3

+ 6 - 1
app/Http/Controllers/InternalApiController.php

@@ -54,6 +54,7 @@ class InternalApiController extends Controller
         $attachments = [];
         $status = new Status;
         $mimes = [];
+        $cw = false;
 
         foreach($medias as $k => $media) {
             $m = Media::findOrFail($media['id']);
@@ -64,7 +65,8 @@ class InternalApiController extends Controller
             $m->license = $media['license'];
             $m->caption = strip_tags($media['alt']);
             $m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k;
-            if($media['cw'] == true) {
+            if($media['cw'] == true || $profile->cw == true) {
+                $cw = true;
                 $m->is_nsfw = true;
                 $status->is_nsfw = true;
             }
@@ -84,6 +86,9 @@ class InternalApiController extends Controller
             $media->save();
         }
 
+        $visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
+        $cw = $profile->cw == true ? true : $cw;
+        $status->is_nsfw = $cw;
         $status->visibility = $visibility;
         $status->scope = $visibility;
         $status->type = StatusController::mimeTypeCheck($mimes);

+ 3 - 0
app/Http/Controllers/StatusController.php

@@ -125,6 +125,9 @@ class StatusController extends Controller
         $profile = $user->profile;
         $visibility = $this->validateVisibility($request->visibility);
 
+        $cw = $profile->cw == true ? true : $cw;
+        $visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility;
+
         $status = new Status();
         $status->profile_id = $profile->id;
         $status->caption = strip_tags($request->caption);

+ 1 - 1
app/Instance.php

@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class Instance extends Model
 {
-    //
+    protected $fillable = ['domain'];
 }

+ 4 - 1
app/Jobs/StatusPipeline/StatusEntityLexer.php

@@ -42,7 +42,10 @@ class StatusEntityLexer implements ShouldQueue
      */
     public function handle()
     {
-        $this->parseEntities();
+        $profile = $this->status->profile;
+        if($profile->no_autolink == false) {
+            $this->parseEntities();
+        }
     }
 
     public function parseEntities()

BIN
public/css/app.css


BIN
public/js/components.js


BIN
public/mix-manifest.json


+ 7 - 0
resources/assets/sass/custom.scss

@@ -455,3 +455,10 @@ details summary::-webkit-details-marker {
 .notification-tooltip .arrow::before {
   border-bottom-color:#dc3545 !important;
 }
+
+#previewAvatar {
+    img {
+        max-width: 100%;
+        height: auto;
+    }
+}

+ 14 - 0
resources/views/settings/home.blade.php

@@ -22,6 +22,7 @@
             <label class="custom-file-label" for="avatarInput">Select a profile photo</label>
           </div>
           <p><span class="small font-weight-bold">Must be a jpeg or png. Max avatar size: <span id="maxAvatarSize"></span></span></p>
+          <div id="previewAvatar"></div>
           <p class="mb-0"><button type="submit" class="btn btn-primary px-4 py-0 font-weight-bold">Upload</button></p>
         </div>
         </form>
@@ -130,5 +131,18 @@
   });
 
   $('#maxAvatarSize').text(filesize({{config('pixelfed.max_avatar_size') * 1024}}, {round: 0}));
+
+  $('#avatarInput').on('change', function(e) {
+      var file = document.getElementById('avatarInput').files[0];
+      var reader = new FileReader();
+
+      reader.addEventListener("load", function() {
+          $('#previewAvatar').html('<img src="' + reader.result + '" class="rounded-circle box-shadow mb-3" width="100%" height="100%"/>');
+      }, false);
+
+      if (file) {
+          reader.readAsDataURL(file);
+      }
+  });
 </script>
 @endpush