Bläddra i källkod

Merge pull request #2347 from pixelfed/staging

Update private profiles, add context menu to mute, block or report
daniel 5 år sedan
förälder
incheckning
6f3f4e9dbb

+ 3 - 0
CHANGELOG.md

@@ -72,6 +72,9 @@
 - Updated comments, fix remote reply bug. ([f330616](https://github.com/pixelfed/pixelfed/commit/f330616))
 - Updated comments, fix remote reply bug. ([f330616](https://github.com/pixelfed/pixelfed/commit/f330616))
 - Updated PostComponent, add tagged people to mobile layout. ([7a2c2e78](https://github.com/pixelfed/pixelfed/commit/7a2c2e78))
 - Updated PostComponent, add tagged people to mobile layout. ([7a2c2e78](https://github.com/pixelfed/pixelfed/commit/7a2c2e78))
 - Updated Tag People, allow untagging yourself. ([c9452639](https://github.com/pixelfed/pixelfed/commit/c9452639))
 - Updated Tag People, allow untagging yourself. ([c9452639](https://github.com/pixelfed/pixelfed/commit/c9452639))
+- Updated ComposeModal.vue, add 451 http code warning. ([b213dcda](https://github.com/pixelfed/pixelfed/commit/b213dcda))
+- Updated Profile.vue, add empty follower modal placeholder. ([b542a3c5](https://github.com/pixelfed/pixelfed/commit/b542a3c5))
+- Updated private profiles, add context menu to mute, block or report. ([487c4ffc](https://github.com/pixelfed/pixelfed/commit/487c4ffc))
 
 
 ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
 ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
 ### Added
 ### Added

BIN
public/js/app.js


BIN
public/js/compose.js


BIN
public/js/profile.js


BIN
public/mix-manifest.json


+ 5 - 1
resources/assets/js/app.js

@@ -153,6 +153,10 @@ window.App.util = {
 			let u = url + '/embed';
 			let u = url + '/embed';
 			return '<iframe src="'+u+'" class="pixelfed__embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script async defer src="'+window.location.origin +'/embed.js"><\/script>';
 			return '<iframe src="'+u+'" class="pixelfed__embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script async defer src="'+window.location.origin +'/embed.js"><\/script>';
 		})
 		})
-	}
+	},
+
+	clipboard: (function(data) {
+		return navigator.clipboard.writeText(data);
+	})
 
 
 };
 };

+ 15 - 4
resources/assets/js/components/ComposeModal.vue

@@ -700,10 +700,21 @@ export default {
 						self.page = 2;
 						self.page = 2;
 					}, 300);
 					}, 300);
 				}).catch(function(e) {
 				}).catch(function(e) {
-					self.uploading = false;
-					io.value = null;
-					swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error');
-					self.page = 2;
+					switch(e.response.status) {
+						case 451:
+							self.uploading = false;
+							io.value = null;
+							swal('Banned Content', 'This content has been banned and cannot be uploaded.', 'error');
+							self.page = 2;
+						break;
+
+						default:
+							self.uploading = false;
+							io.value = null;
+							swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error');
+							self.page = 2;
+						break;
+					}
 				});
 				});
 				io.value = null;
 				io.value = null;
 				self.uploadProgress = 0;
 				self.uploadProgress = 0;

+ 5 - 1
resources/assets/js/components/Profile.vue

@@ -434,6 +434,10 @@
 		dialog-class="follow-modal"
 		dialog-class="follow-modal"
 		>
 		>
 		<div class="list-group">
 		<div class="list-group">
+			<div v-if="followers.length == 0" class="list-group-item border-0">
+				<p class="text-center mb-0 font-weight-bold text-muted py-5">
+					<span class="text-dark">{{profileUsername}}</span> has no followers yet</p>
+			</div>
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in followers" :key="'follower_'+index">
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in followers" :key="'follower_'+index">
 				<div class="media mb-0">
 				<div class="media mb-0">
 					<a :href="user.url">
 					<a :href="user.url">
@@ -452,7 +456,7 @@
 					<!-- <button class="btn btn-primary font-weight-bold btn-sm py-1">FOLLOW</button> -->
 					<!-- <button class="btn btn-primary font-weight-bold btn-sm py-1">FOLLOW</button> -->
 				</div>
 				</div>
 			</div>
 			</div>
-			<div v-if="followerMore" class="list-group-item text-center" v-on:click="followersLoadMore()">
+			<div v-if="followers.length && followerMore" class="list-group-item text-center" v-on:click="followersLoadMore()">
 				<p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
 				<p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
 			</div>
 			</div>
 		</div>
 		</div>

+ 54 - 0
resources/views/profile/partial/private-info.blade.php

@@ -31,6 +31,34 @@
               </form>
               </form>
             </span>
             </span>
             @endif
             @endif
+            <span class="pl-4">
+              <i class="fas fa-cog fa-lg text-muted cursor-pointer" data-toggle="modal" data-target="#ctxProfileMenu"></i>
+              <div class="modal" tabindex="-1" role="dialog" id="ctxProfileMenu">
+                <div class="modal-dialog modal-dialog-centered modal-sm">
+                  <div class="modal-content">
+                    <div class="modal-body p-0">
+                      <div class="list-group-item cursor-pointer text-center rounded text-dark" onclick="window.App.util.clipboard('{{$user->url()}}');$('#ctxProfileMenu').modal('hide')">
+                        Copy Link
+                      </div>
+                      @auth
+                      <div class="list-group-item cursor-pointer text-center rounded text-dark" onclick="muteProfile()">
+                        Mute
+                      </div>
+                      <a class="list-group-item cursor-pointer text-center rounded text-dark text-decoration-none" href="i/report?type=user&id={{$user->id}}">
+                        Report User
+                      </a>
+                      <div class="list-group-item cursor-pointer text-center rounded text-dark" onclick="blockProfile()">
+                        Block
+                      </div>
+                      @endauth
+                      <div class="list-group-item cursor-pointer text-center rounded text-muted" onclick="$('#ctxProfileMenu').modal('hide')">
+                        Close
+                      </div>
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </span>
           </div>
           </div>
           <div class="profile-stats pb-3 d-inline-flex lead">
           <div class="profile-stats pb-3 d-inline-flex lead">
             <div class="font-weight-light pr-5">
             <div class="font-weight-light pr-5">
@@ -51,3 +79,29 @@
     </div>
     </div>
   </div>
   </div>
 </div>
 </div>
+
+@push('scripts')
+<script type="text/javascript">
+  function muteProfile() {
+      axios.post('/i/mute', {
+        type: 'user',
+        item: '{{$user->id}}'
+      }).then(res => {
+        $('#ctxProfileMenu').modal('hide');
+        $('#ctxProfileMenu').hide();
+        swal('Muted Profile', 'You have successfully muted this profile.', 'success');
+      });
+  }
+  function blockProfile() {
+      axios.post('/i/block', {
+        type: 'user',
+        item: '{{$user->id}}'
+      }).then(res => {
+        $('#ctxProfileMenu').modal('hide');
+        $('#ctxProfileMenu').hide();
+        swal('Blocked Profile', 'You have successfully blocked this profile.', 'success');
+      });
+  }
+
+</script>
+@endpush