Merge remote-tracking branch 'misskey/develop' into develop
This commit is contained in:
commit
94774723f0
|
@ -1,11 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<XModalWindow ref="dialog"
|
<XModalWindow
|
||||||
|
ref="dialog"
|
||||||
:width="400"
|
:width="400"
|
||||||
:height="450"
|
:height="450"
|
||||||
:with-ok-button="true"
|
:with-ok-button="true"
|
||||||
:ok-button-disabled="false"
|
:ok-button-disabled="false"
|
||||||
:can-close="false"
|
:can-close="false"
|
||||||
@close="$refs.dialog.close()"
|
@close="dialog.close()"
|
||||||
@closed="$emit('closed')"
|
@closed="$emit('closed')"
|
||||||
@ok="ok()"
|
@ok="ok()"
|
||||||
>
|
>
|
||||||
|
@ -27,91 +28,63 @@
|
||||||
</XModalWindow>
|
</XModalWindow>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
import { permissions } from 'misskey-js';
|
import { permissions as kinds } from 'misskey-js';
|
||||||
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
||||||
import MkInput from './form/input.vue';
|
import MkInput from './form/input.vue';
|
||||||
import MkTextarea from './form/textarea.vue';
|
|
||||||
import MkSwitch from './form/switch.vue';
|
import MkSwitch from './form/switch.vue';
|
||||||
import MkButton from './ui/button.vue';
|
import MkButton from './ui/button.vue';
|
||||||
import MkInfo from './ui/info.vue';
|
import MkInfo from './ui/info.vue';
|
||||||
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
components: {
|
title?: string | null;
|
||||||
XModalWindow,
|
information?: string | null;
|
||||||
MkInput,
|
initialName?: string | null;
|
||||||
MkTextarea,
|
initialPermissions?: string[] | null;
|
||||||
MkSwitch,
|
}>(), {
|
||||||
MkButton,
|
title: null,
|
||||||
MkInfo,
|
information: null,
|
||||||
},
|
initialName: null,
|
||||||
|
initialPermissions: null,
|
||||||
props: {
|
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
information: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
initialName: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
initialPermissions: {
|
|
||||||
type: Array,
|
|
||||||
required: false,
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['done', 'closed'],
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
name: this.initialName,
|
|
||||||
permissions: {},
|
|
||||||
kinds: permissions
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
|
||||||
if (this.initialPermissions) {
|
|
||||||
for (const kind of this.initialPermissions) {
|
|
||||||
this.permissions[kind] = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (const kind of this.kinds) {
|
|
||||||
this.permissions[kind] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
ok() {
|
|
||||||
this.$emit('done', {
|
|
||||||
name: this.name,
|
|
||||||
permissions: Object.keys(this.permissions).filter(p => this.permissions[p])
|
|
||||||
});
|
|
||||||
this.$refs.dialog.close();
|
|
||||||
},
|
|
||||||
|
|
||||||
disableAll() {
|
|
||||||
for (const p in this.permissions) {
|
|
||||||
this.permissions[p] = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
enableAll() {
|
|
||||||
for (const p in this.permissions) {
|
|
||||||
this.permissions[p] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: 'closed'): void;
|
||||||
|
(ev: 'done', result: { name: string | null, permissions: string[] }): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const dialog = $ref<InstanceType<typeof XModalWindow>>();
|
||||||
|
let name = $ref(props.initialName);
|
||||||
|
let permissions = $ref({});
|
||||||
|
|
||||||
|
if (props.initialPermissions) {
|
||||||
|
for (const kind of props.initialPermissions) {
|
||||||
|
permissions[kind] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const kind of kinds) {
|
||||||
|
permissions[kind] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ok(): void {
|
||||||
|
emit('done', {
|
||||||
|
name: name,
|
||||||
|
permissions: Object.keys(permissions).filter(p => permissions[p]),
|
||||||
|
});
|
||||||
|
dialog.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableAll(): void {
|
||||||
|
for (const p in permissions) {
|
||||||
|
permissions[p] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableAll(): void {
|
||||||
|
for (const p in permissions) {
|
||||||
|
permissions[p] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,52 +1,37 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fgmtyycl" :style="{ zIndex, top: top + 'px', left: left + 'px' }">
|
<div class="fgmtyycl" :style="{ zIndex, top: top + 'px', left: left + 'px' }">
|
||||||
<transition :name="$store.state.animation ? 'zoom' : ''" @after-leave="$emit('closed')">
|
<transition :name="$store.state.animation ? 'zoom' : ''" @after-leave="emit('closed')">
|
||||||
<MkUrlPreview v-if="showing" class="_popup _shadow" :url="url"/>
|
<MkUrlPreview v-if="showing" class="_popup _shadow" :url="url"/>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import MkUrlPreview from '@/components/MkUrlPreview.vue';
|
import MkUrlPreview from '@/components/MkUrlPreview.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
showing: boolean;
|
||||||
MkUrlPreview,
|
url: string;
|
||||||
},
|
source: HTMLElement;
|
||||||
|
}>();
|
||||||
|
|
||||||
props: {
|
const emit = defineEmits<{
|
||||||
url: {
|
(ev: 'closed'): void;
|
||||||
type: String,
|
}>();
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
source: {
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
showing: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
const zIndex = os.claimZIndex('middle');
|
||||||
return {
|
let top = $ref(0);
|
||||||
u: null,
|
let left = $ref(0);
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
zIndex: os.claimZIndex('middle'),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
onMounted(() => {
|
||||||
const rect = this.source.getBoundingClientRect();
|
const rect = props.source.getBoundingClientRect();
|
||||||
const x = Math.max((rect.left + (this.source.offsetWidth / 2)) - (300 / 2), 6) + window.pageXOffset;
|
const x = Math.max((rect.left + (props.source.offsetWidth / 2)) - (300 / 2), 6) + window.pageXOffset;
|
||||||
const y = rect.top + this.source.offsetHeight + window.pageYOffset;
|
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
||||||
|
|
||||||
this.top = y;
|
top = y;
|
||||||
this.left = x;
|
left = x;
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<transition :name="$store.state.animation ? 'popup' : ''" appear @after-leave="$emit('closed')">
|
<transition :name="$store.state.animation ? 'popup' : ''" appear @after-leave="emit('closed')">
|
||||||
<div v-if="showing" class="fxxzrfni _popup _shadow" :style="{ zIndex, top: top + 'px', left: left + 'px' }" @mouseover="() => { $emit('mouseover'); }" @mouseleave="() => { $emit('mouseleave'); }">
|
<div v-if="showing" class="fxxzrfni _popup _shadow" :style="{ zIndex, top: top + 'px', left: left + 'px' }" @mouseover="() => { emit('mouseover'); }" @mouseleave="() => { emit('mouseleave'); }">
|
||||||
<div v-if="fetched" class="info">
|
<div v-if="user != null" class="info">
|
||||||
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''">
|
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''">
|
||||||
<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ $ts.followsYou }}</span>
|
<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ $ts.followsYou }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,71 +33,51 @@
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import * as Acct from 'misskey-js/built/acct';
|
import * as Acct from 'misskey-js/built/acct';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||||
import { userPage } from '@/filters/user';
|
import { userPage } from '@/filters/user';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
showing: boolean;
|
||||||
MkFollowButton,
|
q: string;
|
||||||
},
|
source: HTMLElement;
|
||||||
|
}>();
|
||||||
|
|
||||||
props: {
|
const emit = defineEmits<{
|
||||||
showing: {
|
(ev: 'closed'): void;
|
||||||
type: Boolean,
|
(ev: 'mouseover'): void;
|
||||||
required: true,
|
(ev: 'mouseleave'): void;
|
||||||
},
|
}>();
|
||||||
q: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
source: {
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
emits: ['closed', 'mouseover', 'mouseleave'],
|
const zIndex = os.claimZIndex('middle');
|
||||||
|
let user = $ref<misskey.entities.UserDetailed | null>(null);
|
||||||
|
let top = $ref(0);
|
||||||
|
let left = $ref(0);
|
||||||
|
|
||||||
data() {
|
onMounted(() => {
|
||||||
return {
|
if (typeof props.q === 'object') {
|
||||||
user: null,
|
user = props.q;
|
||||||
fetched: false,
|
} else {
|
||||||
top: 0,
|
const query = props.q.startsWith('@') ?
|
||||||
left: 0,
|
Acct.parse(props.q.substr(1)) :
|
||||||
zIndex: os.claimZIndex('middle'),
|
{ userId: props.q };
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
os.api('users/show', query).then(res => {
|
||||||
if (typeof this.q === 'object') {
|
if (!props.showing) return;
|
||||||
this.user = this.q;
|
user = res;
|
||||||
this.fetched = true;
|
});
|
||||||
} else {
|
}
|
||||||
const query = this.q.startsWith('@') ?
|
|
||||||
Acct.parse(this.q.substr(1)) :
|
|
||||||
{ userId: this.q };
|
|
||||||
|
|
||||||
os.api('users/show', query).then(user => {
|
const rect = props.source.getBoundingClientRect();
|
||||||
if (!this.showing) return;
|
const x = ((rect.left + (props.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
|
||||||
this.user = user;
|
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
||||||
this.fetched = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const rect = this.source.getBoundingClientRect();
|
top = y;
|
||||||
const x = ((rect.left + (this.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
|
left = x;
|
||||||
const y = rect.top + this.source.offsetHeight + window.pageYOffset;
|
|
||||||
|
|
||||||
this.top = y;
|
|
||||||
this.left = x;
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
userPage,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
function focus() {
|
||||||
|
// TODO
|
||||||
});
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default defineComponent({
|
||||||
} else {
|
} else {
|
||||||
if (nextBracketOpen > 0) parsed.push(str.substr(0, nextBracketOpen));
|
if (nextBracketOpen > 0) parsed.push(str.substr(0, nextBracketOpen));
|
||||||
parsed.push({
|
parsed.push({
|
||||||
arg: str.substring(nextBracketOpen + 1, nextBracketClose)
|
arg: str.substring(nextBracketOpen + 1, nextBracketClose),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,5 +38,5 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
return h(this.tag, parsed.map(x => typeof x === 'string' ? (this.textTag ? h(this.textTag, x) : x) : this.$slots[x.arg]()));
|
return h(this.tag, parsed.map(x => typeof x === 'string' ? (this.textTag ? h(this.textTag, x) : x) : this.$slots[x.arg]()));
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
<div class="ujigsodd">
|
<div class="ujigsodd">
|
||||||
<MkLoading v-if="fetching"/>
|
<MkLoading v-if="fetching"/>
|
||||||
<div v-if="!fetching && images.length > 0" class="stream">
|
<div v-if="!fetching && images.length > 0" class="stream">
|
||||||
<MkA v-for="image in images"
|
<MkA
|
||||||
:key="image.id"
|
v-for="image in images"
|
||||||
|
:key="image.note.id + image.file.id"
|
||||||
class="img"
|
class="img"
|
||||||
:to="notePage(image.note)"
|
:to="notePage(image.note)"
|
||||||
>
|
>
|
||||||
<ImgWithBlurhash :hash="image.blurhash" :src="thumbnail(image.file)" :alt="image.name" :title="image.name"/>
|
<ImgWithBlurhash :hash="image.file.blurhash" :src="thumbnail(image.file)" :title="image.file.name"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="!fetching && images.length == 0" class="empty">{{ $ts.nothing }}</p>
|
<p v-if="!fetching && images.length == 0" class="empty">{{ $ts.nothing }}</p>
|
||||||
|
@ -17,64 +18,56 @@
|
||||||
</MkContainer>
|
</MkContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
||||||
import { notePage } from '@/filters/note';
|
import { notePage } from '@/filters/note';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import MkContainer from '@/components/ui/container.vue';
|
import MkContainer from '@/components/ui/container.vue';
|
||||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||||
|
import { defaultStore } from '@/store';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.UserDetailed;
|
||||||
MkContainer,
|
}>();
|
||||||
ImgWithBlurhash,
|
|
||||||
},
|
let fetching = $ref(true);
|
||||||
props: {
|
let images = $ref<{
|
||||||
user: {
|
note: misskey.entities.Note;
|
||||||
type: Object,
|
file: misskey.entities.DriveFile;
|
||||||
required: true
|
}[]>([]);
|
||||||
},
|
|
||||||
},
|
function thumbnail(image: misskey.entities.DriveFile): string {
|
||||||
data() {
|
return defaultStore.state.disableShowingAnimatedImages
|
||||||
return {
|
? getStaticImageUrl(image.thumbnailUrl)
|
||||||
fetching: true,
|
: image.thumbnailUrl;
|
||||||
images: [],
|
}
|
||||||
};
|
|
||||||
},
|
onMounted(() => {
|
||||||
mounted() {
|
const image = [
|
||||||
const image = [
|
'image/jpeg',
|
||||||
'image/jpeg',
|
'image/png',
|
||||||
'image/png',
|
'image/gif',
|
||||||
'image/gif',
|
'image/apng',
|
||||||
'image/apng',
|
'image/vnd.mozilla.apng',
|
||||||
'image/vnd.mozilla.apng',
|
];
|
||||||
];
|
os.api('users/notes', {
|
||||||
os.api('users/notes', {
|
userId: props.user.id,
|
||||||
userId: this.user.id,
|
fileType: image,
|
||||||
fileType: image,
|
excludeNsfw: defaultStore.state.nsfw !== 'ignore',
|
||||||
excludeNsfw: this.$store.state.nsfw !== 'ignore',
|
limit: 10,
|
||||||
limit: 10,
|
}).then(notes => {
|
||||||
}).then(notes => {
|
for (const note of notes) {
|
||||||
for (const note of notes) {
|
for (const file of note.files) {
|
||||||
for (const file of note.files) {
|
images.push({
|
||||||
this.images.push({
|
note,
|
||||||
note,
|
file,
|
||||||
file
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.fetching = false;
|
}
|
||||||
});
|
fetching = false;
|
||||||
},
|
});
|
||||||
methods: {
|
|
||||||
thumbnail(image: any): string {
|
|
||||||
return this.$store.state.disableShowingAnimatedImages
|
|
||||||
? getStaticImageUrl(image.thumbnailUrl)
|
|
||||||
: image.thumbnailUrl;
|
|
||||||
},
|
|
||||||
notePage
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue