user mention (#3771)
This commit is contained in:
		
							parent
							
								
									8573e258f8
								
							
						
					
					
						commit
						fdd42fc2d7
					
				
					 11 changed files with 68 additions and 2 deletions
				
			
		| 
						 | 
					@ -360,6 +360,7 @@ common/views/components/nav.vue:
 | 
				
			||||||
  feedback: "フィードバック"
 | 
					  feedback: "フィードバック"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
common/views/components/note-menu.vue:
 | 
					common/views/components/note-menu.vue:
 | 
				
			||||||
 | 
					  mention: "メンション"
 | 
				
			||||||
  detail: "詳細"
 | 
					  detail: "詳細"
 | 
				
			||||||
  copy-link: "リンクをコピー"
 | 
					  copy-link: "リンクをコピー"
 | 
				
			||||||
  favorite: "お気に入り"
 | 
					  favorite: "お気に入り"
 | 
				
			||||||
| 
						 | 
					@ -1365,6 +1366,7 @@ desktop/views/pages/user/user.header.vue:
 | 
				
			||||||
  posts: "投稿"
 | 
					  posts: "投稿"
 | 
				
			||||||
  following: "フォロー"
 | 
					  following: "フォロー"
 | 
				
			||||||
  followers: "フォロワー"
 | 
					  followers: "フォロワー"
 | 
				
			||||||
 | 
					  mention: "メンション"
 | 
				
			||||||
  is-bot: "このアカウントはBotです"
 | 
					  is-bot: "このアカウントはBotです"
 | 
				
			||||||
  years-old: "{age}歳"
 | 
					  years-old: "{age}歳"
 | 
				
			||||||
  year: "年"
 | 
					  year: "年"
 | 
				
			||||||
| 
						 | 
					@ -1715,6 +1717,7 @@ deck/deck.user-column.vue:
 | 
				
			||||||
  posts: "投稿"
 | 
					  posts: "投稿"
 | 
				
			||||||
  following: "フォロー"
 | 
					  following: "フォロー"
 | 
				
			||||||
  followers: "フォロワー"
 | 
					  followers: "フォロワー"
 | 
				
			||||||
 | 
					  mention: "メンション"
 | 
				
			||||||
  images: "画像"
 | 
					  images: "画像"
 | 
				
			||||||
  activity: "アクティビティ"
 | 
					  activity: "アクティビティ"
 | 
				
			||||||
  timeline: "タイムライン"
 | 
					  timeline: "タイムライン"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,13 @@ export default Vue.extend({
 | 
				
			||||||
	computed: {
 | 
						computed: {
 | 
				
			||||||
		items(): any[] {
 | 
							items(): any[] {
 | 
				
			||||||
			return concat(intersperse([null], [
 | 
								return concat(intersperse([null], [
 | 
				
			||||||
 | 
									[
 | 
				
			||||||
 | 
										[{
 | 
				
			||||||
 | 
											icon: 'at',
 | 
				
			||||||
 | 
											text: this.$t('mention'),
 | 
				
			||||||
 | 
											action: this.mention
 | 
				
			||||||
 | 
										}]
 | 
				
			||||||
 | 
									],
 | 
				
			||||||
				[
 | 
									[
 | 
				
			||||||
					[{
 | 
										[{
 | 
				
			||||||
						icon: 'info-circle',
 | 
											icon: 'info-circle',
 | 
				
			||||||
| 
						 | 
					@ -66,6 +73,10 @@ export default Vue.extend({
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	methods: {
 | 
						methods: {
 | 
				
			||||||
 | 
							mention() {
 | 
				
			||||||
 | 
								this.$post({ mention: this.note.user });
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		detail() {
 | 
							detail() {
 | 
				
			||||||
			this.$router.push(`/notes/${this.note.id}`);
 | 
								this.$router.push(`/notes/${this.note.id}`);
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,6 +70,7 @@ init(async (launch) => {
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					const vm = this.$root.new(PostFormWindow, {
 | 
										const vm = this.$root.new(PostFormWindow, {
 | 
				
			||||||
						reply: o.reply,
 | 
											reply: o.reply,
 | 
				
			||||||
 | 
											mention: o.mention,
 | 
				
			||||||
						animation: o.animation == null ? true : o.animation
 | 
											animation: o.animation == null ? true : o.animation
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
					if (o.cb) vm.$once('closed', o.cb);
 | 
										if (o.cb) vm.$once('closed', o.cb);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@
 | 
				
			||||||
		<mk-note-preview v-if="reply" class="notePreview" :note="reply"/>
 | 
							<mk-note-preview v-if="reply" class="notePreview" :note="reply"/>
 | 
				
			||||||
		<mk-post-form ref="form"
 | 
							<mk-post-form ref="form"
 | 
				
			||||||
			:reply="reply"
 | 
								:reply="reply"
 | 
				
			||||||
 | 
								:mention="mention"
 | 
				
			||||||
			@posted="onPosted"
 | 
								@posted="onPosted"
 | 
				
			||||||
			@change-uploadings="onChangeUploadings"
 | 
								@change-uploadings="onChangeUploadings"
 | 
				
			||||||
			@change-attached-files="onChangeFiles"
 | 
								@change-attached-files="onChangeFiles"
 | 
				
			||||||
| 
						 | 
					@ -32,6 +33,10 @@ export default Vue.extend({
 | 
				
			||||||
			type: Object,
 | 
								type: Object,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							mention: {
 | 
				
			||||||
 | 
								type: Object,
 | 
				
			||||||
 | 
								required: false
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		animation: {
 | 
							animation: {
 | 
				
			||||||
			type: Boolean,
 | 
								type: Boolean,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,6 +92,10 @@ export default Vue.extend({
 | 
				
			||||||
			type: Object,
 | 
								type: Object,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							mention: {
 | 
				
			||||||
 | 
								type: Object,
 | 
				
			||||||
 | 
								required: false
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		initialText: {
 | 
							initialText: {
 | 
				
			||||||
			type: String,
 | 
								type: String,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
| 
						 | 
					@ -178,6 +182,11 @@ export default Vue.extend({
 | 
				
			||||||
			this.text = this.initialText;
 | 
								this.text = this.initialText;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (this.mention) {
 | 
				
			||||||
 | 
								this.text = this.mention.host ? `@${this.mention.username}@${toASCII(this.mention.host)}` : `@${this.mention.username}`;
 | 
				
			||||||
 | 
								this.text += ' ';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.reply && this.reply.user.host != null) {
 | 
							if (this.reply && this.reply.user.host != null) {
 | 
				
			||||||
			this.text = `@${this.reply.user.username}@${toASCII(this.reply.user.host)} `;
 | 
								this.text = `@${this.reply.user.username}@${toASCII(this.reply.user.host)} `;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -215,7 +224,7 @@ export default Vue.extend({
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$nextTick(() => {
 | 
							this.$nextTick(() => {
 | 
				
			||||||
			// 書きかけの投稿を復元
 | 
								// 書きかけの投稿を復元
 | 
				
			||||||
			if (!this.instant) {
 | 
								if (!this.instant && !this.mention) {
 | 
				
			||||||
				const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
 | 
									const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
 | 
				
			||||||
				if (draft) {
 | 
									if (draft) {
 | 
				
			||||||
					this.text = draft.data.text;
 | 
										this.text = draft.data.text;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,9 @@
 | 
				
			||||||
					<b>{{ user.followersCount | number }}</b>
 | 
										<b>{{ user.followersCount | number }}</b>
 | 
				
			||||||
					<span>{{ $t('followers') }}</span>
 | 
										<span>{{ $t('followers') }}</span>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
									<div class="mention">
 | 
				
			||||||
 | 
										<button @click="mention" :title="$t('mention')"><fa icon="at"/></button>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
		<div class="pinned" v-if="user.pinnedNotes && user.pinnedNotes.length > 0">
 | 
							<div class="pinned" v-if="user.pinnedNotes && user.pinnedNotes.length > 0">
 | 
				
			||||||
| 
						 | 
					@ -307,6 +310,10 @@ export default Vue.extend({
 | 
				
			||||||
			return promise;
 | 
								return promise;
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							mention() {
 | 
				
			||||||
 | 
								this.$post({ mention: this.user });
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		menu() {
 | 
							menu() {
 | 
				
			||||||
			let menu = [{
 | 
								let menu = [{
 | 
				
			||||||
				icon: 'list',
 | 
									icon: 'list',
 | 
				
			||||||
| 
						 | 
					@ -454,7 +461,7 @@ export default Vue.extend({
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		> .counts
 | 
							> .counts
 | 
				
			||||||
			display grid
 | 
								display grid
 | 
				
			||||||
			grid-template-columns 1fr 1fr 1fr
 | 
								grid-template-columns 2fr 2fr 2fr 1fr
 | 
				
			||||||
			margin-top 8px
 | 
								margin-top 8px
 | 
				
			||||||
			border-top solid 1px var(--faceDivider)
 | 
								border-top solid 1px var(--faceDivider)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -471,6 +478,9 @@ export default Vue.extend({
 | 
				
			||||||
					font-size 80%
 | 
										font-size 80%
 | 
				
			||||||
					opacity 0.7
 | 
										opacity 0.7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								> .mention
 | 
				
			||||||
 | 
									display flex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	> *
 | 
						> *
 | 
				
			||||||
		> p.caption
 | 
							> p.caption
 | 
				
			||||||
			margin 0
 | 
								margin 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,7 @@
 | 
				
			||||||
			<span class="notes-count"><b>{{ user.notesCount | number }}</b>{{ $t('posts') }}</span>
 | 
								<span class="notes-count"><b>{{ user.notesCount | number }}</b>{{ $t('posts') }}</span>
 | 
				
			||||||
			<router-link :to="user | userPage('following')" class="following clickable"><b>{{ user.followingCount | number }}</b>{{ $t('following') }}</router-link>
 | 
								<router-link :to="user | userPage('following')" class="following clickable"><b>{{ user.followingCount | number }}</b>{{ $t('following') }}</router-link>
 | 
				
			||||||
			<router-link :to="user | userPage('followers')" class="followers clickable"><b>{{ user.followersCount | number }}</b>{{ $t('followers') }}</router-link>
 | 
								<router-link :to="user | userPage('followers')" class="followers clickable"><b>{{ user.followersCount | number }}</b>{{ $t('followers') }}</router-link>
 | 
				
			||||||
 | 
								<button @click="mention" :title="$t('mention')"><fa icon="at"/></button>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -77,6 +78,9 @@ export default Vue.extend({
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						methods: {
 | 
				
			||||||
 | 
							mention() {
 | 
				
			||||||
 | 
								this.$post({ mention: this.user });
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		onScroll() {
 | 
							onScroll() {
 | 
				
			||||||
			const banner = this.$refs.banner as any;
 | 
								const banner = this.$refs.banner as any;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,6 +60,7 @@ init((launch) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				const vm = this.$root.new(PostForm, {
 | 
									const vm = this.$root.new(PostForm, {
 | 
				
			||||||
					reply: o.reply,
 | 
										reply: o.reply,
 | 
				
			||||||
 | 
										mention: o.mention,
 | 
				
			||||||
					renote: o.renote
 | 
										renote: o.renote
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
		<mk-post-form ref="form"
 | 
							<mk-post-form ref="form"
 | 
				
			||||||
			:reply="reply"
 | 
								:reply="reply"
 | 
				
			||||||
			:renote="renote"
 | 
								:renote="renote"
 | 
				
			||||||
 | 
								:mention="mention"
 | 
				
			||||||
			:initial-text="initialText"
 | 
								:initial-text="initialText"
 | 
				
			||||||
			:instant="instant"
 | 
								:instant="instant"
 | 
				
			||||||
			@posted="onPosted"
 | 
								@posted="onPosted"
 | 
				
			||||||
| 
						 | 
					@ -27,6 +28,10 @@ export default Vue.extend({
 | 
				
			||||||
			type: Object,
 | 
								type: Object,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							mention: {
 | 
				
			||||||
 | 
								type: Object,
 | 
				
			||||||
 | 
								required: false
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		initialText: {
 | 
							initialText: {
 | 
				
			||||||
			type: String,
 | 
								type: String,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,6 +84,10 @@ export default Vue.extend({
 | 
				
			||||||
			type: Object,
 | 
								type: Object,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							mention: {
 | 
				
			||||||
 | 
								type: Object,
 | 
				
			||||||
 | 
								required: false
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		initialText: {
 | 
							initialText: {
 | 
				
			||||||
			type: String,
 | 
								type: String,
 | 
				
			||||||
			required: false
 | 
								required: false
 | 
				
			||||||
| 
						 | 
					@ -172,6 +176,11 @@ export default Vue.extend({
 | 
				
			||||||
			this.text = `@${this.reply.user.username}@${toASCII(this.reply.user.host)} `;
 | 
								this.text = `@${this.reply.user.username}@${toASCII(this.reply.user.host)} `;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (this.mention) {
 | 
				
			||||||
 | 
								this.text = this.mention.host ? `@${this.mention.username}@${toASCII(this.mention.host)}` : `@${this.mention.username}`;
 | 
				
			||||||
 | 
								this.text += ' ';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.reply && this.reply.text != null) {
 | 
							if (this.reply && this.reply.text != null) {
 | 
				
			||||||
			const ast = parse(this.reply.text);
 | 
								const ast = parse(this.reply.text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,6 +55,7 @@
 | 
				
			||||||
						<b>{{ user.followersCount | number }}</b>
 | 
											<b>{{ user.followersCount | number }}</b>
 | 
				
			||||||
						<i>{{ $t('followers') }}</i>
 | 
											<i>{{ $t('followers') }}</i>
 | 
				
			||||||
					</a>
 | 
										</a>
 | 
				
			||||||
 | 
										<button @click="mention"><fa icon="at"/></button>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</header>
 | 
							</header>
 | 
				
			||||||
| 
						 | 
					@ -126,6 +127,10 @@ export default Vue.extend({
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							mention() {
 | 
				
			||||||
 | 
								this.$post({ mention: this.user });
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		menu() {
 | 
							menu() {
 | 
				
			||||||
			let menu = [{
 | 
								let menu = [{
 | 
				
			||||||
				icon: ['fas', 'list'],
 | 
									icon: ['fas', 'list'],
 | 
				
			||||||
| 
						 | 
					@ -365,6 +370,9 @@ main
 | 
				
			||||||
					> i
 | 
										> i
 | 
				
			||||||
						font-size 14px
 | 
											font-size 14px
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									> button
 | 
				
			||||||
 | 
										color var(--text)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	> nav
 | 
						> nav
 | 
				
			||||||
		position -webkit-sticky
 | 
							position -webkit-sticky
 | 
				
			||||||
		position sticky
 | 
							position sticky
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue