unoffical wafrn mirror wafrn.net
atproto social-network activitypub
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

oh so it was THIS

+46 -53
+38 -43
packages/backend/utils/baseQueryNew.ts
··· 394 394 // we edit posts so we add the interactionPolicies 395 395 const postsToSend = postsToSendFiltered 396 396 .filter((elem) => !!elem) 397 - .map(async (elem) => { 398 - let canReply = canInteract( 399 - elem.replyControl, 400 - posterId, 401 - elem.id, 402 - usersFollowingPoster, 403 - usersFollowedByPoster, 404 - mentions 405 - ) 406 - let canLike = canInteract( 407 - elem.likeControl, 408 - posterId, 409 - elem.id, 410 - usersFollowingPoster, 411 - usersFollowedByPoster, 412 - mentions 413 - ) 414 - let canReblog = canInteract( 415 - elem.reblogControl, 416 - posterId, 417 - elem.id, 418 - usersFollowingPoster, 419 - usersFollowedByPoster, 420 - mentions 421 - ) 422 - let canQuote = canInteract( 423 - elem.quoteControl, 424 - posterId, 425 - elem.id, 426 - usersFollowingPoster, 427 - usersFollowedByPoster, 428 - mentions 429 - ) 430 - await Promise.all([canReply, canReblog, canQuote, canLike]) 431 - return { 432 - ...elem, 433 - canReply: await canReply, 434 - canReblog: await canReblog, 435 - canQuote: await canQuote, 436 - canLike: await canLike 437 - } 438 - }) 397 + .map(async (elem) => addPostCanInteract(posterId, elem, usersFollowingPoster, usersFollowedByPoster, mentions)) 439 398 440 399 return { 441 400 rewootIds: finalRewootIds.filter((elem) => !!elem), ··· 501 460 mentions = await mentions 502 461 post = await post 503 462 // TMP hack 504 - let res = true 463 + let res = false 505 464 if (post) { 506 465 if (post.userId == userId) { 507 466 return true ··· 547 506 } 548 507 549 508 return res 509 + } 510 + 511 + async function addPostCanInteract( 512 + userId: string, 513 + postInput: any, 514 + userFollowersInput?: string[], 515 + userFollowingInput?: string[], 516 + mentionsInput?: { usersMentioned: string[]; postMentionRelation: any[] } 517 + ) { 518 + let post: any = { ...postInput } 519 + let canReply = canInteract(post.replyControl, userId, post.id, userFollowersInput, userFollowingInput, mentionsInput) 520 + let canLike = canInteract(post.likeControl, userId, post.id, userFollowersInput, userFollowingInput, mentionsInput) 521 + let canReblog = canInteract( 522 + post.reblogControl, 523 + userId, 524 + post.id, 525 + userFollowersInput, 526 + userFollowingInput, 527 + mentionsInput 528 + ) 529 + let canQuote = canInteract(post.quoteControl, userId, post.id, userFollowersInput, userFollowingInput, mentionsInput) 530 + 531 + await Promise.all([canReblog, canReply, canQuote, canLike]) 532 + post.canReply = await canReply 533 + post.canLike = await canLike 534 + post.canReblog = await canReblog 535 + post.canQuote = await canQuote 536 + if (post.ancestors) { 537 + post.ancestors = await Promise.all( 538 + post.ancestors.map((elem: Post) => 539 + addPostCanInteract(userId, elem.dataValues, userFollowersInput, userFollowingInput, mentionsInput) 540 + ) 541 + ) 542 + } 543 + 544 + return post 550 545 } 551 546 552 547 export { getUnjointedPosts, getMedias, getQuotes, getMentionedUserIds, getTags, getLikes, getBookmarks, getEmojis }
-5
packages/backend/utils/queueProcessors/prepareSendRemotePost.ts
··· 15 15 PostTag 16 16 } from '../../models/index.js' 17 17 import { Job, Queue } from 'bullmq' 18 - import { Agent, BskyAgent, CredentialSession } from '@atproto/api' 19 - import { wait } from '../wait.js' 20 - import dompurify from 'isomorphic-dompurify' 21 - import { postToAtproto } from '../../atproto/utils/postToAtproto.js' 22 - import { getAtProtoSession } from '../../atproto/utils/getAtProtoSession.js' 23 18 import { Privacy } from '../../models/post.js' 24 19 import { completeEnvironment } from '../backendOptions.js' 25 20
+4
packages/frontend/src/app/components/bottom-reply-bar/bottom-reply-bar.component.html
··· 16 16 <div class="flex gap-1 action-list" aria-label="Action list"> 17 17 @if (fragment.privacy !== 10 && fragment.privacy !== 1 && fragment.privacy !== 2) { 18 18 <button 19 + [disabled]="!fragment.canQuote" 19 20 aria-label="Quote woot" 20 21 mat-button 21 22 color="accent" ··· 40 41 @if (!myRewootsIncludePost && fragment.privacy !== 10 && fragment.privacy !== 1) { 41 42 <button 42 43 aria-label="Rewoot" 44 + [disabled]="!fragment.canReblog" 43 45 mat-button 44 46 color="accent" 45 47 (click)="quickReblog(fragment)" ··· 51 53 } 52 54 <button 53 55 aria-label="Reply woot" 56 + [disabled]="!fragment.canReply" 54 57 mat-button 55 58 color="accent" 56 59 (click)="replyPost(fragment)" ··· 93 96 } @else { 94 97 <button 95 98 aria-label="Like woot" 99 + [disabled]="!fragment.canLike" 96 100 mat-button 97 101 color="accent" 98 102 (click)="likePost(fragment)"
-1
packages/frontend/src/app/components/bottom-reply-bar/bottom-reply-bar.component.ts
··· 1 - 2 1 import { Component, Input, OnChanges, signal, SimpleChanges } from '@angular/core' 3 2 import { MatButtonModule } from '@angular/material/button' 4 3 import { MatTooltipModule } from '@angular/material/tooltip'
+4 -4
packages/frontend/src/app/components/post-actions/post-actions.component.html
··· 49 49 </button> 50 50 } 51 51 @if (userLoggedIn) { 52 - <button (click)="replyPost()" mat-menu-item> 52 + <button [disabled]="!content.canReply" (click)="replyPost()" mat-menu-item> 53 53 <span class="post-actions-menu-span-content"> 54 54 <fa-icon class="mr-2" [icon]="reblogIcon"></fa-icon> 55 55 Reply woot ··· 64 64 </button> 65 65 } @else { 66 66 @if (content.privacy !== 10 && content.privacy !== 1) { 67 - <button (click)="quickReblog()" mat-menu-item> 67 + <button [disabled]="!content.canReblog" (click)="quickReblog()" mat-menu-item> 68 68 <span class="post-actions-menu-span-content"> 69 69 <fa-icon class="mr-2" [icon]="quickReblogIcon"></fa-icon> 70 70 Rewoot ··· 73 73 } 74 74 } 75 75 @if (content.privacy !== 10 && content.privacy !== 1 && content.privacy !== 2) { 76 - <button (click)="quoteWoot()" mat-menu-item> 76 + <button [disabled]="!content.canQuote" (click)="quoteWoot()" mat-menu-item> 77 77 <span class="post-actions-menu-span-content"> 78 78 <fa-icon class="mr-2" [icon]="quoteIcon"></fa-icon> 79 79 Quote woot ··· 104 104 </span> 105 105 </button> 106 106 } @else { 107 - <button (click)="likePost()" mat-menu-item> 107 + <button [disabled]="!content.canLike" (click)="likePost()" mat-menu-item> 108 108 <span class="post-actions-menu-span-content"> 109 109 <fa-icon class="mr-2" [icon]="solidHeartIcon"></fa-icon> 110 110 Like woot