|
399 | 399 | body-class="list-group-flush p-0 rounded">
|
400 | 400 | <div class="list-group text-center">
|
401 | 401 | <div class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'unlist')">Unlist from Timelines</div>
|
402 |
| - <div class="list-group-item rounded cursor-pointer" @click="">Add Content Warning</div> |
| 402 | + <div v-if="ctxMenuStatus.sensitive" class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'remcw')">Remove Content Warning</div> |
| 403 | + <div v-else class="list-group-item rounded cursor-pointer" @click="moderatePost(ctxMenuStatus, 'addcw')">Add Content Warning</div> |
403 | 404 | <div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxModMenuClose()">Cancel</div>
|
404 | 405 | </div>
|
405 |
| - </b-modal> |
406 |
| - <b-modal ref="ctxShareModal" |
407 |
| - id="ctx-share-modal" |
408 |
| - title="Share" |
409 |
| - hide-footer |
410 |
| - centered |
411 |
| - rounded |
412 |
| - size="sm" |
413 |
| - body-class="list-group-flush p-0 rounded text-center"> |
414 |
| - <div class="list-group-item rounded cursor-pointer border-top-0">Email</div> |
415 |
| - <div class="list-group-item rounded cursor-pointer">Facebook</div> |
416 |
| - <div class="list-group-item rounded cursor-pointer">Mastodon</div> |
417 |
| - <div class="list-group-item rounded cursor-pointer">Pinterest</div> |
418 |
| - <div class="list-group-item rounded cursor-pointer">Pixelfed</div> |
419 |
| - <div class="list-group-item rounded cursor-pointer">Twitter</div> |
420 |
| - <div class="list-group-item rounded cursor-pointer">VK</div> |
421 |
| - <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div> |
422 |
| - </b-modal> |
423 |
| - <b-modal ref="ctxEmbedModal" |
424 |
| - id="ctx-embed-modal" |
425 |
| - hide-header |
426 |
| - hide-footer |
427 |
| - centered |
428 |
| - rounded |
429 |
| - size="md" |
430 |
| - body-class="p-2 rounded"> |
| 406 | +</b-modal> |
| 407 | +<b-modal ref="ctxShareModal" |
| 408 | + id="ctx-share-modal" |
| 409 | + title="Share" |
| 410 | + hide-footer |
| 411 | + centered |
| 412 | + rounded |
| 413 | + size="sm" |
| 414 | + body-class="list-group-flush p-0 rounded text-center"> |
| 415 | + <div class="list-group-item rounded cursor-pointer border-top-0">Email</div> |
| 416 | + <div class="list-group-item rounded cursor-pointer">Facebook</div> |
| 417 | + <div class="list-group-item rounded cursor-pointer">Mastodon</div> |
| 418 | + <div class="list-group-item rounded cursor-pointer">Pinterest</div> |
| 419 | + <div class="list-group-item rounded cursor-pointer">Pixelfed</div> |
| 420 | + <div class="list-group-item rounded cursor-pointer">Twitter</div> |
| 421 | + <div class="list-group-item rounded cursor-pointer">VK</div> |
| 422 | + <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div> |
| 423 | +</b-modal> |
| 424 | +<b-modal ref="ctxEmbedModal" |
| 425 | + id="ctx-embed-modal" |
| 426 | + hide-header |
| 427 | + hide-footer |
| 428 | + centered |
| 429 | + rounded |
| 430 | + size="md" |
| 431 | + body-class="p-2 rounded"> |
431 | 432 | <div>
|
432 | 433 | <textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 12px; height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
|
433 | 434 | <hr>
|
434 | 435 | <button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
|
435 | 436 | <p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
|
436 | 437 | </div>
|
437 |
| - </b-modal> |
438 |
| - <b-modal |
439 |
| - id="lightbox" |
440 |
| - ref="lightboxModal" |
441 |
| - hide-header |
442 |
| - hide-footer |
443 |
| - centered |
444 |
| - size="lg" |
445 |
| - body-class="p-0" |
446 |
| - > |
447 |
| - <div v-if="lightboxMedia" :class="lightboxMedia.filter_class" class="w-100 h-100"> |
448 |
| - <img :src="lightboxMedia.url" style="max-height: 100%; max-width: 100%"> |
449 |
| - </div> |
450 |
| - </b-modal> |
| 438 | +</b-modal> |
| 439 | +<b-modal |
| 440 | + id="lightbox" |
| 441 | + ref="lightboxModal" |
| 442 | + hide-header |
| 443 | + hide-footer |
| 444 | + centered |
| 445 | + size="lg" |
| 446 | + body-class="p-0" |
| 447 | + > |
| 448 | + <div v-if="lightboxMedia" :class="lightboxMedia.filter_class" class="w-100 h-100"> |
| 449 | + <img :src="lightboxMedia.url" style="max-height: 100%; max-width: 100%"> |
| 450 | + </div> |
| 451 | + </b-modal> |
451 | 452 | <b-modal ref="replyModal"
|
452 | 453 | id="ctx-reply-modal"
|
453 | 454 | hide-footer
|
|
929 | 930 |
|
930 | 931 | moderatePost(status, action, $event) {
|
931 | 932 | let username = status.account.username;
|
| 933 | + let msg = ''; |
| 934 | + let self = this; |
932 | 935 | switch(action) {
|
933 |
| - case 'autocw': |
934 |
| - let msg = 'Are you sure you want to enforce CW for ' + username + ' ?'; |
935 |
| - swal({ |
936 |
| - title: 'Confirm', |
937 |
| - text: msg, |
938 |
| - icon: 'warning', |
939 |
| - buttons: true, |
940 |
| - dangerMode: true |
941 |
| - }).then(res => { |
942 |
| - if(res) { |
943 |
| - axios.post('/api/v2/moderator/action', { |
944 |
| - action: action, |
945 |
| - item_id: status.id, |
946 |
| - item_type: 'status' |
947 |
| - }).then(res => { |
948 |
| - swal('Success', 'Successfully enforced CW for ' + username, 'success'); |
949 |
| - }).catch(err => { |
950 |
| - swal( |
951 |
| - 'Error', |
952 |
| - 'Something went wrong, please try again later.', |
953 |
| - 'error' |
954 |
| - ); |
955 |
| - }); |
956 |
| - } |
957 |
| - }); |
958 |
| - break; |
959 |
| -
|
960 |
| - case 'noautolink': |
961 |
| - msg = 'Are you sure you want to disable auto linking for ' + username + ' ?'; |
962 |
| - swal({ |
963 |
| - title: 'Confirm', |
964 |
| - text: msg, |
965 |
| - icon: 'warning', |
966 |
| - buttons: true, |
967 |
| - dangerMode: true |
968 |
| - }).then(res => { |
969 |
| - if(res) { |
970 |
| - axios.post('/api/v2/moderator/action', { |
971 |
| - action: action, |
972 |
| - item_id: status.id, |
973 |
| - item_type: 'status' |
974 |
| - }).then(res => { |
975 |
| - swal('Success', 'Successfully disabled autolinking for ' + username, 'success'); |
976 |
| - }).catch(err => { |
977 |
| - swal( |
978 |
| - 'Error', |
979 |
| - 'Something went wrong, please try again later.', |
980 |
| - 'error' |
981 |
| - ); |
982 |
| - }); |
983 |
| - } |
984 |
| - }); |
985 |
| - break; |
986 |
| -
|
987 |
| - case 'unlisted': |
988 |
| - msg = 'Are you sure you want to unlist from timelines for ' + username + ' ?'; |
| 936 | + case 'addcw': |
| 937 | + msg = 'Are you sure you want to add a content warning to this post?'; |
989 | 938 | swal({
|
990 | 939 | title: 'Confirm',
|
991 | 940 | text: msg,
|
|
999 | 948 | item_id: status.id,
|
1000 | 949 | item_type: 'status'
|
1001 | 950 | }).then(res => {
|
1002 |
| - swal('Success', 'Successfully unlisted for ' + username, 'success'); |
| 951 | + swal('Success', 'Successfully added content warning', 'success'); |
| 952 | + status.sensitive = true; |
| 953 | + self.ctxModMenuClose(); |
1003 | 954 | }).catch(err => {
|
1004 | 955 | swal(
|
1005 | 956 | 'Error',
|
1006 | 957 | 'Something went wrong, please try again later.',
|
1007 | 958 | 'error'
|
1008 | 959 | );
|
| 960 | + self.ctxModMenuClose(); |
1009 | 961 | });
|
1010 | 962 | }
|
1011 | 963 | });
|
1012 | 964 | break;
|
1013 | 965 |
|
1014 |
| - case 'disable': |
1015 |
| - msg = 'Are you sure you want to disable ' + username + '’s account ?'; |
| 966 | + case 'remcw': |
| 967 | + msg = 'Are you sure you want to remove the content warning on this post?'; |
1016 | 968 | swal({
|
1017 | 969 | title: 'Confirm',
|
1018 | 970 | text: msg,
|
|
1026 | 978 | item_id: status.id,
|
1027 | 979 | item_type: 'status'
|
1028 | 980 | }).then(res => {
|
1029 |
| - swal('Success', 'Successfully disabled ' + username + '’s account', 'success'); |
| 981 | + swal('Success', 'Successfully added content warning', 'success'); |
| 982 | + status.sensitive = false; |
| 983 | + self.ctxModMenuClose(); |
1030 | 984 | }).catch(err => {
|
1031 | 985 | swal(
|
1032 | 986 | 'Error',
|
1033 | 987 | 'Something went wrong, please try again later.',
|
1034 | 988 | 'error'
|
1035 | 989 | );
|
| 990 | + self.ctxModMenuClose(); |
1036 | 991 | });
|
1037 | 992 | }
|
1038 | 993 | });
|
1039 | 994 | break;
|
1040 | 995 |
|
1041 |
| - case 'suspend': |
1042 |
| - msg = 'Are you sure you want to suspend ' + username + '’s account ?'; |
| 996 | + case 'unlist': |
| 997 | + msg = 'Are you sure you want to unlist this post?'; |
1043 | 998 | swal({
|
1044 | 999 | title: 'Confirm',
|
1045 | 1000 | text: msg,
|
|
1053 | 1008 | item_id: status.id,
|
1054 | 1009 | item_type: 'status'
|
1055 | 1010 | }).then(res => {
|
1056 |
| - swal('Success', 'Successfully suspend ' + username + '’s account', 'success'); |
| 1011 | + this.feed = this.feed.filter(f => { |
| 1012 | + return f.id != status.id; |
| 1013 | + }); |
| 1014 | + swal('Success', 'Successfully unlisted post', 'success'); |
| 1015 | + self.ctxModMenuClose(); |
1057 | 1016 | }).catch(err => {
|
| 1017 | + self.ctxModMenuClose(); |
1058 | 1018 | swal(
|
1059 | 1019 | 'Error',
|
1060 | 1020 | 'Something went wrong, please try again later.',
|
|
0 commit comments