Skip to content

Commit ad66c7a

Browse files
authored
/intent/tweetでTwitterと同じような挙動になるように (#4581)
1 parent b4ad757 commit ad66c7a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/client/app/common/views/pages/share.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,21 @@ export default Vue.extend({
2323
text: new URLSearchParams(location.search).get('text'),
2424
url: new URLSearchParams(location.search).get('url'),
2525
title: new URLSearchParams(location.search).get('title'),
26+
hashtags: new URLSearchParams(location.search).get('hashtags'),
2627
};
2728
},
2829
computed: {
2930
template(): string {
3031
let t = '';
3132
if (this.title) t += `【${this.title}】\n`;
32-
if (this.text) t += `${this.text}\n`;
33-
if (this.url) t += `${this.url}`;
33+
if (this.text) t += `${this.text.trim()}\n`;
34+
if (this.url) t += `${this.url.trim()}\n`;
35+
36+
if (this.hashtags) {
37+
const tags = this.hashtags.split(',').map(x => `#${x}`).join(' ')
38+
t += `${tags}`;
39+
}
40+
3441
return t.trim();
3542
}
3643
},

src/client/app/desktop/script.ts

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ init(async (launch, os) => {
174174
{ path: '/selectdrive', component: () => import('./views/pages/selectdrive.vue').then(m => m.default) },
175175
{ path: '/@:acct/room', props: true, component: () => import('../common/views/pages/room/room.vue').then(m => m.default) },
176176
{ path: '/share', component: () => import('../common/views/pages/share.vue').then(m => m.default) },
177+
{ path: '/intent/tweet', component: () => import('../common/views/pages/share.vue').then(m => m.default) },
177178
{ path: '/games/reversi/:game?', component: () => import('./views/pages/games/reversi.vue').then(m => m.default) },
178179
{ path: '/authorize-follow', component: () => import('../common/views/pages/follow.vue').then(m => m.default) },
179180
{ path: '/reset-password/:token', props: true, component: () => import('../common/views/pages/reset-password.vue').then(m => m.default) },

src/client/app/mobile/script.ts

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ init((launch, os) => {
149149
{ path: '/explore/tags/:tag', name: 'explore-tag', props: true, component: () => import('./views/pages/explore.vue').then(m => m.default) },
150150
{ path: '/about', name: 'about', component: () => import('./views/pages/about.vue').then(m => m.default) },
151151
{ path: '/share', component: () => import('../common/views/pages/share.vue').then(m => m.default) },
152+
{ path: '/intent/tweet', component: () => import('../common/views/pages/share.vue').then(m => m.default) },
152153
{ path: '/games/reversi/:game?', name: 'reversi', component: () => import('./views/pages/games/reversi.vue').then(m => m.default) },
153154
{ path: '/@:user', name: 'user', component: () => import('./views/pages/user/index.vue').then(m => m.default), children: [
154155
{ path: 'following', component: () => import('../common/views/pages/following.vue').then(m => m.default) },

0 commit comments

Comments
 (0)