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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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