0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Restricted linking to posts and pages

refs https://github.com/TryGhost/Toolbox/issues/356

- linking is a bit hit-or-miss right now so it's best to only link to
  the resources we can
- this implements a `linkable` attribute on an event to indicate if we
  can link to its page or not
This commit is contained in:
Daniel Lockyer 2022-08-22 16:09:56 +02:00
parent b9a42bcb1c
commit 30d211fcab
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
2 changed files with 10 additions and 4 deletions

View file

@ -25,11 +25,15 @@
<span class="gh-members-activity-description">
{{capitalize-first-letter ev.action}}
{{#if (or ev.resource.title ev.resource.name)}}
<LinkTo @route="editor.edit" @models={{array ev.resource.displayName ev.resource.id}} class="permalink">
<strong>{{if ev.resource.title ev.resource.title ev.resource.name}}</strong>
</LinkTo>
{{#if ev.linkable}}
<LinkTo @route="editor.edit" @models={{array ev.resource.displayName ev.resource.id}} class="permalink">
<strong>{{if ev.resource.title ev.resource.title ev.resource.name}}</strong>
</LinkTo>
{{else}}
<strong>{{if ev.resource.title ev.resource.title ev.resource.name}}</strong>
{{/if}}
{{else}}
<small>(unknown)</small>
<small>(unknown)</small>
{{/if}}
</span>
</div>

View file

@ -9,6 +9,7 @@ export default class ParseAuditLogEvent extends Helper {
const actionIcon = getActionIcon(ev);
const getActor = () => this.store.findRecord(ev.actor_type, ev.actor_id, {reload: false});
const getResource = () => this.store.findRecord(ev.resource_type, ev.resource_id, {reload: false});
const linkable = ['page', 'post'].includes(ev.resource_type);
return {
get actor() {
@ -17,6 +18,7 @@ export default class ParseAuditLogEvent extends Helper {
get resource() {
return getResource();
},
linkable,
actionIcon,
action,
original: ev