summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-04 09:39:25 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-04 09:39:25 +0900
commitd7c94de07e17e31513780ceabf824a3d0760ff80 (patch)
tree890e64439127e0f118a6a0e041c7f14ee2f9b891 /src
parent:art: (diff)
downloadsharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.tar.gz
sharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.tar.bz2
sharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.zip
#172
Diffstat (limited to '')
-rw-r--r--src/api/endpoints/posts/create.ts5
-rw-r--r--src/api/models/post.ts1
-rw-r--r--src/const.json2
-rw-r--r--src/web/app/desktop/views/components/posts.post.vue5
-rw-r--r--src/web/app/desktop/views/components/settings.vue11
-rw-r--r--src/web/app/mobile/views/components/post-form.vue4
-rw-r--r--src/web/app/mobile/views/components/posts.post.vue19
-rw-r--r--src/web/docs/api/entities/post.yaml6
8 files changed, 46 insertions, 7 deletions
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts
index 075e1ac9f0..57f98fa811 100644
--- a/src/api/endpoints/posts/create.ts
+++ b/src/api/endpoints/posts/create.ts
@@ -31,6 +31,10 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
if (textErr) return rej('invalid text');
+ // Get 'via_mobile' parameter
+ const [viaMobile = false, viaMobileErr] = $(params.via_mobile).optional.boolean().$;
+ if (viaMobileErr) return rej('invalid via_mobile');
+
// Get 'tags' parameter
const [tags = [], tagsErr] = $(params.tags).optional.array('string').unique().eachQ(t => t.range(1, 32)).$;
if (tagsErr) return rej('invalid tags');
@@ -239,6 +243,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
tags: tags,
user_id: user._id,
app_id: app ? app._id : null,
+ via_mobile: viaMobile,
// 以下非正規化データ
_reply: reply ? { user_id: reply.user_id } : undefined,
diff --git a/src/api/models/post.ts b/src/api/models/post.ts
index 0bbacebf66..edb69e0c15 100644
--- a/src/api/models/post.ts
+++ b/src/api/models/post.ts
@@ -31,6 +31,7 @@ export type IPost = {
app_id: mongo.ObjectID;
category: string;
is_category_verified: boolean;
+ via_mobile: boolean;
};
/**
diff --git a/src/const.json b/src/const.json
index d8fe4fe6cd..65dc734fab 100644
--- a/src/const.json
+++ b/src/const.json
@@ -1,5 +1,5 @@
{
"copyright": "Copyright (c) 2014-2018 syuilo",
- "themeColor": "#ff4e45",
+ "themeColor": "#5cbb2d",
"themeColorForeground": "#fff"
}
diff --git a/src/web/app/desktop/views/components/posts.post.vue b/src/web/app/desktop/views/components/posts.post.vue
index 4a95918c48..ce0a31d183 100644
--- a/src/web/app/desktop/views/components/posts.post.vue
+++ b/src/web/app/desktop/views/components/posts.post.vue
@@ -26,6 +26,7 @@
<span class="username">@{{ p.user.username }}</span>
<div class="info">
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
+ <span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
<router-link class="created-at" :to="url">
<mk-time :time="p.created_at"/>
</router-link>
@@ -399,6 +400,10 @@ export default Vue.extend({
margin-left auto
font-size 0.9em
+ > .mobile
+ margin-right 8px
+ color #ccc
+
> .app
margin-right 8px
padding-right 8px
diff --git a/src/web/app/desktop/views/components/settings.vue b/src/web/app/desktop/views/components/settings.vue
index 182a9a1d5e..20d7a77715 100644
--- a/src/web/app/desktop/views/components/settings.vue
+++ b/src/web/app/desktop/views/components/settings.vue
@@ -27,6 +27,11 @@
</section>
<section class="web" v-show="page == 'web'">
+ <h1>モバイル</h1>
+ <mk-switch v-model="os.i.client_settings.disableViaMobile" @change="onChangeDisableViaMobile" text="モバイルからの投稿とフラグを付けない"/>
+ </section>
+
+ <section class="web" v-show="page == 'web'">
<h1>言語</h1>
<el-select v-model="lang" placeholder="言語を選択">
<el-option-group label="推奨">
@@ -192,6 +197,12 @@ export default Vue.extend({
value: v
});
},
+ onChangeDisableViaMobile(v) {
+ (this as any).api('i/update_client_setting', {
+ name: 'disableViaMobile',
+ value: v
+ });
+ },
checkForUpdate() {
this.checkingForUpdate = true;
checkForUpdate((this as any).os, true, true).then(newer => {
diff --git a/src/web/app/mobile/views/components/post-form.vue b/src/web/app/mobile/views/components/post-form.vue
index 63b75b92f0..009012b0b6 100644
--- a/src/web/app/mobile/views/components/post-form.vue
+++ b/src/web/app/mobile/views/components/post-form.vue
@@ -91,11 +91,13 @@ export default Vue.extend({
},
post() {
this.posting = true;
+ const viaMobile = (this as any).os.i.client_settings.disableViaMobile !== true;
(this as any).api('posts/create', {
text: this.text == '' ? undefined : this.text,
media_ids: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
reply_id: this.reply ? this.reply.id : undefined,
- poll: this.poll ? (this.$refs.poll as any).get() : undefined
+ poll: this.poll ? (this.$refs.poll as any).get() : undefined,
+ via_mobile: viaMobile
}).then(data => {
this.$emit('post');
this.$destroy();
diff --git a/src/web/app/mobile/views/components/posts.post.vue b/src/web/app/mobile/views/components/posts.post.vue
index 3c02e1e990..d0a897db65 100644
--- a/src/web/app/mobile/views/components/posts.post.vue
+++ b/src/web/app/mobile/views/components/posts.post.vue
@@ -24,9 +24,12 @@
<router-link class="name" :to="`/${p.user.username}`">{{ p.user.name }}</router-link>
<span class="is-bot" v-if="p.user.is_bot">bot</span>
<span class="username">@{{ p.user.username }}</span>
- <router-link class="created-at" :to="url">
- <mk-time :time="p.created_at"/>
- </router-link>
+ <div class="info">
+ <span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
+ <router-link class="created-at" :to="url">
+ <mk-time :time="p.created_at"/>
+ </router-link>
+ </div>
</header>
<div class="body">
<div class="text" ref="text">
@@ -336,10 +339,16 @@ export default Vue.extend({
margin 0 0.5em 0 0
color #ccc
- > .created-at
+ > .info
margin-left auto
font-size 0.9em
- color #c0c0c0
+
+ > .mobile
+ margin-right 6px
+ color #c0c0c0
+
+ > .created-at
+ color #c0c0c0
> .body
diff --git a/src/web/docs/api/entities/post.yaml b/src/web/docs/api/entities/post.yaml
index 551f3b7c3e..e4359ffd0c 100644
--- a/src/web/docs/api/entities/post.yaml
+++ b/src/web/docs/api/entities/post.yaml
@@ -17,6 +17,12 @@ props:
desc:
ja: "投稿日時"
en: "The posted date of this post"
+ - name: "via_mobile"
+ type: "boolean"
+ optional: true
+ desc:
+ ja: "モバイル端末から投稿したか否か(自己申告であることに留意)"
+ en: "Whether this post sent via a mobile device"
- name: "text"
type: "string"
optional: true