Added activity deletion
This commit is contained in:
parent
f711cdb011
commit
e44bfd94b7
@ -30,6 +30,10 @@ component Activity(activity arn.Activity, user *arn.User)
|
||||
else if activity.Type() == "ActivityConsumeAnime"
|
||||
ActivityConsumeAnimeTitle(activity.(*arn.ActivityConsumeAnime), user)
|
||||
|
||||
if user != nil && user.ID == activity.GetCreatedBy() && activity.Type() == "ActivityConsumeAnime"
|
||||
button.post-delete.activity-action.tip.action(data-action="deleteObject", data-trigger="click", aria-label="Delete", data-return-path="/activity", data-confirm-type="activity", data-api=fmt.Sprintf("/api/%s/%s", strings.ToLower(activity.Type()), activity.GetID()))
|
||||
RawIcon("trash")
|
||||
|
||||
.activity-date.utc-date(data-date=activity.GetCreated())
|
||||
|
||||
if activity.Type() == "ActivityCreate"
|
||||
|
@ -4,6 +4,11 @@
|
||||
max-width forum-width
|
||||
margin 0 auto
|
||||
|
||||
.activity
|
||||
:hover
|
||||
.activity-action
|
||||
opacity 1
|
||||
|
||||
.activity-header
|
||||
horizontal
|
||||
|
||||
@ -19,6 +24,18 @@
|
||||
.actvity-text-create
|
||||
opacity 0.8
|
||||
|
||||
.activity-action
|
||||
border none
|
||||
background none
|
||||
padding 0
|
||||
height auto
|
||||
margin-right 0.5rem
|
||||
opacity 0
|
||||
|
||||
:hover
|
||||
color link-hover-color
|
||||
background none
|
||||
|
||||
#load-new-activities
|
||||
[data-count="0"]
|
||||
display none
|
@ -29,6 +29,12 @@ export function deleteObject(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||
let endpoint = arn.findAPIEndpoint(button)
|
||||
|
||||
arn.post(endpoint + "/delete")
|
||||
.then(() => arn.app.load(returnPath))
|
||||
.then(() => {
|
||||
if(returnPath) {
|
||||
arn.app.load(returnPath)
|
||||
} else {
|
||||
arn.reloadContent()
|
||||
}
|
||||
})
|
||||
.catch(err => arn.statusMessage.showError(err))
|
||||
}
|
Loading…
Reference in New Issue
Block a user