forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spec(skeb/role): Skeb募集中のクリエイターに自動でロールが付与されるように・バッジから募集状態の確認ができるように
- Loading branch information
Showing
29 changed files
with
323 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/backend/migration/1711946753142-role-badge-behavior.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export class RoleBadgeBehavior1711946753142 { | ||
name = 'RoleBadgeBehavior1711946753142' | ||
|
||
async up(queryRunner) { | ||
await queryRunner.query(`ALTER TABLE "role" ADD "badgeBehavior" character varying(256)`); | ||
} | ||
|
||
async down(queryRunner) { | ||
await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "badgeBehavior"`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<img ref="el" :src="role.iconUrl!" @click="onClick(role)"/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { defineAsyncComponent, ref } from 'vue'; | ||
import * as Misskey from 'misskey-js'; | ||
import * as os from '@/os.js'; | ||
import { instance } from '@/instance.js'; | ||
import { misskeyApiGet } from '@/scripts/misskey-api.js'; | ||
import { useTooltip } from '@/scripts/use-tooltip.js'; | ||
const props = defineProps<{ | ||
userId: string, | ||
role: { name: string, iconUrl: string | null, displayOrder: number, behavior?: string } | ||
}>(); | ||
const el = ref<HTMLElement | { $el: HTMLElement }>(); | ||
const userSkebStatus = ref<Misskey.Endpoints['users/get-skeb-status']['res'] | null>(null); | ||
async function fetchSkebStatus() { | ||
if (!instance.enableSkebStatus || props.role.behavior !== 'skeb') { | ||
userSkebStatus.value = null; | ||
return; | ||
} | ||
userSkebStatus.value = await misskeyApiGet('users/get-skeb-status', { userId: props.userId }); | ||
} | ||
if (props.role.behavior === 'skeb') { | ||
useTooltip(el, async (showing) => { | ||
if (userSkebStatus.value == null) { | ||
await fetchSkebStatus(); | ||
} | ||
if (userSkebStatus.value === null) return; | ||
os.popup(defineAsyncComponent(() => import('@/components/MkSkebStatusPopup.vue')), { | ||
showing, | ||
skebStatus: userSkebStatus.value, | ||
source: el.value instanceof HTMLElement ? el.value : el.value?.$el, | ||
}, {}, 'closed'); | ||
}); | ||
} | ||
async function onClick(role: { name: string, iconUrl: string | null, displayOrder: number, behavior?: string }) { | ||
if (role.behavior === 'skeb') { | ||
if (userSkebStatus.value == null) { | ||
await fetchSkebStatus(); | ||
} | ||
if (userSkebStatus.value != null) { | ||
window.open(`https://skeb.jp/@${userSkebStatus.value.screenName}`, '_blank', 'noopener'); | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.