Skip to content

Commit

Permalink
Delete disableRightClick
Browse files Browse the repository at this point in the history
  • Loading branch information
caipira113 committed Oct 20, 2023
1 parent 52e86dc commit 6af8fd2
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 40 deletions.
1 change: 0 additions & 1 deletion locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ friendlyEnableWidgets: "Enable the widgets area"
friendlyDisableWidgets: "Disable the widgets area"
useBoldFont: "Bold Text"
newNoteReceivedNotification: "When receive a new note notification"
disableRightClick: "Prohibit right click"
cherrypickUpdatedCacheClearTitle: "Clear the cache?"
cherrypickUpdatedCacheClear: "It is <b>recommended to clear the cache</b> after the client is updated, as changes such as theme, color, and locale may not be reflected properly.\nYour account login status remains the same!"
cherrypickUpdatedCacheClearLater: "If you want to clear the cache later, you can do it in <b>Settings</b> - <b>Clear Cache</b>!"
Expand Down
1 change: 0 additions & 1 deletion locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export interface Locale {
"friendlyDisableWidgets": string;
"useBoldFont": string;
"newNoteReceivedNotification": string;
"disableRightClick": string;
"cherrypickUpdatedCacheClearTitle": string;
"cherrypickUpdatedCacheClear": string;
"cherrypickUpdatedCacheClearLater": string;
Expand Down
1 change: 0 additions & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ friendlyEnableWidgets: "ウィジェット領域を有効化"
friendlyDisableWidgets: "ウィジェット領域を無効化"
useBoldFont: "文字を太くする"
newNoteReceivedNotification: "新しいノート通知を表示するとき"
disableRightClick: "右クリックを禁止"
cherrypickUpdatedCacheClearTitle: "キャッシュをクリアしましょうか?"
cherrypickUpdatedCacheClear: "テーマや色、ロケールなどの変更が正しく反映されない可能性があるため、クライアントが更新されたら<b>キャッシュをクリアすることをお勧め</b>します。\nアカウントログイン状態はそのまま維持されます!"
cherrypickUpdatedCacheClearLater: "あとでキャッシュをクリアするには、<b>設定</b> - <b>キャッシュをクリア</b>でできます!"
Expand Down
1 change: 0 additions & 1 deletion locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ friendlyEnableWidgets: "위젯 영역 활성화"
friendlyDisableWidgets: "위젯 영역 비활성화"
useBoldFont: "볼드체 텍스트"
newNoteReceivedNotification: "새 노트 알림을 표시할 때"
disableRightClick: "우클릭 방지"
cherrypickUpdatedCacheClearTitle: "캐시를 지울까요?"
cherrypickUpdatedCacheClear: "테마 및 색상, 로케일 등의 변경 사항이 제대로 반영되지 않을 수 있기 때문에, 클라이언트가 업데이트되면 <b>캐시를 지울 것을 권장</b>해요.\n계정 로그인 상태는 그대로 유지돼요!"
cherrypickUpdatedCacheClearLater: "나중에 캐시를 지우려면 <b>설정</b> - <b>캐시 지우기</b>에서 할 수 있어요!"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export class DeleteDisableRightClick1697809019142 {
name = 'DeleteDisableRightClick1697809019142'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "disableRightClick"`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "disableRightClick"`);
}

}
3 changes: 0 additions & 3 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ type Option = {
event?: IEvent | null;
localOnly?: boolean | null;
reactionAcceptance?: MiNote['reactionAcceptance'];
disableRightClick?: boolean | null;
cw?: string | null;
visibility?: string;
visibleUsers?: MinimumUser[] | null;
Expand Down Expand Up @@ -248,7 +247,6 @@ export class NoteCreateService implements OnApplicationShutdown {
if (data.createdAt == null) data.createdAt = new Date();
if (data.visibility == null) data.visibility = 'public';
if (data.localOnly == null) data.localOnly = false;
if (data.disableRightClick == null) data.disableRightClick = false;
if (data.channel != null) data.visibility = 'public';
if (data.channel != null) data.visibleUsers = [];
if (data.channel != null) data.localOnly = true;
Expand Down Expand Up @@ -394,7 +392,6 @@ export class NoteCreateService implements OnApplicationShutdown {
userId: user.id,
localOnly: data.localOnly!,
reactionAcceptance: data.reactionAcceptance,
disableRightClick: data.disableRightClick!,
visibility: data.visibility as any,
visibleUserIds: data.visibility === 'specified'
? data.visibleUsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ export class ApNoteService {
cw,
text,
localOnly: false,
disableRightClick: false,
visibility,
visibleUsers,
apMentions,
Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/core/entities/NoteEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ export class NoteEntityService implements OnModuleInit {
localOnly: note.localOnly,
reactionAcceptance: note.reactionAcceptance,
visibleUserIds: note.visibility === 'specified' ? note.visibleUserIds : undefined,
disableRightClick: note.disableRightClick || undefined,
renoteCount: note.renoteCount,
repliesCount: note.repliesCount,
reactions: this.reactionService.convertLegacyReactions(note.reactions),
Expand Down
5 changes: 0 additions & 5 deletions packages/backend/src/models/Note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ export class MiNote {
})
public reactionAcceptance: 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote' | null;

@Column('boolean', {
default: false,
})
public disableRightClick: boolean;

@Column('smallint', {
default: 0,
})
Expand Down
4 changes: 0 additions & 4 deletions packages/backend/src/models/json-schema/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ export const packedNoteSchema = {
optional: true, nullable: true,
ref: 'Note',
},
disableRightClick: {
type: 'boolean',
optional: true, nullable: false,
},
isHidden: {
type: 'boolean',
optional: true, nullable: false,
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/src/server/api/endpoints/notes/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export const paramDef = {
cw: { type: 'string', nullable: true, maxLength: 100 },
localOnly: { type: 'boolean', default: false },
reactionAcceptance: { type: 'string', nullable: true, enum: [null, 'likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'], default: null },
disableRightClick: { type: 'boolean', default: false },
noExtractMentions: { type: 'boolean', default: false },
noExtractHashtags: { type: 'boolean', default: false },
noExtractEmojis: { type: 'boolean', default: false },
Expand Down Expand Up @@ -323,7 +322,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
cw: ps.cw,
localOnly: ps.localOnly,
reactionAcceptance: ps.reactionAcceptance,
disableRightClick: ps.disableRightClick,
visibility: ps.visibility,
visibleUsers,
channel,
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
<div v-if="appearNote.files.length > 0">
<MkMediaList v-if="appearNote.disableRightClick" :mediaList="appearNote.files" @contextmenu.prevent/>
<MkMediaList v-else :mediaList="appearNote.files"/>
<MkMediaList :mediaList="appearNote.files"/>
</div>
<MkPoll v-if="appearNote.poll" :note="appearNote" :class="$style.poll"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
<div v-if="appearNote.files.length > 0">
<MkMediaList v-if="appearNote.disableRightClick" :mediaList="appearNote.files" @contextmenu.prevent/>
<MkMediaList v-else :mediaList="appearNote.files"/>
<MkMediaList :mediaList="appearNote.files"/>
</div>
<MkPoll v-if="appearNote.poll" ref="pollViewer" :note="appearNote" :class="$style.poll"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="true" style="margin-top: 6px;"/>
Expand Down
7 changes: 0 additions & 7 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-tooltip="i18n.ts.useCw" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: useCw }]" @click="useCw = !useCw"><i class="ti ti-eye-off"></i></button>
<button v-tooltip="i18n.ts.mention" class="_button" :class="$style.footerButton" @click="insertMention"><i class="ti ti-at"></i></button>
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: withHashtags }]" @click="withHashtags = !withHashtags"><i class="ti ti-hash"></i></button>
<button v-tooltip="i18n.ts.disableRightClick" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: disableRightClick }]" @click="disableRightClick = !disableRightClick"><i class="ti ti-mouse-off"></i></button>
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugin" class="_button" :class="$style.footerButton" @click="showActions"><i class="ti ti-plug"></i></button>
<button v-tooltip="i18n.ts.emoji" :class="['_button', $style.footerButton]" @click="insertEmoji"><i class="ti ti-mood-happy"></i></button>
</div>
Expand Down Expand Up @@ -201,7 +200,6 @@ let hasNotSpecifiedMentions = $ref(false);
let recentHashtags = $ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]'));
let imeText = $ref('');
let showingOptions = $ref(false);
let disableRightClick = $ref(false);

const draftKey = $computed((): string => {
let key = props.channel ? `channel:${props.channel.id}` : '';
Expand Down Expand Up @@ -361,7 +359,6 @@ function watchForDraft() {
watch($$(text), () => saveDraft());
watch($$(useCw), () => saveDraft());
watch($$(cw), () => saveDraft());
watch($$(disableRightClick), () => saveDraft());
watch($$(poll), () => saveDraft());
watch($$(event), () => saveDraft());
watch($$(files), () => saveDraft(), { deep: true });
Expand Down Expand Up @@ -690,7 +687,6 @@ function saveDraft() {
text: text,
useCw: useCw,
cw: cw,
disableRightClick: disableRightClick,
visibility: visibility,
localOnly: localOnly,
files: files,
Expand Down Expand Up @@ -763,7 +759,6 @@ async function post(ev?: MouseEvent) {
visibility: visibility,
visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined,
reactionAcceptance,
disableRightClick: disableRightClick,
noteId: props.updateMode ? props.initialNote?.id : undefined,
};

Expand Down Expand Up @@ -934,7 +929,6 @@ onMounted(() => {
text = draft.data.text;
useCw = draft.data.useCw;
cw = draft.data.cw;
disableRightClick = draft.data.disableRightClick;
visibility = draft.data.visibility;
localOnly = draft.data.localOnly;
files = (draft.data.files || []).filter(draftFile => draftFile);
Expand Down Expand Up @@ -973,7 +967,6 @@ onMounted(() => {
visibility = init.visibility;
localOnly = init.localOnly;
quoteId = init.renote ? init.renote.id : null;
disableRightClick = init.disableRightClick != null;
}

nextTick(() => watchForDraft());
Expand Down
7 changes: 0 additions & 7 deletions packages/frontend/src/components/MkPostFormSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-tooltip="i18n.ts.useCw" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: useCw }]" @click="useCw = !useCw"><i class="ti ti-eye-off"></i></button>
<button v-tooltip="i18n.ts.mention" class="_button" :class="$style.footerButton" @click="insertMention"><i class="ti ti-at"></i></button>
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: withHashtags }]" @click="withHashtags = !withHashtags"><i class="ti ti-hash"></i></button>
<button v-tooltip="i18n.ts.disableRightClick" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: disableRightClick }]" @click="disableRightClick = !disableRightClick"><i class="ti ti-mouse-off"></i></button>
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugin" class="_button" :class="$style.footerButton" @click="showActions"><i class="ti ti-plug"></i></button>
<button v-tooltip="i18n.ts.emoji" :class="['_button', $style.footerButton]" @click="insertEmoji"><i class="ti ti-mood-happy"></i></button>
</div>
Expand Down Expand Up @@ -224,7 +223,6 @@ let hasNotSpecifiedMentions = $ref(false);
let recentHashtags = $ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]'));
let imeText = $ref('');
let showingOptions = $ref(false);
let disableRightClick = $ref(false);

const draftKey = $computed((): string => {
let key = props.channel ? `channel:${props.channel.id}` : '';
Expand Down Expand Up @@ -382,7 +380,6 @@ function watchForDraft() {
watch($$(text), () => saveDraft());
watch($$(useCw), () => saveDraft());
watch($$(cw), () => saveDraft());
watch($$(disableRightClick), () => saveDraft());
watch($$(poll), () => saveDraft());
watch($$(event), () => saveDraft());
watch($$(files), () => saveDraft(), { deep: true });
Expand Down Expand Up @@ -711,7 +708,6 @@ function saveDraft() {
text: text,
useCw: useCw,
cw: cw,
disableRightClick: disableRightClick,
visibility: visibility,
localOnly: localOnly,
files: files,
Expand Down Expand Up @@ -784,7 +780,6 @@ async function post(ev?: MouseEvent) {
visibility: visibility,
visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined,
reactionAcceptance,
disableRightClick: disableRightClick,
noteId: props.updateMode ? props.initialNote?.id : undefined,
};

Expand Down Expand Up @@ -988,7 +983,6 @@ onMounted(() => {
text = draft.data.text;
useCw = draft.data.useCw;
cw = draft.data.cw;
disableRightClick = draft.data.disableRightClick;
visibility = draft.data.visibility;
localOnly = draft.data.localOnly;
files = (draft.data.files || []).filter(draftFile => draftFile);
Expand Down Expand Up @@ -1027,7 +1021,6 @@ onMounted(() => {
visibility = init.visibility;
localOnly = init.localOnly;
quoteId = init.renote ? init.renote.id : null;
disableRightClick = init.disableRightClick != null;
}

nextTick(() => watchForDraft());
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div v-show="showContent">
<div v-if="note.files.length > 0">
<MkMediaList v-if="note.disableRightClick" :mediaList="note.files" @contextmenu.prevent/>
<MkMediaList v-else :mediaList="note.files"/>
<MkMediaList :mediaList="note.files"/>
</div>
<div v-if="note.poll">
<MkPoll :note="note"/>
Expand Down

0 comments on commit 6af8fd2

Please sign in to comment.