Compare commits
7 Commits
c85bdb5e54
...
42934f4299
Author | SHA1 | Date |
---|---|---|
itepechi | 42934f4299 | |
itepechi | 8b63ade65b | |
itepechi | b35b8aeb01 | |
itepechi | a88fe43f03 | |
itepechi | f54248e133 | |
itepechi | 05fd58ec3f | |
FloatingGhost | 52b0b6f008 |
|
@ -1,6 +1,5 @@
|
|||
import FollowCard from '../follow_card/follow_card.vue'
|
||||
import Conversation from '../conversation/conversation.vue'
|
||||
import Status from '../status/status.vue'
|
||||
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
|
||||
import SearchFilters from './search_filters.vue'
|
||||
import map from 'lodash/map'
|
||||
|
@ -20,7 +19,6 @@ const Search = {
|
|||
components: {
|
||||
FollowCard,
|
||||
Conversation,
|
||||
Status,
|
||||
TabSwitcher,
|
||||
SearchFilters
|
||||
},
|
||||
|
@ -97,7 +95,7 @@ const Search = {
|
|||
this.$router.push({ name: 'search', query: { query } })
|
||||
this.$refs.searchInput.focus()
|
||||
},
|
||||
search (query, searchType = null) {
|
||||
async search (query, searchType = null) {
|
||||
if (!query) {
|
||||
this.loading = false
|
||||
return
|
||||
|
@ -118,6 +116,20 @@ const Search = {
|
|||
this.lastMediaFetchCount = 0
|
||||
}
|
||||
|
||||
const searchTypes = searchType
|
||||
? [searchType]
|
||||
: ['statuses', 'media', 'accounts', 'hashtags']
|
||||
|
||||
let oldStasusesLength = this.statuses.length
|
||||
let oldMediaLength = this.media.length
|
||||
|
||||
let skipMediaSearch = !this.canSearchMediaPosts
|
||||
|
||||
for (const searchType of searchTypes) {
|
||||
if (searchType === 'media' && skipMediaSearch) {
|
||||
continue
|
||||
}
|
||||
|
||||
let searchOffset
|
||||
if (searchType === 'statuses') {
|
||||
searchOffset = this.statusesOffset
|
||||
|
@ -125,7 +137,7 @@ const Search = {
|
|||
searchOffset = this.mediaOffset
|
||||
}
|
||||
|
||||
this.$store.dispatch('search', {
|
||||
const data = await this.$store.dispatch('search', {
|
||||
q: query,
|
||||
resolve: true,
|
||||
offset: searchOffset,
|
||||
|
@ -133,11 +145,13 @@ const Search = {
|
|||
following:
|
||||
'followingOnly' in this.filter && this.filter.followingOnly
|
||||
})
|
||||
.then(data => {
|
||||
this.loading = false
|
||||
|
||||
let oldStasusesLength = this.statuses.length
|
||||
let oldMediaLength = this.media.length
|
||||
for (const value of Object.values(data)) {
|
||||
if (value.length) {
|
||||
this.loading = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Always append to old results. If new results are empty, this doesn't change anything
|
||||
this.userIds = this.userIds.concat(map(data.accounts, 'id'))
|
||||
|
@ -149,21 +163,27 @@ const Search = {
|
|||
|
||||
if (isNewSearch) {
|
||||
this.currenResultTab = this.getActiveTab()
|
||||
if (searchType === 'statuses' && data.statuses.length === 0) {
|
||||
// safe to assume that there are no media posts
|
||||
skipMediaSearch = true
|
||||
}
|
||||
}
|
||||
this.loadedInitially = true
|
||||
|
||||
if (!searchType || searchType === 'statuses') {
|
||||
if (searchType === 'statuses') {
|
||||
// Offset from whatever we already have
|
||||
this.statusesOffset = this.statuses.length
|
||||
// Because the amount of new statuses can actually be zero, compare to old lenght instead
|
||||
// Because the amount of new statuses can actually be zero, compare to old length instead
|
||||
this.lastStatusFetchCount = this.statuses.length - oldStasusesLength
|
||||
}
|
||||
if (!searchType || searchType === 'media') {
|
||||
if (searchType === 'media') {
|
||||
this.mediaOffset = this.media.length
|
||||
this.lastMediaFetchCount = this.media.length - oldMediaLength
|
||||
}
|
||||
}
|
||||
|
||||
this.lastQuery = query
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
resultCount (tabName) {
|
||||
const length = this[tabName].length
|
||||
|
|
|
@ -72,15 +72,12 @@
|
|||
</div>
|
||||
<div class="panel-body">
|
||||
<div v-if="currenResultTab === 'statuses'">
|
||||
<Status
|
||||
<Conversation
|
||||
v-for="status in visibleStatuses"
|
||||
:key="status.id"
|
||||
:collapsable="false"
|
||||
:expandable="false"
|
||||
:compact="false"
|
||||
class="search-result"
|
||||
:statusoid="status"
|
||||
:no-heading="false"
|
||||
:collapsable="true"
|
||||
class="status-fadein"
|
||||
:status-id="status.id"
|
||||
/>
|
||||
<button
|
||||
v-if="!loading && loadedInitially && lastStatusFetchCount > 0"
|
||||
|
@ -111,15 +108,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="currenResultTab === 'media'">
|
||||
<Status
|
||||
<Conversation
|
||||
v-for="media in visibleMedia"
|
||||
:key="media.id"
|
||||
:collapsable="false"
|
||||
:expandable="false"
|
||||
:compact="false"
|
||||
class="search-result"
|
||||
:statusoid="media"
|
||||
:no-heading="false"
|
||||
:collapsable="true"
|
||||
class="status-fadein"
|
||||
:status-id="media.id"
|
||||
/>
|
||||
<button
|
||||
v-if="!loading && loadedInitially && lastMediaFetchCount > 0"
|
||||
|
@ -224,13 +218,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.search-result {
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid;
|
||||
border-color: $fallback--border;
|
||||
border-color: var(--border, $fallback--border);
|
||||
}
|
||||
|
||||
.search-result-footer {
|
||||
border-width: 1px 0 0 0;
|
||||
border-style: solid;
|
||||
|
|
|
@ -299,7 +299,7 @@ const Status = {
|
|||
if (this.statusoid.user.id === this.currentUser.id) return false
|
||||
const reasonsToMute = this.userIsMuted ||
|
||||
// Thread is muted
|
||||
status.thread_muted ||
|
||||
this.status.thread_muted ||
|
||||
// Wordfiltered
|
||||
this.muteWordHits.length > 0 ||
|
||||
// bot status
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
>
|
||||
<div
|
||||
v-if="animated && imageTypeLabel"
|
||||
class="image-type-label">
|
||||
class="image-type-label"
|
||||
>
|
||||
{{ imageTypeLabel }}
|
||||
</div>
|
||||
<canvas
|
||||
|
|
|
@ -863,8 +863,8 @@
|
|||
"always_drop_shadow": "ブラウザーがサポートしている場合は常に {0} が使われます。",
|
||||
"avatar_inset": "内側の影と外側の影を同時に使うと、透明なアバターの表示が乱れます。",
|
||||
"drop_shadow_syntax": "{0} は、{1} パラメーターと {2} キーワードをサポートしていません。",
|
||||
"inset_classic": "内側の影は {0} を使います",
|
||||
"spread_zero": "広がりが 0 よりも大きな影は、0 と同じです"
|
||||
"inset_classic": "内側の影は {0} を使います。",
|
||||
"spread_zero": "広がりが 0 よりも大きな影は、0 と同じです。"
|
||||
},
|
||||
"hintV3": "影の場合は、 {0} 表記を使って他の色スロットを使うこともできます。",
|
||||
"inset": "内側",
|
||||
|
|
|
@ -35,6 +35,7 @@ const loaders = {
|
|||
sk: () => import('./sk.json'),
|
||||
te: () => import('./te.json'),
|
||||
uk: () => import('./uk.json'),
|
||||
vi: () => import('./vi.json'),
|
||||
zh: () => import('./zh.json'),
|
||||
zh_Hant: () => import('./zh_Hant.json')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue