mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	ux: should not show follow requests tab when have no pending sent follow req
This commit is contained in:
		
							parent
							
								
									1eacf0772c
								
							
						
					
					
						commit
						0e6ba9ccd4
					
				
					 6 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -374,6 +374,13 @@ export class UserEntityService implements OnModuleInit {
 | 
			
		|||
		return count > 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@bindThis
 | 
			
		||||
	public async getHasPendingSentFollowRequest(userId: MiUser['id']): Promise<boolean> {
 | 
			
		||||
		return this.followRequestsRepository.existsBy({
 | 
			
		||||
			followerId: userId,
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@bindThis
 | 
			
		||||
	public getOnlineStatus(user: MiUser): 'unknown' | 'online' | 'active' | 'offline' {
 | 
			
		||||
		if (user.hideOnlineStatus) return 'unknown';
 | 
			
		||||
| 
						 | 
				
			
			@ -642,6 +649,7 @@ export class UserEntityService implements OnModuleInit {
 | 
			
		|||
				hasUnreadChannel: false, // 後方互換性のため
 | 
			
		||||
				hasUnreadNotification: notificationsInfo?.hasUnread, // 後方互換性のため
 | 
			
		||||
				hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
 | 
			
		||||
				hasPendingSentFollowRequest: this.getHasPendingSentFollowRequest(user.id),
 | 
			
		||||
				unreadNotificationsCount: notificationsInfo?.unreadCount,
 | 
			
		||||
				mutedWords: profile!.mutedWords,
 | 
			
		||||
				hardMutedWords: profile!.hardMutedWords,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -578,6 +578,10 @@ export const packedMeDetailedOnlySchema = {
 | 
			
		|||
			type: 'boolean',
 | 
			
		||||
			nullable: false, optional: false,
 | 
			
		||||
		},
 | 
			
		||||
		hasPendingSentFollowRequest: {
 | 
			
		||||
			type: 'boolean',
 | 
			
		||||
			nullable: false, optional: false,
 | 
			
		||||
		},
 | 
			
		||||
		unreadNotificationsCount: {
 | 
			
		||||
			type: 'number',
 | 
			
		||||
			nullable: false, optional: false,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,9 +7,9 @@ process.env.NODE_ENV = 'test';
 | 
			
		|||
 | 
			
		||||
import * as assert from 'assert';
 | 
			
		||||
import { inspect } from 'node:util';
 | 
			
		||||
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
 | 
			
		||||
import { api, post, role, signup, successfulApiCall, uploadFile } from '../utils.js';
 | 
			
		||||
import type * as misskey from 'misskey-js';
 | 
			
		||||
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
 | 
			
		||||
 | 
			
		||||
describe('ユーザー', () => {
 | 
			
		||||
	// エンティティとしてのユーザーを主眼においたテストを記述する
 | 
			
		||||
| 
						 | 
				
			
			@ -139,6 +139,7 @@ describe('ユーザー', () => {
 | 
			
		|||
			hasUnreadNotification: user.hasUnreadNotification,
 | 
			
		||||
			unreadNotificationsCount: user.unreadNotificationsCount,
 | 
			
		||||
			hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest,
 | 
			
		||||
			hasPendingSentFollowRequest: user.hasPendingSentFollowRequest,
 | 
			
		||||
			unreadAnnouncements: user.unreadAnnouncements,
 | 
			
		||||
			mutedWords: user.mutedWords,
 | 
			
		||||
			hardMutedWords: user.hardMutedWords,
 | 
			
		||||
| 
						 | 
				
			
			@ -378,6 +379,7 @@ describe('ユーザー', () => {
 | 
			
		|||
		assert.strictEqual(response.hasUnreadNotification, false);
 | 
			
		||||
		assert.strictEqual(response.unreadNotificationsCount, 0);
 | 
			
		||||
		assert.strictEqual(response.hasPendingReceivedFollowRequest, false);
 | 
			
		||||
		assert.strictEqual(response.hasPendingSentFollowRequest, false);
 | 
			
		||||
		assert.deepStrictEqual(response.unreadAnnouncements, []);
 | 
			
		||||
		assert.deepStrictEqual(response.mutedWords, []);
 | 
			
		||||
		assert.deepStrictEqual(response.mutedInstances, []);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@ export const navbarItemDef = reactive({
 | 
			
		|||
	followRequests: {
 | 
			
		||||
		title: i18n.ts.followRequests,
 | 
			
		||||
		icon: 'ti ti-user-plus',
 | 
			
		||||
		show: computed(() => $i != null && ($i.isLocked || $i.hasPendingSentFollowRequest)),
 | 
			
		||||
		indicated: computed(() => $i != null && $i.hasPendingReceivedFollowRequest),
 | 
			
		||||
		to: '/my/follow-requests',
 | 
			
		||||
	},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,6 +50,7 @@ import { i18n } from '@/i18n.js';
 | 
			
		|||
import { definePageMetadata } from '@/scripts/page-metadata.js';
 | 
			
		||||
import { infoImageUrl } from '@/instance.js';
 | 
			
		||||
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
 | 
			
		||||
import { $i } from '@/account';
 | 
			
		||||
 | 
			
		||||
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +95,7 @@ const headerTabs = computed(() => [
 | 
			
		|||
	},
 | 
			
		||||
]);
 | 
			
		||||
 | 
			
		||||
const tab = ref('list');
 | 
			
		||||
const tab = ref($i?.hasPendingSentFollowRequest ? 'sent' : 'list');
 | 
			
		||||
 | 
			
		||||
definePageMetadata(() => ({
 | 
			
		||||
	title: i18n.ts.followRequests,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3971,6 +3971,7 @@ export type components = {
 | 
			
		|||
      hasUnreadChannel: boolean;
 | 
			
		||||
      hasUnreadNotification: boolean;
 | 
			
		||||
      hasPendingReceivedFollowRequest: boolean;
 | 
			
		||||
      hasPendingSentFollowRequest: boolean;
 | 
			
		||||
      unreadNotificationsCount: number;
 | 
			
		||||
      mutedWords: string[][];
 | 
			
		||||
      hardMutedWords: string[][];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue