feat: add pinning to instance
This commit is contained in:
1 parent
7dad1b30b9
commit
08242478b3
2 files changed
+22
-4
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "0.9.5",
|
"version": "0.9.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -55,14 +55,14 @@
|
|||||||
locking = false
|
locking = false
|
||||||
}
|
}
|
||||||
|
|
||||||
async function pin(pinned: boolean) {
|
async function pin(pinned: boolean, toInstance: boolean = false) {
|
||||||
if (!$profile?.jwt || !isPost(item)) return
|
if (!$profile?.jwt || !isPost(item)) return
|
||||||
|
|
||||||
pinning = true
|
pinning = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await getClient().featurePost({
|
await getClient().featurePost({
|
||||||
feature_type: 'Community',
|
feature_type: toInstance ? 'Local' : 'Community',
|
||||||
auth: $profile.jwt,
|
auth: $profile.jwt,
|
||||||
featured: pinned,
|
featured: pinned,
|
||||||
post_id: item.post.id,
|
post_id: item.post.id,
|
||||||
@@ -130,6 +130,7 @@
|
|||||||
/>
|
/>
|
||||||
{item.post.locked ? 'Unlock' : 'Lock'}
|
{item.post.locked ? 'Unlock' : 'Lock'}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="success"
|
color="success"
|
||||||
on:click={() => pin(isPost(item) ? !item.post.featured_community : false)}
|
on:click={() => pin(isPost(item) ? !item.post.featured_community : false)}
|
||||||
@@ -137,7 +138,12 @@
|
|||||||
disabled={pinning}
|
disabled={pinning}
|
||||||
>
|
>
|
||||||
<Icon src={InformationCircle} size="16" mini />
|
<Icon src={InformationCircle} size="16" mini />
|
||||||
{item.post.featured_community ? 'Unpin' : 'Pin'}
|
<div class="flex flex-col text-left">
|
||||||
|
<span>{item.post.featured_community ? 'Unpin' : 'Pin'}</span>
|
||||||
|
{#if isAdmin($profile.user)}
|
||||||
|
<span class="opacity-80 text-xs">Community</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton color="dangerSecondary" on:click={() => remove(item)}>
|
<MenuButton color="dangerSecondary" on:click={() => remove(item)}>
|
||||||
<Icon src={Trash} size="16" mini />
|
<Icon src={Trash} size="16" mini />
|
||||||
@@ -167,6 +173,18 @@
|
|||||||
<span class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
<span class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
||||||
Admin
|
Admin
|
||||||
</span>
|
</span>
|
||||||
|
<MenuButton
|
||||||
|
color="success"
|
||||||
|
on:click={() =>
|
||||||
|
pin(isPost(item) ? !item.post.featured_local : false, true)}
|
||||||
|
>
|
||||||
|
<Icon src={InformationCircle} size="16" mini />
|
||||||
|
<div class="flex flex-col text-left">
|
||||||
|
<span>{item.post.featured_local ? 'Unpin' : 'Pin'}</span>
|
||||||
|
|
||||||
|
<span class="text-xs opacity-80">Instance</span>
|
||||||
|
</div>
|
||||||
|
</MenuButton>
|
||||||
<MenuButton color="dangerSecondary" on:click={() => remove(item, true)}>
|
<MenuButton color="dangerSecondary" on:click={() => remove(item, true)}>
|
||||||
<Icon src={Fire} size="16" mini />
|
<Icon src={Fire} size="16" mini />
|
||||||
Purge
|
Purge
|
||||||
|
|||||||
Reference in new issue
Block a user