Merge branch 'fix/edit-visibility' into 'develop'
fix: Client's strange behavior about visibility when editing a post Co-authored-by: Lhcfl <Lhcfl@outlook.com> See merge request firefish/firefish!10763
This commit is contained in:
commit
9a077c4beb
5 changed files with 21 additions and 6 deletions
|
@ -645,6 +645,7 @@ deletedNote: "Deleted post"
|
||||||
invisibleNote: "Invisible post"
|
invisibleNote: "Invisible post"
|
||||||
enableInfiniteScroll: "Automatically load more"
|
enableInfiniteScroll: "Automatically load more"
|
||||||
visibility: "Visiblility"
|
visibility: "Visiblility"
|
||||||
|
cannotEditVisibility: "You can't edit the visibility"
|
||||||
poll: "Poll"
|
poll: "Poll"
|
||||||
useCw: "Hide content"
|
useCw: "Hide content"
|
||||||
enablePlayer: "Open video player"
|
enablePlayer: "Open video player"
|
||||||
|
|
|
@ -564,6 +564,7 @@ deletedNote: "已删除的帖子"
|
||||||
invisibleNote: "隐藏的帖子"
|
invisibleNote: "隐藏的帖子"
|
||||||
enableInfiniteScroll: "滚动页面以载入更多内容"
|
enableInfiniteScroll: "滚动页面以载入更多内容"
|
||||||
visibility: "可见性"
|
visibility: "可见性"
|
||||||
|
cannotEditVisibility: "不能编辑帖子的可见性"
|
||||||
poll: "调查问卷"
|
poll: "调查问卷"
|
||||||
useCw: "隐藏内容"
|
useCw: "隐藏内容"
|
||||||
enablePlayer: "打开播放器"
|
enablePlayer: "打开播放器"
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
></span>
|
></span>
|
||||||
<button
|
<button
|
||||||
ref="visibilityButton"
|
ref="visibilityButton"
|
||||||
v-tooltip="i18n.ts.visibility"
|
v-tooltip="editId == null ? i18n.ts.visibility : i18n.ts.cannotEditVisibility"
|
||||||
class="_button visibility"
|
class="_button visibility"
|
||||||
:disabled="channel != null"
|
:disabled="channel != null || editId != null"
|
||||||
@click="setVisibility"
|
@click="setVisibility"
|
||||||
>
|
>
|
||||||
<span v-if="visibility === 'public'"
|
<span v-if="visibility === 'public'"
|
||||||
|
|
|
@ -59,7 +59,7 @@ if (
|
||||||
) {
|
) {
|
||||||
useTooltip(specified, async (showing) => {
|
useTooltip(specified, async (showing) => {
|
||||||
const users = await os.api("users/show", {
|
const users = await os.api("users/show", {
|
||||||
userIds: props.note.visibleUserIds,
|
userIds: props.note.visibleUserIds!,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ if (
|
||||||
{
|
{
|
||||||
showing,
|
showing,
|
||||||
users,
|
users,
|
||||||
count: props.note.visibleUserIds.length,
|
count: props.note.visibleUserIds!.length,
|
||||||
targetElement: specified.value,
|
targetElement: specified.value,
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
|
|
|
@ -49,11 +49,22 @@ export function getNoteMenu(props: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getVisibleUsers() {
|
||||||
|
if (appearNote.visibleUserIds && appearNote.visibleUserIds.length > 0) {
|
||||||
|
const users = await os.api("users/show", {
|
||||||
|
userIds: appearNote.visibleUserIds,
|
||||||
|
});
|
||||||
|
return users;
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function delEdit(): void {
|
function delEdit(): void {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
text: i18n.ts.deleteAndEditConfirm,
|
text: i18n.ts.deleteAndEditConfirm,
|
||||||
}).then(({ canceled }) => {
|
}).then(async ({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
os.api("notes/delete", {
|
os.api("notes/delete", {
|
||||||
|
@ -65,17 +76,19 @@ export function getNoteMenu(props: {
|
||||||
renote: appearNote.renote,
|
renote: appearNote.renote,
|
||||||
reply: appearNote.reply,
|
reply: appearNote.reply,
|
||||||
channel: appearNote.channel,
|
channel: appearNote.channel,
|
||||||
|
initialVisibleUsers: await getVisibleUsers(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit(): void {
|
async function edit() {
|
||||||
os.post({
|
os.post({
|
||||||
initialNote: appearNote,
|
initialNote: appearNote,
|
||||||
renote: appearNote.renote,
|
renote: appearNote.renote,
|
||||||
reply: appearNote.reply,
|
reply: appearNote.reply,
|
||||||
channel: appearNote.channel,
|
channel: appearNote.channel,
|
||||||
editId: appearNote.id,
|
editId: appearNote.id,
|
||||||
|
initialVisibleUsers: await getVisibleUsers(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue