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"
|
||||
enableInfiniteScroll: "Automatically load more"
|
||||
visibility: "Visiblility"
|
||||
cannotEditVisibility: "You can't edit the visibility"
|
||||
poll: "Poll"
|
||||
useCw: "Hide content"
|
||||
enablePlayer: "Open video player"
|
||||
|
|
|
@ -564,6 +564,7 @@ deletedNote: "已删除的帖子"
|
|||
invisibleNote: "隐藏的帖子"
|
||||
enableInfiniteScroll: "滚动页面以载入更多内容"
|
||||
visibility: "可见性"
|
||||
cannotEditVisibility: "不能编辑帖子的可见性"
|
||||
poll: "调查问卷"
|
||||
useCw: "隐藏内容"
|
||||
enablePlayer: "打开播放器"
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
></span>
|
||||
<button
|
||||
ref="visibilityButton"
|
||||
v-tooltip="i18n.ts.visibility"
|
||||
v-tooltip="editId == null ? i18n.ts.visibility : i18n.ts.cannotEditVisibility"
|
||||
class="_button visibility"
|
||||
:disabled="channel != null"
|
||||
:disabled="channel != null || editId != null"
|
||||
@click="setVisibility"
|
||||
>
|
||||
<span v-if="visibility === 'public'"
|
||||
|
|
|
@ -59,7 +59,7 @@ if (
|
|||
) {
|
||||
useTooltip(specified, async (showing) => {
|
||||
const users = await os.api("users/show", {
|
||||
userIds: props.note.visibleUserIds,
|
||||
userIds: props.note.visibleUserIds!,
|
||||
limit: 10,
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ if (
|
|||
{
|
||||
showing,
|
||||
users,
|
||||
count: props.note.visibleUserIds.length,
|
||||
count: props.note.visibleUserIds!.length,
|
||||
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 {
|
||||
os.confirm({
|
||||
type: "warning",
|
||||
text: i18n.ts.deleteAndEditConfirm,
|
||||
}).then(({ canceled }) => {
|
||||
}).then(async ({ canceled }) => {
|
||||
if (canceled) return;
|
||||
|
||||
os.api("notes/delete", {
|
||||
|
@ -65,17 +76,19 @@ export function getNoteMenu(props: {
|
|||
renote: appearNote.renote,
|
||||
reply: appearNote.reply,
|
||||
channel: appearNote.channel,
|
||||
initialVisibleUsers: await getVisibleUsers(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function edit(): void {
|
||||
async function edit() {
|
||||
os.post({
|
||||
initialNote: appearNote,
|
||||
renote: appearNote.renote,
|
||||
reply: appearNote.reply,
|
||||
channel: appearNote.channel,
|
||||
editId: appearNote.id,
|
||||
initialVisibleUsers: await getVisibleUsers(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue