-
Notifications
You must be signed in to change notification settings - Fork 329
feat: add ai hint that content contains ai generated text #13022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| namespace OCA\Mail\Migration; | ||
|
|
||
| use Closure; | ||
| use OCP\DB\ISchemaWrapper; | ||
| use OCP\DB\Types; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
|
|
||
| /** | ||
| * @psalm-api | ||
| */ | ||
| class Version5201Date20260604000000 extends SimpleMigrationStep { | ||
| #[\Override] | ||
| public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
| $schema = $schemaClosure(); | ||
|
|
||
| $table = $schema->getTable('mail_local_messages'); | ||
| if (!$table->hasColumn('ai_generated')) { | ||
| $table->addColumn('ai_generated', Types::BOOLEAN, [ | ||
| 'notnull' => false, | ||
| 'default' => false, | ||
| ]); | ||
| } | ||
|
|
||
| return $schema; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,6 +400,12 @@ | |
| @uncheck="requestMdnVal = false"> | ||
| {{ t('mail', 'Request a read receipt') }} | ||
| </ActionCheckbox> | ||
| <ActionCheckbox | ||
| :checked="isAiGeneratedVal" | ||
| @check="isAiGeneratedVal = true" | ||
| @uncheck="isAiGeneratedVal = false"> | ||
| {{ t('mail', 'Mark as AI generated') }} | ||
| </ActionCheckbox> | ||
| <ActionCheckbox | ||
| v-if="smimeCertificateForCurrentAlias" | ||
| :checked="wantsSmimeSign" | ||
|
|
@@ -717,6 +723,11 @@ export default { | |
| default: false, | ||
| }, | ||
|
|
||
| isAiGenerated: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, | ||
|
|
||
| accounts: { | ||
| type: Array, | ||
| required: true, | ||
|
|
@@ -755,6 +766,7 @@ export default { | |
|
|
||
| editorMode: (this.body?.format !== 'html') ? EDITOR_MODE_TEXT : EDITOR_MODE_HTML, | ||
| requestMdnVal: this.requestMdn, | ||
| isAiGeneratedVal: this.isAiGenerated, | ||
| changeSignature: false, | ||
| loadingIndicatorTo: false, | ||
| loadingIndicatorCc: false, | ||
|
|
@@ -1070,6 +1082,10 @@ export default { | |
| this.$emit('update:request-mdn', val) | ||
| }, | ||
|
|
||
| isAiGeneratedVal(val) { | ||
| this.$emit('update:is-ai-generated', val) | ||
| }, | ||
|
|
||
| selectedAlias: { | ||
| handler() { | ||
| const aliasEmailAddress = this.selectedAlias.emailAddress | ||
|
|
@@ -1264,6 +1280,7 @@ export default { | |
| inReplyToMessageId: this.inReplyToMessageId ?? (this.replyTo ? this.replyTo.messageId : undefined), | ||
| isHtml: !this.encrypt && !this.editorPlainText, | ||
| requestMdn: this.requestMdnVal, | ||
| isAiGenerated: this.isAiGeneratedVal, | ||
| sendAt: this.sendAtVal !== 0 ? Math.floor(this.sendAtVal / 1000) : undefined, | ||
| smimeSign: this.shouldSmimeSign, | ||
| smimeEncrypt: this.shouldSmimeEncrypt, | ||
|
|
@@ -1344,6 +1361,7 @@ export default { | |
| } | ||
| if (this.smartReply) { | ||
| this.bus.emit('append-to-body-at-cursor', this.smartReply) | ||
| this.isAiGeneratedVal = true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude flagged this block, because a onEditorReady event (e.g the user is changing the alias) would insert the smart reply again, reset isAiGeneratedVal to true, and overwrite the user's choice. I think it's okay for now to ignore it, but we should look into a better way as follow up. |
||
| } | ||
| }, | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,10 @@ | |
| <div class="envelope__header__left__sender-subject-tags"> | ||
| <div class="sender" :class="{ 'sender--expanded': expanded }"> | ||
| {{ envelope.from && envelope.from[0] ? envelope.from[0].label : '' }} | ||
| <span v-if="hasAiGeneratedContent" class="ai-generated-label"> | ||
| <AiIcon :size="14" /> | ||
| {{ t('mail', 'Contains AI content') }} | ||
| </span> | ||
| </div> | ||
| <NcButton | ||
| v-if="expanded && hasRecipients" | ||
|
|
@@ -384,6 +388,7 @@ import { NcActionButton, NcButton } from '@nextcloud/vue' | |
| import { mapStores } from 'pinia' | ||
| import NcActions from '@nextcloud/vue/components/NcActions' | ||
| import NcActionText from '@nextcloud/vue/components/NcActionText' | ||
| import AiIcon from '@nextcloud/vue/components/NcAssistantIcon' | ||
| import ArchiveIcon from 'vue-material-design-icons/ArchiveArrowDownOutline.vue' | ||
| import ChevronDownIcon from 'vue-material-design-icons/ChevronDown.vue' | ||
| import ChevronUpIcon from 'vue-material-design-icons/ChevronUp.vue' | ||
|
|
@@ -439,6 +444,7 @@ const Loading = Object.seal({ | |
| export default { | ||
| name: 'ThreadEnvelope', | ||
| components: { | ||
| AiIcon, | ||
| MailFilterFromEnvelope, | ||
| EventModal, | ||
| TaskModal, | ||
|
|
@@ -610,6 +616,10 @@ export default { | |
| && isPgpText(this.envelope.previewText) | ||
| }, | ||
|
|
||
| hasAiGeneratedContent() { | ||
| return this.message?.aiGenerated === true | ||
| }, | ||
|
|
||
| isImportant() { | ||
| return this.mainStore | ||
| .getEnvelopeTags(this.envelope.databaseId) | ||
|
|
@@ -1189,6 +1199,10 @@ export default { | |
| <style lang="scss" scoped> | ||
| .sender { | ||
| margin-inline-start: calc(var(--default-grid-baseline) * 3); | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 6px; | ||
| min-width: 0; | ||
|
Comment on lines
+1202
to
+1205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Replace hardcoded pixel gaps with Nextcloud CSS variables.
As per coding guidelines: "Use Nextcloud CSS variables for all CSS colors, spacing, and dimensions; do not use magic numbers. Use calc(x*var) when needing more specific control over dimensions with CSS variables." ♻️ Proposed fix .sender {
margin-inline-start: calc(var(--default-grid-baseline) * 3);
display: flex;
align-items: center;
- gap: 6px;
+ gap: calc(var(--default-grid-baseline) * 1.5);
min-width: 0; .ai-generated-label {
display: flex;
align-items: center;
- gap: 4px;
+ gap: var(--default-grid-baseline);
opacity: 0.8;
}Also applies to: 1502-1508 Source: Coding guidelines |
||
|
|
||
| &--expanded { | ||
| color: var(--color-text-maxcontrast); | ||
|
|
@@ -1485,4 +1499,11 @@ export default { | |
| display: inline; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .ai-generated-label { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 4px; | ||
| opacity: 0.8; | ||
| } | ||
| </style> | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Claude: Please also reset isAiGeneratedVal in reset method