kopia lustrzana https://github.com/pixelfed/pixelfed
add remove follow
rodzic
917f6759fc
commit
456f96d574
|
|
@ -4435,4 +4435,41 @@ class ApiV1Controller extends Controller
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
public function accountRemoveFollowById(Request $request, $target_id)
|
||||
{
|
||||
abort_if(! $request->user(), 403);
|
||||
|
||||
$pid = $request->user()->profile_id;
|
||||
|
||||
if (intval($pid) === intval($target_id)) {
|
||||
return $this->json(['error' => 'Request invalid! Targed is same user id.'], 500);
|
||||
}
|
||||
|
||||
Follower::whereProfileId($target_id)
|
||||
->whereFollowingId($pid)
|
||||
->delete();
|
||||
|
||||
RelationshipService::refresh($pid, $target_id);
|
||||
|
||||
UnfollowPipeline::dispatch($pid, $pid)->onQueue('high');
|
||||
|
||||
RelationshipService::refresh($pid, $target_id);
|
||||
Cache::forget('profile:following:'.$target_id);
|
||||
Cache::forget('profile:followers:'.$target_id);
|
||||
Cache::forget('profile:following:'.$pid);
|
||||
Cache::forget('profile:followers:'.$pid);
|
||||
Cache::forget('api:local:exp:rec:'.$pid);
|
||||
Cache::forget('user:account:id:'.$target_id);
|
||||
Cache::forget('user:account:id:'.$pid);
|
||||
Cache::forget('profile:follower_count:'.$target_id);
|
||||
Cache::forget('profile:follower_count:'.$pid);
|
||||
Cache::forget('profile:following_count:'.$target_id);
|
||||
Cache::forget('profile:following_count:'.$pid);
|
||||
AccountService::del($pid);
|
||||
AccountService::del($target_id);
|
||||
|
||||
|
||||
return $this->json([]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ return [
|
|||
'export' => 'Export',
|
||||
'labs' => 'Labs',
|
||||
'parental_controls' => 'Parental Controls',
|
||||
|
||||
|
||||
'submit' => 'Submit',
|
||||
'error' => 'Error',
|
||||
'cancel' => 'Cancel',
|
||||
'save' => 'Save',
|
||||
'download' => 'Download',
|
||||
|
||||
|
||||
'home.account_settings' => 'Account Settings',
|
||||
'home.change_profile_photo' => 'Change Profile Photo',
|
||||
'home.select_a_profile_photo' => 'Select a profile photo',
|
||||
|
|
@ -50,21 +50,21 @@ return [
|
|||
'home.storage_used' => 'Storage Used',
|
||||
'home.are_you_sure_you_want_to_delete_your_profile_photo' => 'Are you sure you want to delete your profile photo?',
|
||||
'home.an_error_occured_please_try_again_later' => 'An error occured, please try again later',
|
||||
|
||||
|
||||
'accessibility.reduce_motion' => 'Reduce Motion',
|
||||
'accessibility.prevent_animation_effects' => 'Prevent animation effects.',
|
||||
'accessibility.high_contrast_mode' => 'High Contrast Mode',
|
||||
'accessibility.high_contrast_mode_for_the_visually_impaired' => 'High contrast mode for the visually impaired.',
|
||||
'accessibility.disable_video_autoplay' => 'Disable video autoplay',
|
||||
'accessibility.prevent_videos_from_autoplaying' => 'Prevent videos from autoplaying.',
|
||||
|
||||
|
||||
'email.email_settings' => 'Email Settings',
|
||||
'email.email_address' => 'Email Address',
|
||||
'email.verified' => 'Verified',
|
||||
'email.unverified' => 'Unverified',
|
||||
'email.you_need_to' => 'You need to',
|
||||
'email.verify_your_email' => 'verify your email',
|
||||
|
||||
|
||||
'media.default_license' => 'Default License',
|
||||
'media.set_a_default_license_for_new_posts' => 'Set a default license for new posts.',
|
||||
'media.sync_licenses' => 'Sync Licenses',
|
||||
|
|
@ -73,7 +73,7 @@ return [
|
|||
'media.require_media_descriptions' => 'Require Media Descriptions',
|
||||
'media.briefly_describe_your_media_to_improve_etc' => 'Briefly describe your media to improve accessibility for vision impaired people.',
|
||||
'media.not_available_for_mobile_or_3rd_party_apps_etc' => 'Not available for mobile or 3rd party apps at this time.',
|
||||
|
||||
|
||||
'password.update_password' => 'Update Password',
|
||||
'password.current' => 'Current',
|
||||
'password.your_current_password' => 'Your current password',
|
||||
|
|
@ -81,7 +81,7 @@ return [
|
|||
'password.enter_new_password_here' => 'Enter new password here',
|
||||
'password.confirm' => 'Confirm',
|
||||
'password.confirm_new_password' => 'Confirm new password',
|
||||
|
||||
|
||||
'privacy.privacy_settings' => 'Privacy Settings',
|
||||
'privacy.private_account' => 'Private Account',
|
||||
'privacy.when_your_account_is_private_only_people_you_etc' => 'When your account is private, only people you approve can see your photos and videos on pixelfed. Your existing followers won\'t be affected.',
|
||||
|
|
@ -123,7 +123,7 @@ return [
|
|||
'privacy.allow_new_follow_requests' => 'Allow new follow requests',
|
||||
'privacy.block_notifications_from_accounts_i_dont_follow' => 'Block notifications from accounts I don\'t follow',
|
||||
'privacy.an_error_occured_please_try_again' => 'An error occured. Please try again.',
|
||||
|
||||
|
||||
'relationships' => 'Relationships',
|
||||
'relationships.followers' => 'Followers',
|
||||
'relationships.following' => 'Following',
|
||||
|
|
@ -134,6 +134,7 @@ return [
|
|||
'relationships.unfollow' => 'Unfollow',
|
||||
'relationships.mute' => 'Mute',
|
||||
'relationships.block' => 'Block',
|
||||
'relationships.removeFollow' => 'Remove Follow',
|
||||
'relationships.mute_successful' => 'Mute Successful',
|
||||
'relationships.you_have_successfully_muted_that_user' => 'You have successfully muted that user',
|
||||
'relationships.block_successful' => 'Block Successful',
|
||||
|
|
@ -142,7 +143,7 @@ return [
|
|||
'relationships.you_have_successfully_unfollowed_that_user' => 'You have successfully unfollowed that user',
|
||||
'relationships.an_error_occured_when_attempting_to_unfollow_this_user' => 'An error occured when attempting to unfollow this user',
|
||||
'relationships.you_have_successfully_unfollowed_that_hashtag' => 'You have successfully unfollowed that hashtag',
|
||||
|
||||
|
||||
'security.two_factor_authentication' => 'Two-factor authentication',
|
||||
'security.enabled' => 'Enabled',
|
||||
'security.danger_zone' => 'Danger Zone',
|
||||
|
|
@ -173,23 +174,23 @@ return [
|
|||
'security.see_reblogs_from_accounts_you_follow_in_your_home_etc' => 'See reblogs from accounts you follow in your home feed. (Home timeline only)',
|
||||
'security.photo_reblogs_only' => 'Photo reblogs only',
|
||||
'security.only_see_reblogs_of_photos_or_photo_albums_home_etc' => 'Only see reblogs of photos or photo albums. (Home timeline only)',
|
||||
|
||||
|
||||
// incomplete
|
||||
// the oauth panel is loaded from elsewhere
|
||||
// the oauth panel is loaded from elsewhere
|
||||
'developers.oauth_has_not_been_enabled_on_this_instance' => 'OAuth has not been enabled on this instance.',
|
||||
|
||||
|
||||
// incomplete
|
||||
// import/ig.blade.php seems not in use anymore
|
||||
'import.import_from_instagram' => 'Import from Instagram',
|
||||
|
||||
|
||||
'export.data_export' => 'Data Export',
|
||||
'export.we_generate_data_exports_once_per_hour_and_they_may_etc' => 'We generate data exports once per hour, and they may not contain the latest data if you\'ve requested them recently.',
|
||||
'export.statuses' => 'Statuses',
|
||||
'export.mute_block_lists' => 'Mute/Block List',
|
||||
|
||||
|
||||
// incomplete
|
||||
// some language outside the blades (in app/Http/Controllers/Settings/LabsSettings.php)
|
||||
'labs' => 'Labs',
|
||||
'labs.experimental_features' => 'Experimental features',
|
||||
'labs.use_dark_mode_theme' => 'Use dark mode theme.',
|
||||
];
|
||||
];
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ return [
|
|||
'relationships.unfollow' => 'Deixar de seguir',
|
||||
'relationships.mute' => 'Silenciar',
|
||||
'relationships.block' => 'Bloquear',
|
||||
'relationships.removeFollow' => 'Remover Seguidor',
|
||||
'relationships.mute_successful' => 'Silenciamento bem-sucedido',
|
||||
'relationships.you_have_successfully_muted_that_user' => 'Você silenciou com sucesso esse usuário',
|
||||
'relationships.block_successful' => 'Bloqueio bem-sucedido',
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
<td class="text-center">
|
||||
<a class="btn btn-outline-primary btn-sm py-0 action-btn" href="#" data-id="{{$follower->id}}" data-action="mute">{{__('settings.relationships.mute')}}</a>
|
||||
<a class="btn btn-outline-danger btn-sm py-0 action-btn" href="#" data-id="{{$follower->id}}" data-action="block">{{__('settings.relationships.block')}}</a>
|
||||
<a class="btn btn-outline-secondary btn-sm py-0 action-btn" href="#" data-id="{{$follower->id}}" data-action="removeFollow">{{__('settings.relationships.removeFollow')}}</a>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
|
|
@ -90,7 +91,7 @@
|
|||
background-color: #F7FAFC;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@endpush
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(() => {
|
||||
|
|
@ -152,6 +153,16 @@
|
|||
'success'
|
||||
);
|
||||
});
|
||||
break;
|
||||
case 'removeFollow':
|
||||
axios.post('/api/v1/accounts/' + id + '/removeFollow').then(res => {
|
||||
swal(
|
||||
'{{__('settings.relationships.unfollow_successful')}}',
|
||||
'{{__('settings.relationships.you_have_successfully_unfollowed_that_user')}}',
|
||||
'success'
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ Route::group(['prefix' => 'api'], function () use ($middleware) {
|
|||
Route::post('accounts/{id}/unfollow', 'Api\ApiV1Controller@accountUnfollowById')->middleware($middleware);
|
||||
Route::post('accounts/{id}/block', 'Api\ApiV1Controller@accountBlockById')->middleware($middleware);
|
||||
Route::post('accounts/{id}/unblock', 'Api\ApiV1Controller@accountUnblockById')->middleware($middleware);
|
||||
Route::post('accounts/{id}/removeFollow', 'Api\ApiV1Controller@accountRemoveFollowById')->middleware($middleware);
|
||||
Route::post('accounts/{id}/pin', 'Api\ApiV1Controller@accountEndorsements')->middleware($middleware);
|
||||
Route::post('accounts/{id}/unpin', 'Api\ApiV1Controller@accountEndorsements')->middleware($middleware);
|
||||
Route::post('accounts/{id}/mute', 'Api\ApiV1Controller@accountMuteById')->middleware($middleware);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::get('accounts/{id}/statuses', 'PublicApiController@accountStatuses');
|
||||
Route::post('accounts/{id}/block', 'Api\ApiV1Controller@accountBlockById');
|
||||
Route::post('accounts/{id}/unblock', 'Api\ApiV1Controller@accountUnblockById');
|
||||
Route::post('accounts/{id}/removeFollow', 'Api\ApiV1Controller@accountRemoveFollowById');
|
||||
Route::get('statuses/{id}', 'PublicApiController@getStatus');
|
||||
Route::get('accounts/{id}', 'PublicApiController@account');
|
||||
Route::post('avatar/update', 'ApiController@avatarUpdate');
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue