Return back comment editing, remove unused props (#5056)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-03-25 13:22:48 +04:00 committed by GitHub
parent 6e8f4ab030
commit ace5692b91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 14 additions and 43 deletions

View File

@ -26,10 +26,8 @@
export let message: ActivityMessage | undefined
export let extensions: ActivityMessageExtension[] = []
export let excludedActions: string[] = []
export let actions: Action[] = []
export let withActionMenu = true
export let withFlatActions = true
const dispatch = createEventDispatcher()
@ -50,9 +48,8 @@
Menu,
{
object: message,
baseMenuClass: activity.class.ActivityMessage,
excludedActions,
actions
actions,
baseMenuClass: activity.class.ActivityMessage
},
ev.target as HTMLElement,
handleActionMenuClosed
@ -61,13 +58,15 @@
}
</script>
{#if message && (withFlatActions || withActionMenu)}
{#if message}
<div class="root">
{#if withFlatActions}
<AddReactionAction object={message} on:open on:close />
<ActivityMessageExtensionComponent kind="action" {extensions} props={{ object: message }} on:close on:open />
<PinMessageAction object={message} />
<SaveMessageAction object={message} />
<AddReactionAction object={message} on:open on:close />
<ActivityMessageExtensionComponent kind="action" {extensions} props={{ object: message }} on:close on:open />
<PinMessageAction object={message} />
<SaveMessageAction object={message} />
{#if withActionMenu}
<ActivityMessageAction size="small" icon={IconMoreV} opened={isActionMenuOpened} action={showMenu} />
{/if}
</div>
{/if}

View File

@ -37,8 +37,6 @@
export let shouldScroll: boolean = false
export let embedded: boolean = false
export let withActions: boolean = true
export let withFlatActions: boolean = true
export let excludedActions: string[] = []
export let actions: Action[] = []
export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
@ -73,8 +71,6 @@
{embedded}
{withActions}
{actions}
{excludedActions}
{withFlatActions}
{hoverable}
{hoverStyles}
viewlet={undefined}

View File

@ -30,8 +30,6 @@
export let hideFooter = false
export let skipLabel = false
export let actions: Action[] = []
export let excludedActions: string[] = []
export let withFlatActions: boolean = true
export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let withShowMore: boolean = true
@ -64,8 +62,6 @@
showEmbedded,
hideFooter,
actions,
excludedActions,
withFlatActions,
hoverable,
hoverStyles,
withShowMore,

View File

@ -40,14 +40,12 @@
export let viewlet: ActivityMessageViewlet | undefined = undefined
export let person: Person | undefined = undefined
export let actions: Action[] = []
export let excludedActions: string[] = []
export let showNotify: boolean = false
export let isHighlighted: boolean = false
export let isSelected: boolean = false
export let shouldScroll: boolean = false
export let embedded: boolean = false
export let withActions: boolean = true
export let withFlatActions: boolean = true
export let showEmbedded = false
export let hideFooter = false
export let skipLabel = false
@ -59,7 +57,7 @@
const client = getClient()
let allActionIds: string[] = []
let menuActionIds: string[] = []
let element: HTMLDivElement | undefined = undefined
let extensions: ActivityMessageExtension[] = []
@ -73,7 +71,7 @@
$: withActions &&
getActions(client, message, activity.class.ActivityMessage).then((res) => {
allActionIds = res.map(({ _id }) => _id)
menuActionIds = res.map(({ _id }) => _id)
})
function scrollToMessage (): void {
@ -104,8 +102,7 @@
$: key = parentMessage != null ? `${message._id}_${parentMessage._id}` : message._id
$: isHidden = !!viewlet?.onlyWithParent && parentMessage === undefined
$: withActionMenu =
withActions && !embedded && (actions.length > 0 || allActionIds.some((id) => !excludedActions.includes(id)))
$: withActionMenu = withActions && !embedded && (actions.length > 0 || menuActionIds.length > 0)
let readonly: boolean = false
$: readonly = $restrictionStore.disableComments
@ -196,8 +193,6 @@
{extensions}
{actions}
{withActionMenu}
{withFlatActions}
{excludedActions}
on:open={handleActionsOpened}
on:close={handleActionsClosed}
/>

View File

@ -62,6 +62,7 @@
{message}
{extensions}
{actions}
withActionMenu={false}
on:open={previewElement.onActionsOpened}
on:close={previewElement.onActionsClosed}
/>

View File

@ -38,8 +38,6 @@
export let hideFooter = false
export let actions: Action[] = []
export let skipLabel = false
export let withFlatActions: boolean = true
export let excludedActions: string[] = []
export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let hideLink = false
@ -105,13 +103,11 @@
{isSelected}
{shouldScroll}
{embedded}
{excludedActions}
{withActions}
{showEmbedded}
{hideFooter}
{actions}
{skipLabel}
{withFlatActions}
{hoverable}
{hoverStyles}
{onClick}

View File

@ -47,8 +47,6 @@
export let hideFooter = false
export let actions: Action[] = []
export let skipLabel = false
export let withFlatActions: boolean = true
export let excludedActions: string[] = []
export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let hideLink = false
@ -164,14 +162,12 @@
{isSelected}
{shouldScroll}
{embedded}
{excludedActions}
{withActions}
{viewlet}
{showEmbedded}
{hideFooter}
{actions}
{skipLabel}
{withFlatActions}
{hoverable}
{hoverStyles}
showDatePreposition={hideLink}

View File

@ -40,8 +40,6 @@
export let hideFooter = false
export let skipLabel = false
export let actions: Action[] = []
export let excludedActions: string[] = []
export let withFlatActions: boolean = true
export let hoverable = true
export let inline = false
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
@ -171,7 +169,6 @@
{viewlet}
{parentMessage}
{person}
{excludedActions}
{showNotify}
{isHighlighted}
{isSelected}
@ -181,7 +178,6 @@
actions={additionalActions}
{showEmbedded}
{hideFooter}
{withFlatActions}
{hoverable}
{hoverStyles}
{skipLabel}

View File

@ -32,9 +32,7 @@
export let withActions: boolean = true
export let showEmbedded = false
export let skipLabel = false
export let withFlatActions: boolean = true
export let actions: Action[] = []
export let excludedActions: string[] = []
export let hoverable = true
export let inline = false
export let withShowMore: boolean = true
@ -70,8 +68,6 @@
{showEmbedded}
{embedded}
{skipLabel}
{withFlatActions}
{excludedActions}
{actions}
{hoverable}
{hoverStyles}