forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from n1lsqn/feat/directRenote
Feat: ダイレクトにリノートをできるようにする
- Loading branch information
Showing
9 changed files
with
104 additions
and
6 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
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,14 @@ | ||
import * as Misskey from 'misskey-js'; | ||
import { ShallowRef } from 'vue'; | ||
import { getAppearNote } from './get-appear-note.js'; | ||
import * as os from '@/os.js'; | ||
|
||
export function directQuote(props: { | ||
note: Misskey.entities.Note; | ||
mock?: boolean; | ||
}) { | ||
const appearNote = getAppearNote(props.note); | ||
return os.post({ | ||
renote: appearNote, | ||
}); | ||
} |
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,43 @@ | ||
import * as Misskey from 'misskey-js'; | ||
import { ShallowRef } from 'vue'; | ||
import { getAppearNote } from './get-appear-note.js'; | ||
import { misskeyApi } from './misskey-api.js'; | ||
import { smallerVisibility } from './get-note-menu.js'; | ||
import { defaultStore } from '@/store.js'; | ||
import { i18n } from '@/i18n.js'; | ||
import * as os from '@/os.js'; | ||
import MkRippleEffect from '@/components/MkRippleEffect.vue'; | ||
|
||
export function directRenote(props: { | ||
note: Misskey.entities.Note; | ||
renoteButton: ShallowRef<HTMLElement | undefined>; | ||
mock?: boolean; | ||
}) { | ||
const appearNote = getAppearNote(props.note); | ||
|
||
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility; | ||
const localOnly = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly; | ||
|
||
let visibility = appearNote.visibility; | ||
visibility = smallerVisibility(visibility, configuredVisibility); | ||
|
||
const el = props.renoteButton.value; | ||
if (el) { | ||
const rect = el.getBoundingClientRect(); | ||
const x = rect.left + (el.offsetWidth / 2); | ||
const y = rect.top + (el.offsetHeight / 2); | ||
const { dispose } = os.popup(MkRippleEffect, { x, y }, { | ||
end: () => dispose(), | ||
}); | ||
} | ||
|
||
if (!props.mock) { | ||
misskeyApi('notes/create', { | ||
localOnly, | ||
visibility, | ||
renoteId: appearNote.id, | ||
}).then(() => { | ||
os.toast(i18n.ts.renoted); | ||
}); | ||
} | ||
} |
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
caea511
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chromatic detects changes. Please review the changes on Chromatic.