This commit is contained in:
		
							parent
							
								
									7f9a35d7ac
								
							
						
					
					
						commit
						22e79675ad
					
				
					 16 changed files with 205 additions and 66 deletions
				
			
		| 
						 | 
				
			
			@ -710,6 +710,7 @@ desktop/views/components/settings.vue:
 | 
			
		|||
  show-reply-target: "リプライ先を表示する"
 | 
			
		||||
  show-my-renotes: "自分の行ったRenoteをタイムラインに表示する"
 | 
			
		||||
  show-renoted-my-notes: "Renoteされた自分の投稿をタイムラインに表示する"
 | 
			
		||||
  show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
 | 
			
		||||
  show-maps: "マップの自動展開"
 | 
			
		||||
  show-maps-desc: "位置情報が添付された投稿のマップを自動的に展開します。"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1294,6 +1295,7 @@ mobile/views/pages/settings.vue:
 | 
			
		|||
  show-reply-target: "リプライ先を表示する"
 | 
			
		||||
  show-my-renotes: "自分の行ったRenoteを表示する"
 | 
			
		||||
  show-renoted-my-notes: "Renoteされた自分の投稿を表示する"
 | 
			
		||||
  show-local-renotes: "Renoteされたローカルの投稿の投稿をタイムラインに表示する"
 | 
			
		||||
  post-style: "投稿の表示スタイル"
 | 
			
		||||
  post-style-standard: "標準"
 | 
			
		||||
  post-style-smart: "スマート"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -135,6 +135,12 @@ export default Vue.extend({
 | 
			
		|||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (this.$store.state.settings.showLocalRenotes === false) {
 | 
			
		||||
				if (isPureRenote && (note.renote.user.host == null)) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//#endregion
 | 
			
		||||
 | 
			
		||||
			// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,7 @@
 | 
			
		|||
			<mk-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget" text="%i18n:@show-reply-target%"/>
 | 
			
		||||
			<mk-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes" text="%i18n:@show-my-renotes%"/>
 | 
			
		||||
			<mk-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes" text="%i18n:@show-renoted-my-notes%"/>
 | 
			
		||||
			<mk-switch v-model="$store.state.settings.showLocalRenotes" @change="onChangeShowLocalRenotes" text="%i18n:@show-local-renotes%"/>
 | 
			
		||||
			<mk-switch v-model="$store.state.settings.showMaps" @change="onChangeShowMaps" text="%i18n:@show-maps%">
 | 
			
		||||
				<span>%i18n:@show-maps-desc%</span>
 | 
			
		||||
			</mk-switch>
 | 
			
		||||
| 
						 | 
				
			
			@ -353,6 +354,12 @@ export default Vue.extend({
 | 
			
		|||
				value: v
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		onChangeShowLocalRenotes(v) {
 | 
			
		||||
			this.$store.dispatch('settings/set', {
 | 
			
		||||
				key: 'showLocalRenotes',
 | 
			
		||||
				value: v
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		onChangeShowMaps(v) {
 | 
			
		||||
			this.$store.dispatch('settings/set', {
 | 
			
		||||
				key: 'showMaps',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,7 +100,8 @@ export default Vue.extend({
 | 
			
		|||
					limit: fetchLimit + 1,
 | 
			
		||||
					untilDate: this.date ? this.date.getTime() : undefined,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +123,8 @@ export default Vue.extend({
 | 
			
		|||
				limit: fetchLimit + 1,
 | 
			
		||||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,8 @@ export default Vue.extend({
 | 
			
		|||
					listId: this.list.id,
 | 
			
		||||
					limit: fetchLimit + 1,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +68,8 @@ export default Vue.extend({
 | 
			
		|||
				limit: fetchLimit + 1,
 | 
			
		||||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,8 @@ export default Vue.extend({
 | 
			
		|||
					limit: fetchLimit + 1,
 | 
			
		||||
					mediaOnly: this.mediaOnly,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +92,8 @@ export default Vue.extend({
 | 
			
		|||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				mediaOnly: this.mediaOnly,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,6 +140,12 @@ export default Vue.extend({
 | 
			
		|||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (this.$store.state.settings.showLocalRenotes === false) {
 | 
			
		||||
				if (isPureRenote && (note.renote.user.host == null)) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//#endregion
 | 
			
		||||
 | 
			
		||||
			if (this.isScrollTop()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,8 @@ export default Vue.extend({
 | 
			
		|||
					limit: fetchLimit + 1,
 | 
			
		||||
					mediaOnly: this.mediaOnly,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +120,8 @@ export default Vue.extend({
 | 
			
		|||
				mediaOnly: this.mediaOnly,
 | 
			
		||||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -139,6 +139,12 @@ export default Vue.extend({
 | 
			
		|||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (this.$store.state.settings.showLocalRenotes === false) {
 | 
			
		||||
				if (isPureRenote && (note.renote.user.host == null)) {
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//#endregion
 | 
			
		||||
 | 
			
		||||
			// 投稿が自分のものではないかつ、タブが非表示またはスクロール位置が最上部ではないならタイトルで通知
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,8 @@ export default Vue.extend({
 | 
			
		|||
					listId: this.list.id,
 | 
			
		||||
					limit: fetchLimit + 1,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +83,8 @@ export default Vue.extend({
 | 
			
		|||
				limit: fetchLimit + 1,
 | 
			
		||||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,7 +95,8 @@ export default Vue.extend({
 | 
			
		|||
					limit: fetchLimit + 1,
 | 
			
		||||
					untilDate: this.date ? this.date.getTime() : undefined,
 | 
			
		||||
					includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
					includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
					includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
				}).then(notes => {
 | 
			
		||||
					if (notes.length == fetchLimit + 1) {
 | 
			
		||||
						notes.pop();
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +118,8 @@ export default Vue.extend({
 | 
			
		|||
				limit: fetchLimit + 1,
 | 
			
		||||
				untilId: (this.$refs.timeline as any).tail().id,
 | 
			
		||||
				includeMyRenotes: this.$store.state.settings.showMyRenotes,
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
 | 
			
		||||
				includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
 | 
			
		||||
				includeLocalRenotes: this.$store.state.settings.showLocalRenotes
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			promise.then(notes => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,7 @@
 | 
			
		|||
					<ui-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget">%i18n:@show-reply-target%</ui-switch>
 | 
			
		||||
					<ui-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes">%i18n:@show-my-renotes%</ui-switch>
 | 
			
		||||
					<ui-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes">%i18n:@show-renoted-my-notes%</ui-switch>
 | 
			
		||||
					<ui-switch v-model="$store.state.settings.showLocalRenotes" @change="onChangeShowLocalRenotes">%i18n:@show-local-renotes%</ui-switch>
 | 
			
		||||
				</div>
 | 
			
		||||
 | 
			
		||||
				<div>
 | 
			
		||||
| 
						 | 
				
			
			@ -221,6 +222,13 @@ export default Vue.extend({
 | 
			
		|||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		onChangeShowLocalRenotes(v) {
 | 
			
		||||
			this.$store.dispatch('settings/set', {
 | 
			
		||||
				key: 'showLocalRenotes',
 | 
			
		||||
				value: v
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		checkForUpdate() {
 | 
			
		||||
			this.checkingForUpdate = true;
 | 
			
		||||
			checkForUpdate((this as any).os, true, true).then(newer => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ const defaultSettings = {
 | 
			
		|||
	showReplyTarget: true,
 | 
			
		||||
	showMyRenotes: true,
 | 
			
		||||
	showRenotedMyNotes: true,
 | 
			
		||||
	showLocalRenotes: true,
 | 
			
		||||
	loadRemoteMedia: true,
 | 
			
		||||
	disableViaMobile: false,
 | 
			
		||||
	memo: null,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,13 @@ export const meta = {
 | 
			
		|||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		includeLocalRenotes: $.bool.optional.note({
 | 
			
		||||
			default: true,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'Renoteされたローカルの投稿を含めるかどうか'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		mediaOnly: $.bool.optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'true にすると、メディアが添付された投稿だけ取得します'
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +187,22 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.includeLocalRenotes === false) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			$or: [{
 | 
			
		||||
				'_renote.user.host': { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				renoteId: null
 | 
			
		||||
			}, {
 | 
			
		||||
				text: { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				mediaIds: { $ne: [] }
 | 
			
		||||
			}, {
 | 
			
		||||
				poll: { $ne: null }
 | 
			
		||||
			}]
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.mediaOnly) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			mediaIds: { $exists: true, $ne: [] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,13 @@ export const meta = {
 | 
			
		|||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		includeLocalRenotes: $.bool.optional.note({
 | 
			
		||||
			default: true,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'Renoteされたローカルの投稿を含めるかどうか'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		mediaOnly: $.bool.optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'true にすると、メディアが添付された投稿だけ取得します'
 | 
			
		||||
| 
						 | 
				
			
			@ -170,6 +177,22 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.includeLocalRenotes === false) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			$or: [{
 | 
			
		||||
				'_renote.user.host': { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				renoteId: null
 | 
			
		||||
			}, {
 | 
			
		||||
				text: { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				mediaIds: { $ne: [] }
 | 
			
		||||
			}, {
 | 
			
		||||
				poll: { $ne: null }
 | 
			
		||||
			}]
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.mediaOnly) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			mediaIds: { $exists: true, $ne: [] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@ import Mute from '../../../../models/mute';
 | 
			
		|||
import { pack } from '../../../../models/note';
 | 
			
		||||
import UserList from '../../../../models/user-list';
 | 
			
		||||
import { ILocalUser } from '../../../../models/user';
 | 
			
		||||
import getParams from '../../get-params';
 | 
			
		||||
 | 
			
		||||
export const meta = {
 | 
			
		||||
	desc: {
 | 
			
		||||
| 
						 | 
				
			
			@ -11,56 +12,84 @@ export const meta = {
 | 
			
		|||
		en: 'Get timeline of a user list.'
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	requireCredential: true
 | 
			
		||||
	requireCredential: true,
 | 
			
		||||
 | 
			
		||||
	params: {
 | 
			
		||||
		listId: $.type(ID).note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'リストのID'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		limit: $.num.optional.range(1, 100).note({
 | 
			
		||||
			default: 10,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '最大数'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		sinceId: $.type(ID).optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '指定すると、この投稿を基点としてより新しい投稿を取得します'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		untilId: $.type(ID).optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '指定すると、この投稿を基点としてより古い投稿を取得します'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		sinceDate: $.num.optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '指定した時間を基点としてより新しい投稿を取得します。数値は、1970年1月1日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		untilDate: $.num.optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '指定した時間を基点としてより古い投稿を取得します。数値は、1970年1月1日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		includeMyRenotes: $.bool.optional.note({
 | 
			
		||||
			default: true,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: '自分の行ったRenoteを含めるかどうか'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		includeRenotedMyNotes: $.bool.optional.note({
 | 
			
		||||
			default: true,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'Renoteされた自分の投稿を含めるかどうか'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		includeLocalRenotes: $.bool.optional.note({
 | 
			
		||||
			default: true,
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'Renoteされたローカルの投稿を含めるかどうか'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
		mediaOnly: $.bool.optional.note({
 | 
			
		||||
			desc: {
 | 
			
		||||
				ja: 'true にすると、メディアが添付された投稿だけ取得します'
 | 
			
		||||
			}
 | 
			
		||||
		}),
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default async (params: any, user: ILocalUser) => {
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
	const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
 | 
			
		||||
	if (limitErr) throw 'invalid limit param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $.type(ID).optional.get(params.sinceId);
 | 
			
		||||
	if (sinceIdErr) throw 'invalid sinceId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $.type(ID).optional.get(params.untilId);
 | 
			
		||||
	if (untilIdErr) throw 'invalid untilId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceDate' parameter
 | 
			
		||||
	const [sinceDate, sinceDateErr] = $.num.optional.get(params.sinceDate);
 | 
			
		||||
	if (sinceDateErr) throw 'invalid sinceDate param';
 | 
			
		||||
 | 
			
		||||
	// Get 'untilDate' parameter
 | 
			
		||||
	const [untilDate, untilDateErr] = $.num.optional.get(params.untilDate);
 | 
			
		||||
	if (untilDateErr) throw 'invalid untilDate param';
 | 
			
		||||
 | 
			
		||||
	// Check if only one of sinceId, untilId, sinceDate, untilDate specified
 | 
			
		||||
	if ([sinceId, untilId, sinceDate, untilDate].filter(x => x != null).length > 1) {
 | 
			
		||||
		throw 'only one of sinceId, untilId, sinceDate, untilDate can be specified';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get 'includeMyRenotes' parameter
 | 
			
		||||
	const [includeMyRenotes = true, includeMyRenotesErr] = $.bool.optional.get(params.includeMyRenotes);
 | 
			
		||||
	if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
 | 
			
		||||
 | 
			
		||||
	// Get 'includeRenotedMyNotes' parameter
 | 
			
		||||
	const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $.bool.optional.get(params.includeRenotedMyNotes);
 | 
			
		||||
	if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
 | 
			
		||||
 | 
			
		||||
	// Get 'mediaOnly' parameter
 | 
			
		||||
	const [mediaOnly, mediaOnlyErr] = $.bool.optional.get(params.mediaOnly);
 | 
			
		||||
	if (mediaOnlyErr) throw 'invalid mediaOnly param';
 | 
			
		||||
 | 
			
		||||
	// Get 'listId' parameter
 | 
			
		||||
	const [listId, listIdErr] = $.type(ID).get(params.listId);
 | 
			
		||||
	if (listIdErr) throw 'invalid listId param';
 | 
			
		||||
	const [ps, psErr] = getParams(meta, params);
 | 
			
		||||
	if (psErr) throw psErr;
 | 
			
		||||
 | 
			
		||||
	const [list, mutedUserIds] = await Promise.all([
 | 
			
		||||
		// リストを取得
 | 
			
		||||
		// Fetch the list
 | 
			
		||||
		UserList.findOne({
 | 
			
		||||
			_id: listId,
 | 
			
		||||
			_id: ps.listId,
 | 
			
		||||
			userId: user._id
 | 
			
		||||
		}),
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +151,7 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
	// つまり、「『自分の投稿かつRenote』ではない」を「『自分の投稿ではない』または『Renoteではない』」と表現します。
 | 
			
		||||
	// for details: https://en.wikipedia.org/wiki/De_Morgan%27s_laws
 | 
			
		||||
 | 
			
		||||
	if (includeMyRenotes === false) {
 | 
			
		||||
	if (ps.includeMyRenotes === false) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			$or: [{
 | 
			
		||||
				userId: { $ne: user._id }
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +167,7 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (includeRenotedMyNotes === false) {
 | 
			
		||||
	if (ps.includeRenotedMyNotes === false) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			$or: [{
 | 
			
		||||
				'_renote.userId': { $ne: user._id }
 | 
			
		||||
| 
						 | 
				
			
			@ -154,29 +183,45 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (mediaOnly) {
 | 
			
		||||
	if (ps.includeLocalRenotes === false) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			$or: [{
 | 
			
		||||
				'_renote.user.host': { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				renoteId: null
 | 
			
		||||
			}, {
 | 
			
		||||
				text: { $ne: null }
 | 
			
		||||
			}, {
 | 
			
		||||
				mediaIds: { $ne: [] }
 | 
			
		||||
			}, {
 | 
			
		||||
				poll: { $ne: null }
 | 
			
		||||
			}]
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ps.mediaOnly) {
 | 
			
		||||
		query.$and.push({
 | 
			
		||||
			mediaIds: { $exists: true, $ne: [] }
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (sinceId) {
 | 
			
		||||
	if (ps.sinceId) {
 | 
			
		||||
		sort._id = 1;
 | 
			
		||||
		query._id = {
 | 
			
		||||
			$gt: sinceId
 | 
			
		||||
			$gt: ps.sinceId
 | 
			
		||||
		};
 | 
			
		||||
	} else if (untilId) {
 | 
			
		||||
	} else if (ps.untilId) {
 | 
			
		||||
		query._id = {
 | 
			
		||||
			$lt: untilId
 | 
			
		||||
			$lt: ps.untilId
 | 
			
		||||
		};
 | 
			
		||||
	} else if (sinceDate) {
 | 
			
		||||
	} else if (ps.sinceDate) {
 | 
			
		||||
		sort._id = 1;
 | 
			
		||||
		query.createdAt = {
 | 
			
		||||
			$gt: new Date(sinceDate)
 | 
			
		||||
			$gt: new Date(ps.sinceDate)
 | 
			
		||||
		};
 | 
			
		||||
	} else if (untilDate) {
 | 
			
		||||
	} else if (ps.untilDate) {
 | 
			
		||||
		query.createdAt = {
 | 
			
		||||
			$lt: new Date(untilDate)
 | 
			
		||||
			$lt: new Date(ps.untilDate)
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
	//#endregion
 | 
			
		||||
| 
						 | 
				
			
			@ -184,7 +229,7 @@ export default async (params: any, user: ILocalUser) => {
 | 
			
		|||
	// Issue query
 | 
			
		||||
	const timeline = await Note
 | 
			
		||||
		.find(query, {
 | 
			
		||||
			limit: limit,
 | 
			
		||||
			limit: ps.limit,
 | 
			
		||||
			sort: sort
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue