Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Shared Transcripts lists internal shares and what is shared with you (#416)

Murtaza Nasir01dee6037918
diff --git a/docs/user-guide/settings.md b/docs/user-guide/settings.md
index 1372909c..b5ae4c05 100644
--- a/docs/user-guide/settings.md
+++ b/docs/user-guide/settings.md
@@ -167,15 +167,13 @@ The setting only appears when your administrator has configured email delivery a
![Shared Transcripts](../assets/images/screenshots/settings-shared-transcripts.png)
-The Shared Transcripts tab provides complete visibility and control over every recording you've shared.
+The Shared Transcripts tab, also opened from **Shared Transcripts** in the user menu, lists everything you have shared and everything shared with you, in three sections:
-### Initial State
+- **Public links**: each recording with a public link, when you created it, whether it includes the summary and notes, and the link itself.
+- **People and groups**: each recording you have shared with other users, with each person's permissions (view, edit, share). Shares made through a group tag or group folder say so; they end when the tag or folder is removed from the recording, so they have no revoke button here.
+- **Shared with me**: recordings other users have shared with you, with the owner, your permissions and a link to open each one.
-When first accessing this tab, you'll see "You have not shared any transcripts yet" - this changes once you create your first share link from any recording.
-
-### Share Information Display
-
-Once you've shared recordings, each entry displays the recording title, when you created the share link, what information you included (summary and/or notes), and the complete URL for access. The interface matches what you see in the sharing modal, maintaining consistency across the application.
+The last two sections appear when internal sharing is enabled. In the user menu dialog they are split into two tabs, **Shared by me** and **Shared with me**.
### Managing Share Settings
@@ -185,7 +183,9 @@ You can modify these settings anytime without generating new links. Toggle summa
### Revoking Access
-The delete button (trash icon) immediately revokes access. Once deleted, anyone trying to access that link sees an error message. This instant revocation provides security when you've accidentally shared with wrong parties or when access is no longer appropriate. Remember that deletion can't retrieve information already viewed or downloaded by recipients.
+For a person, **Revoke** asks for a second click and then removes their access, together with any shares they passed on that have no other path to them.
+
+For a public link, the delete button (trash icon) immediately revokes access. Once deleted, anyone trying to access that link sees an error message. This instant revocation provides security when you've accidentally shared with wrong parties or when access is no longer appropriate. Remember that deletion can't retrieve information already viewed or downloaded by recipients.
## Speakers Management Tab
diff --git a/docs/user-guide/sharing.md b/docs/user-guide/sharing.md
index 5065c9aa..2141f33f 100644
--- a/docs/user-guide/sharing.md
+++ b/docs/user-guide/sharing.md
@@ -178,7 +178,7 @@ At the bottom of the page, recipients see a subtle footer indicating the content
All your shared recordings are centrally managed through the Shared Transcripts section in your account settings. This gives you a complete overview of everything you've shared and with whom.
-The shared transcripts list shows each recording you've shared, when you created the share link, and what options you selected (summary and/or notes). Each entry includes the full share URL that you can copy again if needed - perhaps you've lost the original link or need to reshare with additional people.
+The list has three sections: your public links, the recordings you have shared with other users and groups, and the recordings shared with you. See [Shared Transcripts Tab](settings.md#shared-transcripts-tab). For public links, it shows each recording you've shared, when you created the share link, and what options you selected (summary and/or notes). Each entry includes the full share URL that you can copy again if needed - perhaps you've lost the original link or need to reshare with additional people.
You can modify what's included in a share by toggling the summary and notes checkboxes directly in this interface. These changes take effect immediately for anyone accessing the link. This is useful when you initially share just the transcription but later decide to include the summary, or when you want to remove notes that are no longer relevant.
diff --git a/src/api/shares.py b/src/api/shares.py
index 3222da96..ea97dcce 100644
--- a/src/api/shares.py
+++ b/src/api/shares.py
@@ -15,7 +15,7 @@ from flask_login import login_required, current_user
from werkzeug.exceptions import HTTPException
from src.database import db
-from src.models import Recording, Share, InternalShare, SharedRecordingState, User, TranscriptChunk, ShareAuditLog
+from src.models import Recording, Share, InternalShare, SharedRecordingState, User, TranscriptChunk, ShareAuditLog, Folder
from src.utils import md_to_html
from src.services.storage import get_storage_service
from src.services.public_shares import active_share_or_404
@@ -265,6 +265,79 @@ def get_shares():
return jsonify([share.to_dict() for share in shares])
+@shares_bp.route('/api/shares/overview', methods=['GET'])
+@login_required
+def get_shares_overview():
+ """Everything the Shared Transcripts list shows (#416).
+
+ The list predates internal sharing and showed public links only. It now
+ has what the user shared (public links, and recordings shared with people
+ and groups) and what was shared with them.
+ """
+ def _source(share):
+ if share.source_type == 'group_tag' and share.source_tag is not None:
+ return {'type': 'group_tag', 'name': share.source_tag.name}
+ if share.source_type == 'group_folder' and share.source_folder_id:
+ folder = db.session.get(Folder, share.source_folder_id)
+ return {'type': 'group_folder', 'name': folder.name if folder else None}
+ return {'type': 'manual', 'name': None}
+
+ public_links = [s.to_dict() for s in
+ Share.query.filter_by(user_id=current_user.id).order_by(Share.created_at.desc()).all()]
+ shared_by_me, shared_with_me = [], []
+ if ENABLE_INTERNAL_SHARING:
+ by_recording = {}
+ for share in (InternalShare.query.filter_by(owner_id=current_user.id)
+ .order_by(InternalShare.created_at.desc()).all()):
+ recording = share.recording
+ if recording is None:
+ continue
+ entry = by_recording.setdefault(recording.id, {
+ 'recording_id': recording.id,
+ 'recording_title': recording.title or recording.original_filename or f'#{recording.id}',
+ 'recipients': [],
+ })
+ source = _source(share)
+ entry['recipients'].append({
+ 'share_id': share.id,
+ 'user_id': share.shared_with_user_id,
+ 'username': share.shared_with.username if share.shared_with else None,
+ 'can_edit': bool(share.can_edit),
+ 'can_reshare': bool(share.can_reshare),
+ 'source': source,
+ # A group share follows its tag or folder; removing the tag or
+ # folder ends it, so only a manual share is revoked here.
+ 'revocable': source['type'] == 'manual',
+ 'created_at': share.created_at.isoformat() if share.created_at else None,
+ })
+ shared_by_me = list(by_recording.values())
+
+ for share in (InternalShare.query.filter_by(shared_with_user_id=current_user.id)
+ .order_by(InternalShare.created_at.desc()).all()):
+ recording = share.recording
+ if recording is None:
+ continue
+ shared_with_me.append({
+ 'share_id': share.id,
+ 'recording_id': recording.id,
+ 'recording_title': recording.title or recording.original_filename or f'#{recording.id}',
+ 'owner_username': share.owner.username if SHOW_USERNAMES_IN_UI and share.owner else None,
+ 'can_edit': bool(share.can_edit),
+ 'can_reshare': bool(share.can_reshare),
+ 'source': _source(share),
+ 'status': recording.status,
+ 'created_at': share.created_at.isoformat() if share.created_at else None,
+ })
+
+ return jsonify({
+ 'public_sharing_enabled': ENABLE_PUBLIC_SHARING,
+ 'internal_sharing_enabled': ENABLE_INTERNAL_SHARING,
+ 'public_links': public_links,
+ 'shared_by_me': shared_by_me,
+ 'shared_with_me': shared_with_me,
+ })
+
+
@shares_bp.route('/api/share/<int:share_id>', methods=['PUT'])
@login_required
def update_share(share_id):
diff --git a/static/js/modules/composables/sharing.js b/static/js/modules/composables/sharing.js
index 1f3399e1..59abb04c 100644
--- a/static/js/modules/composables/sharing.js
+++ b/static/js/modules/composables/sharing.js
@@ -3,6 +3,8 @@
* Handles public and internal sharing of recordings
*/
+const { ref } = Vue;
+
export function useSharing(state, utils) {
const {
showShareModal, showSharesListModal, showShareDeleteModal,
@@ -20,6 +22,14 @@ export function useSharing(state, utils) {
let userSearchTimeout = null;
+ // Shared Transcripts list (#416): what the user shared (public links,
+ // people and groups) and what others shared with them.
+ const sharesTab = ref('by_me');
+ const sharesByMe = ref([]);
+ const sharesWithMe = ref([]);
+ const sharesPublicEnabled = ref(true);
+ const sharesInternalEnabled = ref(false);
+
// Helper function to format share dates
const formatShareDate = (dateString) => {
if (!dateString) return 'Unknown date';
@@ -299,10 +309,16 @@ export function useSharing(state, utils) {
isLoadingShares.value = true;
showSharesListModal.value = true;
try {
- const response = await fetch('/api/shares');
+ const response = await fetch('/api/shares/overview');
const data = await response.json();
if (!response.ok) throw new Error(data.error || 'Failed to load shared items');
- userShares.value = data;
+ userShares.value = data.public_links || [];
+ sharesByMe.value = (data.shared_by_me || []).map(r => ({
+ ...r, recipients: r.recipients.map(p => ({ ...p, confirming: false })),
+ }));
+ sharesWithMe.value = data.shared_with_me || [];
+ sharesPublicEnabled.value = data.public_sharing_enabled !== false;
+ sharesInternalEnabled.value = !!data.internal_sharing_enabled;
} catch (error) {
setGlobalError(`Failed to load shared items: ${error.message}`);
} finally {
@@ -313,6 +329,32 @@ export function useSharing(state, utils) {
const closeSharesList = () => {
showSharesListModal.value = false;
userShares.value = [];
+ sharesByMe.value = [];
+ sharesWithMe.value = [];
+ };
+
+ // Revoke one person's access from the list. The first click asks, the
+ // second revokes; a group share follows its tag or folder and has no
+ // button here.
+ const revokeShareFromList = async (entry, recipient) => {
+ if (!recipient.confirming) {
+ recipient.confirming = true;
+ return;
+ }
+ try {
+ const response = await fetch(`/api/internal-shares/${recipient.share_id}`, { method: 'DELETE' });
+ const data = await response.json().catch(() => ({}));
+ if (!response.ok) throw new Error(data.error || 'Failed to revoke share');
+ entry.recipients = entry.recipients.filter(p => p.share_id !== recipient.share_id);
+ if (!entry.recipients.length) {
+ sharesByMe.value = sharesByMe.value.filter(r => r !== entry);
+ }
+ showToast(utils.t ? utils.t('sharedTranscripts.accessRevoked') : 'Access revoked', 'fa-user-times');
+ await refreshRecordingShareCounts();
+ } catch (error) {
+ recipient.confirming = false;
+ setGlobalError(`Failed to revoke share: ${error.message}`);
+ }
};
const updateShare = async (share) => {
@@ -645,6 +687,12 @@ export function useSharing(state, utils) {
// Shares list
openSharesList,
closeSharesList,
+ sharesTab,
+ sharesByMe,
+ sharesWithMe,
+ sharesPublicEnabled,
+ sharesInternalEnabled,
+ revokeShareFromList,
updateShare,
confirmDeleteShare,
cancelDeleteShare,
diff --git a/static/js/shared-components.js b/static/js/shared-components.js
index e68666a4..06a7ce14 100644
--- a/static/js/shared-components.js
+++ b/static/js/shared-components.js
@@ -140,25 +140,12 @@ function useSharesModal() {
const userShares = Vue.ref([]);
const isLoadingShares = Vue.ref(false);
- const openSharesList = async () => {
- isLoadingShares.value = true;
- showSharesListModal.value = true;
- try {
- const response = await fetch('/api/shares');
- const data = await response.json();
- if (!response.ok) throw new Error(data.error || 'Failed to load shared items');
- userShares.value = data;
- } catch (error) {
- if (window.setGlobalError) {
- window.setGlobalError(`Failed to load shared items: ${error.message}`);
- } else {
- console.error('Failed to load shared items:', error);
- }
- } finally {
- isLoadingShares.value = false;
- }
+ // The Shared Transcripts dialog lives in the main app (#416), as on the
+ // other pages that use the shared header.
+ const openSharesList = () => {
+ window.location.href = "/?open=shares";
};
-
+
const closeSharesList = () => {
showSharesListModal.value = false;
};
diff --git a/static/locales/de.json b/static/locales/de.json
index 8ef7cadc..e433fbb3 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "Sie haben noch keine Transkripte geteilt.",
"shareNotes": "Notizen Teilen",
"shareSummary": "Zusammenfassung Teilen",
- "sharedOn": "Geteilt am"
+ "sharedOn": "Geteilt am",
+ "sharedByMe": "Von mir geteilt",
+ "sharedWithMe": "Mit mir geteilt",
+ "publicLinks": "Öffentliche Links",
+ "noPublicLinks": "Sie haben keine öffentlichen Links.",
+ "peopleAndGroups": "Personen und Gruppen",
+ "noInternalShares": "Sie haben keine Aufnahmen mit anderen Benutzern geteilt.",
+ "canEdit": "Darf bearbeiten",
+ "canView": "Darf ansehen",
+ "canReshare": "Darf teilen",
+ "viaGroupTag": "über Gruppen-Tag {{name}}",
+ "viaGroupFolder": "über Gruppenordner {{name}}",
+ "revokeAccess": "Zugriff entziehen",
+ "revoke": "Entziehen",
+ "confirmRevoke": "Bestätigen",
+ "groupShareNote": "Endet, wenn Tag oder Ordner entfernt wird",
+ "nothingSharedWithMe": "Mit Ihnen wurde noch nichts geteilt.",
+ "fromOwner": "Von {{name}}",
+ "open": "Öffnen",
+ "accessRevoked": "Zugriff entzogen",
+ "revokeFailed": "Der Zugriff konnte nicht entzogen werden."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "Sie haben noch keine Transkripte geteilt."
diff --git a/static/locales/en.json b/static/locales/en.json
index 817604f8..a955e97e 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "You haven't shared any transcripts yet.",
"shareNotes": "Share Notes",
"shareSummary": "Share Summary",
- "sharedOn": "Shared on"
+ "sharedOn": "Shared on",
+ "sharedByMe": "Shared by me",
+ "sharedWithMe": "Shared with me",
+ "publicLinks": "Public links",
+ "noPublicLinks": "You have no public links.",
+ "peopleAndGroups": "People and groups",
+ "noInternalShares": "You have not shared any recordings with other users.",
+ "canEdit": "Can edit",
+ "canView": "Can view",
+ "canReshare": "Can share",
+ "viaGroupTag": "via group tag {{name}}",
+ "viaGroupFolder": "via group folder {{name}}",
+ "revokeAccess": "Revoke access",
+ "revoke": "Revoke",
+ "confirmRevoke": "Confirm",
+ "groupShareNote": "Ends when the tag or folder is removed",
+ "nothingSharedWithMe": "Nothing has been shared with you yet.",
+ "fromOwner": "From {{name}}",
+ "open": "Open",
+ "accessRevoked": "Access revoked",
+ "revokeFailed": "Could not revoke access."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "You have not shared any transcripts yet."
diff --git a/static/locales/es.json b/static/locales/es.json
index 3a279b69..316371b3 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "Aún no has compartido ninguna transcripción.",
"shareNotes": "Compartir Notas",
"shareSummary": "Compartir Resumen",
- "sharedOn": "Compartido el"
+ "sharedOn": "Compartido el",
+ "sharedByMe": "Compartido por mí",
+ "sharedWithMe": "Compartido conmigo",
+ "publicLinks": "Enlaces públicos",
+ "noPublicLinks": "No tiene enlaces públicos.",
+ "peopleAndGroups": "Personas y grupos",
+ "noInternalShares": "No ha compartido grabaciones con otros usuarios.",
+ "canEdit": "Puede editar",
+ "canView": "Puede ver",
+ "canReshare": "Puede compartir",
+ "viaGroupTag": "mediante la etiqueta de grupo {{name}}",
+ "viaGroupFolder": "mediante la carpeta de grupo {{name}}",
+ "revokeAccess": "Retirar acceso",
+ "revoke": "Retirar",
+ "confirmRevoke": "Confirmar",
+ "groupShareNote": "Termina al quitar la etiqueta o la carpeta",
+ "nothingSharedWithMe": "Todavía no se ha compartido nada con usted.",
+ "fromOwner": "De {{name}}",
+ "open": "Abrir",
+ "accessRevoked": "Acceso retirado",
+ "revokeFailed": "No se pudo retirar el acceso."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "Aún no has compartido ninguna transcripción."
diff --git a/static/locales/fr.json b/static/locales/fr.json
index b43182f8..cad4f665 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "Vous n'avez encore partagé aucune transcription.",
"shareNotes": "Partager les Notes",
"shareSummary": "Partager le Résumé",
- "sharedOn": "Partagé le"
+ "sharedOn": "Partagé le",
+ "sharedByMe": "Partagé par moi",
+ "sharedWithMe": "Partagé avec moi",
+ "publicLinks": "Liens publics",
+ "noPublicLinks": "Vous n'avez aucun lien public.",
+ "peopleAndGroups": "Personnes et groupes",
+ "noInternalShares": "Vous n'avez partagé aucun enregistrement avec d'autres utilisateurs.",
+ "canEdit": "Peut modifier",
+ "canView": "Peut consulter",
+ "canReshare": "Peut partager",
+ "viaGroupTag": "via le tag de groupe {{name}}",
+ "viaGroupFolder": "via le dossier de groupe {{name}}",
+ "revokeAccess": "Retirer l'accès",
+ "revoke": "Retirer",
+ "confirmRevoke": "Confirmer",
+ "groupShareNote": "Prend fin quand le tag ou le dossier est retiré",
+ "nothingSharedWithMe": "Rien n'a encore été partagé avec vous.",
+ "fromOwner": "De {{name}}",
+ "open": "Ouvrir",
+ "accessRevoked": "Accès retiré",
+ "revokeFailed": "Impossible de retirer l'accès."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "Vous n'avez pas encore partagé de transcriptions."
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index ab1a6122..e85defc4 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "Você não compartilhou nenhuma transcrição ainda.",
"shareNotes": "Compartilhar Notas",
"shareSummary": "Compartilhar Resumo",
- "sharedOn": "Compartilhado em"
+ "sharedOn": "Compartilhado em",
+ "sharedByMe": "Compartilhado por mim",
+ "sharedWithMe": "Compartilhado comigo",
+ "publicLinks": "Links públicos",
+ "noPublicLinks": "Você não tem links públicos.",
+ "peopleAndGroups": "Pessoas e grupos",
+ "noInternalShares": "Você não compartilhou gravações com outros usuários.",
+ "canEdit": "Pode editar",
+ "canView": "Pode ver",
+ "canReshare": "Pode compartilhar",
+ "viaGroupTag": "pela tag de grupo {{name}}",
+ "viaGroupFolder": "pela pasta de grupo {{name}}",
+ "revokeAccess": "Revogar acesso",
+ "revoke": "Revogar",
+ "confirmRevoke": "Confirmar",
+ "groupShareNote": "Termina quando a tag ou a pasta é removida",
+ "nothingSharedWithMe": "Nada foi compartilhado com você ainda.",
+ "fromOwner": "De {{name}}",
+ "open": "Abrir",
+ "accessRevoked": "Acesso revogado",
+ "revokeFailed": "Não foi possível revogar o acesso."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "Você ainda não compartilhou nenhuma transcrição."
diff --git a/static/locales/ru.json b/static/locales/ru.json
index e8fb290f..64b7700f 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "Вы пока не делились транскриптами.",
"shareNotes": "Поделиться заметками",
"shareSummary": "Поделиться резюме",
- "sharedOn": "Опубликовано"
+ "sharedOn": "Опубликовано",
+ "sharedByMe": "Я поделился",
+ "sharedWithMe": "Поделились со мной",
+ "publicLinks": "Публичные ссылки",
+ "noPublicLinks": "У вас нет публичных ссылок.",
+ "peopleAndGroups": "Люди и группы",
+ "noInternalShares": "Вы не делились записями с другими пользователями.",
+ "canEdit": "Может изменять",
+ "canView": "Может просматривать",
+ "canReshare": "Может делиться",
+ "viaGroupTag": "через групповой тег {{name}}",
+ "viaGroupFolder": "через групповую папку {{name}}",
+ "revokeAccess": "Отозвать доступ",
+ "revoke": "Отозвать",
+ "confirmRevoke": "Подтвердить",
+ "groupShareNote": "Действует, пока не удалён тег или папка",
+ "nothingSharedWithMe": "С вами пока ничем не поделились.",
+ "fromOwner": "От {{name}}",
+ "open": "Открыть",
+ "accessRevoked": "Доступ отозван",
+ "revokeFailed": "Не удалось отозвать доступ."
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "Вы пока не делились транскриптами."
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 799afcb1..06af537d 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1798,7 +1798,27 @@
"noSharedTranscripts": "您尚未分享任何转录。",
"shareNotes": "分享笔记",
"shareSummary": "分享摘要",
- "sharedOn": "分享于"
+ "sharedOn": "分享于",
+ "sharedByMe": "我分享的",
+ "sharedWithMe": "分享给我的",
+ "publicLinks": "公开链接",
+ "noPublicLinks": "您没有公开链接。",
+ "peopleAndGroups": "人员和群组",
+ "noInternalShares": "您尚未与其他用户分享录音。",
+ "canEdit": "可编辑",
+ "canView": "可查看",
+ "canReshare": "可转发分享",
+ "viaGroupTag": "通过群组标签 {{name}}",
+ "viaGroupFolder": "通过群组文件夹 {{name}}",
+ "revokeAccess": "撤销访问",
+ "revoke": "撤销",
+ "confirmRevoke": "确认",
+ "groupShareNote": "移除标签或文件夹后结束",
+ "nothingSharedWithMe": "还没有人与您分享内容。",
+ "fromOwner": "来自 {{name}}",
+ "open": "打开",
+ "accessRevoked": "已撤销访问",
+ "revokeFailed": "无法撤销访问。"
},
"sharedTranscriptsPage": {
"noSharedTranscripts": "您尚未分享任何转录。"
diff --git a/templates/account.html b/templates/account.html
index 2b699c99..a01d42f0 100644
--- a/templates/account.html
+++ b/templates/account.html
@@ -4093,16 +4093,70 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
async function loadShares() {
sharesContainer.innerHTML = '<div class="text-center"><i class="fas fa-spinner fa-spin text-2xl"></i></div>';
try {
- const response = await fetch('/api/shares');
- const shares = await response.json();
- if (!response.ok) throw new Error(shares.error || 'Failed to load');
-
- if (shares.length === 0) {
- sharesContainer.innerHTML = `<p class="text-center text-[var(--text-muted)]">${t('sharedTranscriptsPage.noSharedTranscripts')}</p>`;
- return;
- }
+ // Public links, recordings shared with people and groups,
+ // and recordings shared with this user (#416).
+ const response = await fetch('/api/shares/overview');
+ const overview = await response.json();
+ if (!response.ok) throw new Error(overview.error || 'Failed to load');
+ const shares = overview.public_links || [];
sharesContainer.innerHTML = '';
+ const section = (icon, title) => {
+ const el = document.createElement('section');
+ el.className = 'space-y-3';
+ el.innerHTML = `<h3 class="text-lg font-medium text-[var(--text-secondary)] flex items-center gap-2"><i class="fas ${icon}"></i>${escapeHtml(title)}</h3>`;
+ sharesContainer.appendChild(el);
+ return el;
+ };
+ const empty = (el, text) => {
+ const p = document.createElement('p');
+ p.className = 'text-sm text-[var(--text-muted)]';
+ p.textContent = text;
+ el.appendChild(p);
+ };
+ const permissions = (item) => (item.can_edit ? t('sharedTranscripts.canEdit') : t('sharedTranscripts.canView'))
+ + (item.can_reshare ? ' · ' + t('sharedTranscripts.canReshare') : '')
+ + (item.source && item.source.type !== 'manual'
+ ? ' · ' + t(item.source.type === 'group_tag' ? 'sharedTranscripts.viaGroupTag' : 'sharedTranscripts.viaGroupFolder', { name: item.source.name || '' })
+ : '');
+
+ const publicSection = section('fa-link', t('sharedTranscripts.publicLinks'));
+ if (shares.length === 0) empty(publicSection, t('sharedTranscripts.noPublicLinks'));
+
+ if (overview.internal_sharing_enabled) {
+ const peopleSection = section('fa-user-friends', t('sharedTranscripts.peopleAndGroups'));
+ if (!(overview.shared_by_me || []).length) empty(peopleSection, t('sharedTranscripts.noInternalShares'));
+ (overview.shared_by_me || []).forEach(entry => {
+ const card = document.createElement('div');
+ card.className = 'bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)]';
+ card.innerHTML = `<a href="/recordings/${entry.recording_id}" dir="auto" class="font-semibold hover:underline">${escapeHtml(entry.recording_title)}</a>
+ <ul class="mt-2 divide-y divide-[var(--border-primary)]">${entry.recipients.map(p => `
+ <li class="py-2 flex items-center justify-between gap-3">
+ <div class="min-w-0"><p class="text-sm font-medium">${escapeHtml(p.username || '')}</p>
+ <p class="text-xs text-[var(--text-muted)]">${escapeHtml(permissions(p))}</p></div>
+ ${p.revocable
+ ? `<button data-internal-share-id="${p.share_id}" class="revoke-internal-btn text-sm px-2 py-1 rounded border border-[var(--border-secondary)] hover:bg-[var(--bg-secondary)]"><i class="fas fa-user-times mr-1"></i>${escapeHtml(t('sharedTranscripts.revoke'))}</button>`
+ : `<span class="text-xs text-[var(--text-muted)] text-right max-w-[12rem]">${escapeHtml(t('sharedTranscripts.groupShareNote'))}</span>`}
+ </li>`).join('')}</ul>`;
+ peopleSection.appendChild(card);
+ });
+
+ const withMeSection = section('fa-inbox', t('sharedTranscripts.sharedWithMe'));
+ if (!(overview.shared_with_me || []).length) empty(withMeSection, t('sharedTranscripts.nothingSharedWithMe'));
+ (overview.shared_with_me || []).forEach(item => {
+ const row = document.createElement('div');
+ row.className = 'bg-[var(--bg-tertiary)] p-3 rounded-lg border border-[var(--border-primary)] flex items-center justify-between gap-3';
+ const from = item.owner_username ? t('sharedTranscripts.fromOwner', { name: item.owner_username }) + ' · ' : '';
+ row.innerHTML = `<div class="min-w-0"><a href="/recordings/${item.recording_id}" dir="auto" class="font-semibold hover:underline">${escapeHtml(item.recording_title)}</a>
+ <p class="text-xs text-[var(--text-muted)]">${escapeHtml(from + permissions(item))} · ${formatInstant(item.created_at)}</p></div>`;
+ withMeSection.appendChild(row);
+ });
+ }
+
+ document.querySelectorAll('.revoke-internal-btn').forEach(btn => {
+ btn.addEventListener('click', handleRevokeInternalShare);
+ });
+
shares.forEach(share => {
const shareEl = document.createElement('div');
shareEl.className = 'bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)]';
@@ -4131,7 +4185,7 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
</button>
</div>
`;
- sharesContainer.appendChild(shareEl);
+ publicSection.appendChild(shareEl);
});
document.querySelectorAll('.delete-share-btn').forEach(btn => {
@@ -4172,6 +4226,28 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
}
}
+ // First click asks, second revokes (#416).
+ async function handleRevokeInternalShare(event) {
+ const button = event.currentTarget;
+ if (!button.dataset.confirming) {
+ button.dataset.confirming = '1';
+ button.innerHTML = `<i class="fas fa-user-times mr-1"></i>${escapeHtml(t('sharedTranscripts.confirmRevoke'))}`;
+ button.classList.add('text-[var(--text-danger)]');
+ return;
+ }
+ try {
+ const csrfToken = document.querySelector('meta[name=csrf-token]')?.getAttribute('content');
+ const response = await fetch(`/api/internal-shares/${button.dataset.internalShareId}`, {
+ method: 'DELETE',
+ headers: csrfToken ? { 'X-CSRFToken': csrfToken } : {},
+ });
+ if (!response.ok) throw new Error('Failed to revoke');
+ loadShares();
+ } catch (error) {
+ alert(t('sharedTranscripts.revokeFailed'));
+ }
+ }
+
async function handleDeleteShare(event) {
const shareId = event.currentTarget.dataset.shareId;
if (!confirm('Are you sure you want to delete this share? This will revoke access to the public link.')) return;
diff --git a/templates/inquire.html b/templates/inquire.html
index 0e983cce..bd5d9919 100644
--- a/templates/inquire.html
+++ b/templates/inquire.html
@@ -663,42 +663,6 @@
</div>
</div>
- <!-- Shares List Modal -->
- <div v-if="showSharesListModal" class="modal-overlay">
- <div class="modal-panel modal-panel--lg">
- <div class="modal-header">
- <h3 class="modal-title" v-text="t('modal.sharedTranscripts')"></h3>
- <button @click="closeSharesList" class="modal-close" title="Close">
- <i class="fas fa-times"></i>
- </button>
- </div>
- <div class="modal-body space-y-4">
- <div v-if="isLoadingShares" class="text-center">
- <i class="fas fa-spinner fa-spin text-2xl text-[var(--text-muted)]"></i>
- </div>
- <div v-else-if="userShares.length === 0" class="text-center text-[var(--text-muted)]">
- <span v-text="t('sharedTranscripts.noSharedTranscripts')"></span>
- </div>
- <div v-else class="space-y-3">
- <div v-for="share in userShares" :key="share.id" class="bg-[var(--bg-tertiary)] p-4 rounded-lg border border-[var(--border-primary)]">
- <div class="flex justify-between items-start">
- <div>
- <p class="font-semibold">${share.recording_title}</p>
- <p class="text-sm text-[var(--text-muted)]">${ t('help.sharedOn') }: ${ formatInstant(share.created_at) }</p>
- </div>
- <button @click="deleteShare(share.id)" class="text-[var(--text-danger)] hover:opacity-80 p-1"><i class="fas fa-trash"></i></button>
- </div>
- <div class="mt-4">
- <input :value="'{{ request.url_root }}share/' + share.public_id" readonly class="w-full px-3 py-2 bg-[var(--bg-input)] border border-[var(--border-secondary)] rounded-lg text-sm">
- <button @click="copyShareLink(share.public_id)" class="mt-2 px-3 py-1 bg-[var(--bg-button)] text-[var(--text-button)] rounded-lg text-sm hover:bg-[var(--bg-button-hover)]">
- <i class="fas fa-copy mr-2"></i>Copy Link
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
</div>
<!-- CSRF Token Management -->
diff --git a/templates/modals/shares-list-modal.html b/templates/modals/shares-list-modal.html
index b339bbb8..1882c07b 100644
--- a/templates/modals/shares-list-modal.html
+++ b/templates/modals/shares-list-modal.html
@@ -1,47 +1,117 @@
-<!-- Shares List Modal (design system v1) -->
+<!-- Shares List Modal (design system v1). Shared by me: public links, and
+ recordings shared with people and groups. Shared with me: recordings
+ others shared with this user (#416). -->
<div v-if="showSharesListModal" @click.self="closeSharesList" class="modal-overlay">
<div class="modal-panel modal-panel--lg">
<div class="modal-header">
<h3 class="modal-title" v-text="t('modal.sharedTranscripts')"></h3>
<button @click="closeSharesList" class="modal-close" :title="t('buttons.close')"><i class="fas fa-times"></i></button>
</div>
+ <div v-if="sharesInternalEnabled" class="tabs px-4" role="tablist">
+ <button class="tab" role="tab" :class="{ 'is-active': sharesTab === 'by_me' }" :aria-selected="sharesTab === 'by_me'" @click="sharesTab = 'by_me'">
+ <span v-text="t('sharedTranscripts.sharedByMe')"></span>
+ <span class="tab__count" v-text="userShares.length + sharesByMe.length"></span>
+ </button>
+ <button class="tab" role="tab" :class="{ 'is-active': sharesTab === 'with_me' }" :aria-selected="sharesTab === 'with_me'" @click="sharesTab = 'with_me'">
+ <span v-text="t('sharedTranscripts.sharedWithMe')"></span>
+ <span class="tab__count" v-text="sharesWithMe.length"></span>
+ </button>
+ </div>
<div class="modal-body">
<div v-if="isLoadingShares" class="empty">
<div class="spinner spinner--lg"></div>
</div>
- <div v-else-if="userShares.length === 0" class="empty">
- <div class="empty__icon"><i class="fas fa-share-alt"></i></div>
- <div class="empty__title" v-text="t('sharedTranscripts.noSharedTranscripts')"></div>
- </div>
- <div v-else class="space-y-3">
- <div v-for="share in userShares" :key="share.id"
- class="p-4 rounded-md border border-[var(--border-primary)] bg-[var(--bg-tertiary)]">
- <div class="flex justify-between items-start">
- <div>
- <p class="t-body-strong">${share.recording_title}</p>
- <p class="t-meta">${ t('help.sharedOn') }: ${ formatShareDate(share.created_at) }</p>
+
+ <!-- Shared by me -->
+ <div v-else-if="!sharesInternalEnabled || sharesTab === 'by_me'" class="space-y-6">
+ <section v-if="sharesPublicEnabled || userShares.length">
+ <h4 class="t-label mb-2 flex items-center gap-2"><i class="fas fa-link"></i><span v-text="t('sharedTranscripts.publicLinks')"></span></h4>
+ <p v-if="userShares.length === 0" class="t-meta" v-text="t('sharedTranscripts.noPublicLinks')"></p>
+ <div v-else class="space-y-3">
+ <div v-for="share in userShares" :key="share.id"
+ class="p-4 rounded-md border border-[var(--border-primary)] bg-[var(--bg-tertiary)]">
+ <div class="flex justify-between items-start gap-3">
+ <div class="min-w-0">
+ <a :href="'/recordings/' + share.recording_id" class="t-body-strong hover:underline block truncate" dir="auto" v-text="share.recording_title"></a>
+ <p class="t-meta">${ t('help.sharedOn') }: ${ formatShareDate(share.created_at) }</p>
+ </div>
+ <button @click="confirmDeleteShare(share)" class="btn btn--icon btn--sm" style="color: var(--text-danger);" :title="t('buttons.delete')"><i class="fas fa-trash"></i></button>
+ </div>
+ <div class="mt-3 flex items-center gap-4">
+ <label class="flex items-center text-sm">
+ <input type="checkbox" v-model="share.share_summary" @change="updateShare(share)" class="h-4 w-4 rounded">
+ <span class="ml-2" v-text="t('form.shareSummary')"></span>
+ </label>
+ <label class="flex items-center text-sm">
+ <input type="checkbox" v-model="share.share_notes" @change="updateShare(share)" class="h-4 w-4 rounded">
+ <span class="ml-2" v-text="t('form.shareNotes')"></span>
+ </label>
+ </div>
+ <div class="mt-3 relative">
+ <input :value="'{{ request.url_root }}share/' + share.public_id" :id="'share-link-' + share.id" readonly class="field pr-12">
+ <button @click="copyIndividualShareLink(share.id)"
+ class="absolute right-1.5 top-1/2 -translate-y-1/2 btn btn--sm btn--primary btn--icon"
+ :title="t('buttons.copy')">
+ <i :class="copiedShareId === share.id ? 'fas fa-check' : 'fas fa-copy'"></i>
+ </button>
+ </div>
</div>
- <button @click="confirmDeleteShare(share)" class="btn btn--icon btn--sm" style="color: var(--text-danger);"><i class="fas fa-trash"></i></button>
- </div>
- <div class="mt-3 flex items-center gap-4">
- <label class="flex items-center text-sm">
- <input type="checkbox" v-model="share.share_summary" @change="updateShare(share)" class="h-4 w-4 rounded">
- <span class="ml-2" v-text="t('form.shareSummary')"></span>
- </label>
- <label class="flex items-center text-sm">
- <input type="checkbox" v-model="share.share_notes" @change="updateShare(share)" class="h-4 w-4 rounded">
- <span class="ml-2" v-text="t('form.shareNotes')"></span>
- </label>
</div>
- <div class="mt-3 relative">
- <input :value="'{{ request.url_root }}share/' + share.public_id" :id="'share-link-' + share.id" readonly class="field pr-12">
- <button @click="copyIndividualShareLink(share.id)"
- class="absolute right-1.5 top-1/2 -translate-y-1/2 btn btn--sm btn--primary btn--icon"
- :title="t('buttons.copy')">
- <i :class="copiedShareId === share.id ? 'fas fa-check' : 'fas fa-copy'"></i>
- </button>
+ </section>
+
+ <section v-if="sharesInternalEnabled">
+ <h4 class="t-label mb-2 flex items-center gap-2"><i class="fas fa-user-friends"></i><span v-text="t('sharedTranscripts.peopleAndGroups')"></span></h4>
+ <p v-if="sharesByMe.length === 0" class="t-meta" v-text="t('sharedTranscripts.noInternalShares')"></p>
+ <div v-else class="space-y-3">
+ <div v-for="entry in sharesByMe" :key="entry.recording_id"
+ class="p-4 rounded-md border border-[var(--border-primary)] bg-[var(--bg-tertiary)]">
+ <a :href="'/recordings/' + entry.recording_id" class="t-body-strong hover:underline block truncate" dir="auto" v-text="entry.recording_title"></a>
+ <ul class="mt-2 divide-y divide-[var(--border-primary)]">
+ <li v-for="person in entry.recipients" :key="person.share_id" class="py-2 flex items-center justify-between gap-3">
+ <div class="min-w-0">
+ <p class="text-sm font-medium text-[var(--text-primary)] truncate" v-text="person.username"></p>
+ <p class="t-meta">
+ <span v-text="person.can_edit ? t('sharedTranscripts.canEdit') : t('sharedTranscripts.canView')"></span><span v-if="person.can_reshare"> · <span v-text="t('sharedTranscripts.canReshare')"></span></span>
+ <span v-if="person.source.type !== 'manual'"> · <i class="fas fa-users text-[10px]"></i> <span v-text="t(person.source.type === 'group_tag' ? 'sharedTranscripts.viaGroupTag' : 'sharedTranscripts.viaGroupFolder', { name: person.source.name || '' })"></span></span>
+ </p>
+ </div>
+ <button v-if="person.revocable" @click="revokeShareFromList(entry, person)"
+ class="btn btn--sm flex-shrink-0" :class="person.confirming ? 'btn--danger' : 'btn--ghost'"
+ :title="t('sharedTranscripts.revokeAccess')">
+ <i class="fas fa-user-times"></i>
+ <span v-text="person.confirming ? t('sharedTranscripts.confirmRevoke') : t('sharedTranscripts.revoke')"></span>
+ </button>
+ <span v-else class="t-meta flex-shrink-0 text-right max-w-[12rem]" v-text="t('sharedTranscripts.groupShareNote')"></span>
+ </li>
+ </ul>
+ </div>
</div>
+ </section>
+ </div>
+
+ <!-- Shared with me -->
+ <div v-else>
+ <div v-if="sharesWithMe.length === 0" class="empty">
+ <div class="empty__icon"><i class="fas fa-inbox"></i></div>
+ <div class="empty__title" v-text="t('sharedTranscripts.nothingSharedWithMe')"></div>
</div>
+ <ul v-else class="space-y-2">
+ <li v-for="item in sharesWithMe" :key="item.share_id"
+ class="p-3 rounded-md border border-[var(--border-primary)] bg-[var(--bg-tertiary)] flex items-center justify-between gap-3">
+ <div class="min-w-0">
+ <a :href="'/recordings/' + item.recording_id" class="t-body-strong hover:underline block truncate" dir="auto" v-text="item.recording_title"></a>
+ <p class="t-meta">
+ <span v-if="item.owner_username" v-text="t('sharedTranscripts.fromOwner', { name: item.owner_username })"></span><span v-if="item.owner_username"> · </span>
+ <span v-text="item.can_edit ? t('sharedTranscripts.canEdit') : t('sharedTranscripts.canView')"></span>
+ <span v-if="item.source.type !== 'manual'"> · <i class="fas fa-users text-[10px]"></i> <span v-text="t(item.source.type === 'group_tag' ? 'sharedTranscripts.viaGroupTag' : 'sharedTranscripts.viaGroupFolder', { name: item.source.name || '' })"></span></span>
+ · ${ formatShareDate(item.created_at) }
+ </p>
+ </div>
+ <a :href="'/recordings/' + item.recording_id" class="btn btn--sm btn--ghost flex-shrink-0">
+ <i class="fas fa-external-link-alt"></i><span v-text="t('sharedTranscripts.open')"></span>
+ </a>
+ </li>
+ </ul>
</div>
</div>
</div>
diff --git a/tests/test_shares_overview.py b/tests/test_shares_overview.py
new file mode 100644
index 00000000..7a2b36b1
--- /dev/null
+++ b/tests/test_shares_overview.py
@@ -0,0 +1,112 @@
+"""Shared Transcripts list (#416).
+
+The list showed public links only; it predates internal sharing. The
+overview has what the user shared (public links, and recordings shared with
+people and groups, grouped by recording) and what was shared with them. A
+group share follows its tag and is not revoked from the list.
+
+SHARED-DB: users, shares, tags and recordings are removed afterwards.
+"""
+
+import os
+import secrets
+import sys
+
+import pytest
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from src.app import app, db
+from src.models import InternalShare, Recording, Share, Tag, User
+import src.api.shares as shares_api
+from tests.test_recording_sessions import _login
+
+app.config["WTF_CSRF_ENABLED"] = False
+
+
+def world(monkeypatch):
+ monkeypatch.setattr(shares_api, "ENABLE_INTERNAL_SHARING", True)
+ monkeypatch.setattr(shares_api, "SHOW_USERNAMES_IN_UI", True)
+ with app.app_context():
+ s = secrets.token_hex(4)
+ me = User(username=f"me_{s}", email=f"me_{s}@local.test", password="x")
+ ana = User(username=f"ana_{s}", email=f"ana_{s}@local.test", password="x")
+ bo = User(username=f"bo_{s}", email=f"bo_{s}@local.test", password="x")
+ db.session.add_all([me, ana, bo])
+ db.session.commit()
+ mine = Recording(user_id=me.id, title="Budget review", status="COMPLETED", original_filename="a.mp3")
+ theirs = Recording(user_id=ana.id, title="Ana's call", status="COMPLETED", original_filename="b.mp3")
+ db.session.add_all([mine, theirs])
+ db.session.commit()
+ tag = Tag(name=f"team_{s}", user_id=me.id)
+ db.session.add(tag)
+ db.session.commit()
+ db.session.add_all([
+ InternalShare(recording_id=mine.id, owner_id=me.id, shared_with_user_id=ana.id, can_edit=True),
+ InternalShare(recording_id=mine.id, owner_id=me.id, shared_with_user_id=bo.id,
+ source_type="group_tag", source_tag_id=tag.id),
+ InternalShare(recording_id=theirs.id, owner_id=ana.id, shared_with_user_id=me.id),
+ Share(recording_id=mine.id, user_id=me.id, share_summary=True, share_notes=False),
+ ])
+ db.session.commit()
+ ids = dict(me=me.id, ana=ana.id, bo=bo.id, mine=mine.id, theirs=theirs.id, tag=tag.id)
+ yield ids
+ db.session.rollback()
+ InternalShare.query.filter(InternalShare.recording_id.in_([ids["mine"], ids["theirs"]])).delete(synchronize_session=False)
+ Share.query.filter_by(user_id=ids["me"]).delete()
+ Recording.query.filter(Recording.id.in_([ids["mine"], ids["theirs"]])).delete(synchronize_session=False)
+ Tag.query.filter_by(id=ids["tag"]).delete()
+ User.query.filter(User.id.in_([ids["me"], ids["ana"], ids["bo"]])).delete(synchronize_session=False)
+ db.session.commit()
+
+
+def _overview(uid):
+ client = app.test_client()
+ with app.app_context():
+ _login(client, db.session.get(User, uid))
+ resp = client.get("/api/shares/overview")
+ assert resp.status_code == 200
+ return resp.get_json(), client
+
+
+def test_the_list_has_public_links_internal_shares_and_shared_with_me(world):
+ body, _ = _overview(world["me"])
+ assert body["internal_sharing_enabled"] is True
+ assert [link["recording_id"] for link in body["public_links"]] == [world["mine"]]
+ [entry] = body["shared_by_me"]
+ assert entry["recording_title"] == "Budget review"
+ people = {p["user_id"]: p for p in entry["recipients"]}
+ assert people[world["ana"]]["can_edit"] is True and people[world["ana"]]["revocable"] is True
+ assert people[world["bo"]]["source"]["type"] == "group_tag" and people[world["bo"]]["revocable"] is False
+ assert people[world["bo"]]["source"]["name"].startswith("team_")
+ [received] = body["shared_with_me"]
+ assert received["recording_id"] == world["theirs"] and received["owner_username"].startswith("ana_")
+
+
+def test_a_recipient_sees_it_under_shared_with_me(world):
+ body, _ = _overview(world["ana"])
+ assert [r["recording_id"] for r in body["shared_with_me"]] == [world["mine"]]
+ assert [e["recording_id"] for e in body["shared_by_me"]] == [world["theirs"]]
+
+
+def test_revoking_from_the_list_removes_the_person(world):
+ body, client = _overview(world["me"])
+ share_id = next(p["share_id"] for p in body["shared_by_me"][0]["recipients"] if p["user_id"] == world["ana"])
+ assert client.delete(f"/api/internal-shares/{share_id}").status_code == 200
+ body = client.get("/api/shares/overview").get_json()
+ assert [p["user_id"] for p in body["shared_by_me"][0]["recipients"]] == [world["bo"]]
+
+
+def test_without_internal_sharing_only_public_links(world, monkeypatch):
+ monkeypatch.setattr(shares_api, "ENABLE_INTERNAL_SHARING", False)
+ body, _ = _overview(world["me"])
+ assert body["internal_sharing_enabled"] is False
+ assert body["shared_by_me"] == [] and body["shared_with_me"] == []
+ assert len(body["public_links"]) == 1
+
+
+def test_owner_names_follow_the_username_setting(world, monkeypatch):
+ monkeypatch.setattr(shares_api, "SHOW_USERNAMES_IN_UI", False)
+ body, _ = _overview(world["me"])
+ assert body["shared_with_me"][0]["owner_username"] is None