Skip to content

Commit 4c096f2

Browse files
authored
Remove file sharing UI and related code (#2817)
RIP . . . for now!
1 parent 23f4553 commit 4c096f2

11 files changed

Lines changed: 145 additions & 1091 deletions

src/gui/src/IPC.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,6 @@ const ipc_listener = async (event, handled) => {
14991499
modified: res.modified,
15001500
type: res.type,
15011501
is_dir: false,
1502-
is_shared: res.is_shared,
15031502
suggested_apps: res.suggested_apps,
15041503
});
15051504
// sort each window

src/gui/src/UI/Dashboard/TabFiles.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,6 @@ const TabFiles = {
19821982
const metadata = JSON.parse(file.metadata) || {};
19831983
const displayName = metadata.original_name || file.name;
19841984
let website_url = window.determine_website_url(file.path);
1985-
const is_shared_with_me = (file.path !== `/${window.user.username}` && !file.path.startsWith(`/${window.user.username}/`));
19861985
const is_worker = file.workers?.length > 0;
19871986
const worker_url = is_worker ? file.workers[0]?.address : '';
19881987
const iconResult = await item_icon(file);
@@ -2026,21 +2025,6 @@ const TabFiles = {
20262025
src="${html_encode(window.icons['link.svg'])}"
20272026
data-item-id="${item_id}"
20282027
>
2029-
<img class="item-badge item-badge-has-permission"
2030-
style="display: ${ is_shared_with_me ? 'block' : 'none'};
2031-
background-color: #ffffff;
2032-
padding: 2px;" src="${html_encode(window.icons['shared.svg'])}"
2033-
data-item-id="${item_id}"
2034-
title="A user has shared this item with you."
2035-
/>
2036-
<img class="item-badge item-is-shared"
2037-
style="background-color: #ffffff; padding: 2px; ${!is_shared_with_me && file.is_shared ? 'display:block;' : ''}"
2038-
src="${html_encode(window.icons['owner-shared.svg'])}"
2039-
data-item-id="${item_id}"
2040-
data-item-uid="${file.uid}"
2041-
data-item-path="${html_encode(file.path)}"
2042-
title="You have shared this item with at least one other user."
2043-
/>
20442028
<img class="item-badge item-shortcut"
20452029
style="background-color: #ffffff; padding: 2px; ${file.is_shortcut !== 0 ? 'display:block;' : ''}"
20462030
src="${html_encode(window.icons['shortcut.svg'])}"

src/gui/src/UI/UIDesktop.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,11 @@ async function UIDesktop (options) {
193193
*/
194194
window.socket.on('notif.message', async ({ uid, notification }) => {
195195
let icon = window.icons[notification.icon];
196-
let round_icon = false;
197-
198-
if ( notification.template === 'file-shared-with-you' && notification.fields?.username ) {
199-
let profile_pic = await get_profile_picture(notification.fields?.username);
200-
if ( profile_pic ) {
201-
icon = profile_pic;
202-
round_icon = true;
203-
}
204-
}
205196

206197
UINotification({
207198
title: notification.title,
208199
text: notification.text,
209200
icon: icon,
210-
round_icon: round_icon,
211201
value: notification,
212202
uid,
213203
close: async () => {
@@ -220,18 +210,6 @@ async function UIDesktop (options) {
220210
body: JSON.stringify({ uid }),
221211
});
222212
},
223-
click: async (notif) => {
224-
if ( notification.template === 'file-shared-with-you' ) {
225-
let item_path = `/${ notification.fields.username}`;
226-
UIWindow({
227-
path: `/${ notification.fields.username}`,
228-
title: path.basename(item_path),
229-
icon: await item_icon({ is_dir: true, path: item_path }),
230-
is_dir: true,
231-
app: 'explorer',
232-
});
233-
}
234-
},
235213
});
236214
});
237215

@@ -251,19 +229,9 @@ async function UIDesktop (options) {
251229
for ( const notif_info of unreads ) {
252230
const notification = notif_info.notification;
253231
let icon = window.icons[notification.icon];
254-
let round_icon = false;
255-
256-
if ( notification.template === 'file-shared-with-you' && notification.fields?.username ) {
257-
let profile_pic = await get_profile_picture(notification.fields?.username);
258-
if ( profile_pic ) {
259-
icon = profile_pic;
260-
round_icon = true;
261-
}
262-
}
263232

264233
UINotification({
265234
icon,
266-
round_icon,
267235
title: notification.title,
268236
text: notification.text ?? notification.title,
269237
uid: notif_info.uid,
@@ -279,18 +247,6 @@ async function UIDesktop (options) {
279247
}),
280248
});
281249
},
282-
click: async (notif) => {
283-
if ( notification.template === 'file-shared-with-you' ) {
284-
let item_path = `/${ notification.fields?.username}`;
285-
UIWindow({
286-
path: `/${ notification.fields?.username}`,
287-
title: path.basename(item_path),
288-
icon: await item_icon({ is_dir: true, path: item_path }),
289-
is_dir: true,
290-
app: 'explorer',
291-
});
292-
}
293-
},
294250
});
295251
}
296252
});
@@ -451,8 +407,6 @@ async function UIDesktop (options) {
451407
}
452408

453409
if ( dest_path === window.trash_path ) {
454-
$(`.item[data-uid="${fsentry.uid}"]`).find('.item-is-shared').fadeOut(300);
455-
456410
// if trashing dir...
457411
if ( fsentry.is_dir ) {
458412
// remove website badge
@@ -486,7 +440,6 @@ async function UIDesktop (options) {
486440
type: fsentry.type,
487441
modified: fsentry.modified,
488442
is_selected: false,
489-
is_shared: (dest_path === window.trash_path) ? false : fsentry.is_shared,
490443
is_shortcut: fsentry.is_shortcut,
491444
shortcut_to: fsentry.shortcut_to,
492445
shortcut_to_path: fsentry.shortcut_to_path,
@@ -514,7 +467,6 @@ async function UIDesktop (options) {
514467
modified: dir.modified,
515468
is_dir: true,
516469
is_selected: false,
517-
is_shared: dir.is_shared,
518470
has_website: false,
519471
});
520472
}
@@ -647,7 +599,6 @@ async function UIDesktop (options) {
647599
'data-name': item.name,
648600
'data-size': item.size,
649601
'data-modified': item.modified,
650-
'data-is_shared': item.is_shared,
651602
'data-type': item.type,
652603
});
653604
// set new icon
@@ -672,7 +623,6 @@ async function UIDesktop (options) {
672623
type: item.type,
673624
modified: item.modified,
674625
is_dir: item.is_dir,
675-
is_shared: item.is_shared,
676626
is_shortcut: item.is_shortcut,
677627
shortcut_to: item.shortcut_to,
678628
shortcut_to_path: item.shortcut_to_path,

src/gui/src/UI/UIItem.js

Lines changed: 5 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919

20-
import UIWindowShare from './UIWindowShare.js';
2120
import UIWindowPublishWebsite from './UIWindowPublishWebsite.js';
2221
import UIWindowItemProperties from './UIWindowItemProperties.js';
2322
import UIWindowSaveAccount from './UIWindowSaveAccount.js';
@@ -127,7 +126,6 @@ async function UIItem (options) {
127126
options.visible = options.visible ?? 'visible'; // one of 'visible', 'revealed', 'hidden'
128127
options.is_dir = options.is_dir ?? false;
129128
options.is_selected = options.is_selected ?? false;
130-
options.is_shared = options.is_shared ?? false;
131129
options.is_shortcut = options.is_shortcut ?? 0;
132130
options.is_trash = options.is_trash ?? false;
133131
options.metadata = options.metadata ?? '';
@@ -136,7 +134,6 @@ async function UIItem (options) {
136134
options.shortcut_to_path = options.shortcut_to_path ?? '';
137135
options.immutable = (options.immutable === false || options.immutable === 0 || options.immutable === undefined ? 0 : 1);
138136
options.sort_container_after_append = (options.sort_container_after_append !== undefined ? options.sort_container_after_append : false);
139-
const is_shared_with_me = (options.path !== `/${window.user.username}` && !options.path.startsWith(`/${window.user.username}/`));
140137
const workers = Array.isArray(options.workers) ? options.workers : [];
141138
const is_worker = !options.is_dir && workers.length > 0;
142139
const worker_url = is_worker ? workers[0].address : '';
@@ -221,22 +218,6 @@ async function UIItem (options) {
221218
data-item-id="${item_id}"
222219
>`;
223220

224-
// shared badge
225-
h += `<img class="item-badge item-badge-has-permission"
226-
style="display: ${ is_shared_with_me ? 'block' : 'none'};
227-
background-color: #ffffff;
228-
padding: 2px;" src="${html_encode(window.icons['shared.svg'])}"
229-
data-item-id="${item_id}"
230-
title="${i18n('item_shared_with_you')}">`;
231-
// owner-shared badge
232-
h += `<img class="item-badge item-is-shared"
233-
style="background-color: #ffffff; padding: 2px; ${!is_shared_with_me && options.is_shared ? 'display:block;' : ''}"
234-
src="${html_encode(window.icons['owner-shared.svg'])}"
235-
data-item-id="${item_id}"
236-
data-item-uid="${options.uid}"
237-
data-item-path="${html_encode(options.path)}"
238-
title="${i18n('item_shared_by_you')}"
239-
>`;
240221
// shortcut badge
241222
h += `<img class="item-badge item-shortcut"
242223
style="background-color: #ffffff; padding: 2px; ${options.is_shortcut !== 0 ? 'display:block;' : ''}"
@@ -966,34 +947,6 @@ async function UIItem (options) {
966947
menu_items.push('-');
967948
}
968949
if ( ! are_trashed ) {
969-
menu_items.push({
970-
html: i18n('Share With…'),
971-
onClick: async function () {
972-
if ( window.user.is_temp &&
973-
!await UIWindowSaveAccount({
974-
send_confirmation_code: true,
975-
message: 'Please create an account to proceed.',
976-
window_options: {
977-
backdrop: true,
978-
close_on_backdrop_click: false,
979-
},
980-
}) )
981-
{
982-
return;
983-
}
984-
else if ( !window.user.email_confirmed && !await UIWindowEmailConfirmationRequired() )
985-
{
986-
return;
987-
}
988-
989-
let items = [];
990-
$selected_items.each(function () {
991-
const ell = this;
992-
items.push({ uid: $(ell).attr('data-uid'), path: $(ell).attr('data-path'), icon: $(ell).find('.item-icon img').attr('src'), name: $(ell).attr('data-name') });
993-
});
994-
UIWindowShare(items);
995-
},
996-
});
997950
// -------------------------------------------
998951
// Open in AI
999952
// -------------------------------------------
@@ -1150,15 +1103,14 @@ async function UIItem (options) {
11501103
if ( !are_trashed && window.feature_flags.create_shortcut ) {
11511104
menu_items.push({
11521105
html: i18n('create_shortcut'),
1153-
html: is_shared_with_me ? i18n('create_desktop_shortcut_s') : i18n('create_shortcut_s'),
1106+
html: i18n('create_shortcut_s'),
11541107
onClick: async function () {
11551108
$selected_items.each(function () {
11561109
let base_dir = path.dirname($(this).attr('data-path'));
11571110
// Trash on Desktop is a special case
11581111
if ( $(this).attr('data-path') && $(this).closest('.item-container').attr('data-path') === window.desktop_path ) {
11591112
base_dir = window.desktop_path;
11601113
}
1161-
if ( is_shared_with_me ) base_dir = window.desktop_path;
11621114
// create shortcut
11631115
window.create_shortcut(
11641116
path.basename($(this).attr('data-path')),
@@ -1316,35 +1268,9 @@ async function UIItem (options) {
13161268
}
13171269
}
13181270
// -------------------------------------------
1319-
// Share With…
1271+
// Open in AI
13201272
// -------------------------------------------
13211273
if ( !is_trashed && !is_trash ) {
1322-
menu_items.push({
1323-
html: i18n('Share With…'),
1324-
onClick: async function () {
1325-
if ( window.user.is_temp &&
1326-
!await UIWindowSaveAccount({
1327-
send_confirmation_code: true,
1328-
message: 'Please create an account to proceed.',
1329-
window_options: {
1330-
backdrop: true,
1331-
close_on_backdrop_click: false,
1332-
},
1333-
}) )
1334-
{
1335-
return;
1336-
}
1337-
else if ( !window.user.email_confirmed && !await UIWindowEmailConfirmationRequired() )
1338-
{
1339-
return;
1340-
}
1341-
1342-
UIWindowShare([{ uid: $(el_item).attr('data-uid'), path: $(el_item).attr('data-path'), name: $(el_item).attr('data-name'), icon: $(el_item_icon).find('img').attr('src') }]);
1343-
},
1344-
});
1345-
// -------------------------------------------
1346-
// Open in AI
1347-
// -------------------------------------------
13481274
menu_items.push({
13491275
html: i18n('open_in_ai'),
13501276
onClick: async function () {
@@ -1573,7 +1499,7 @@ async function UIItem (options) {
15731499
// -------------------------------------------
15741500
// Cut
15751501
// -------------------------------------------
1576-
if ( $(el_item).attr('data-immutable') === '0' && !is_shared_with_me ) {
1502+
if ( $(el_item).attr('data-immutable') === '0' ) {
15771503
menu_items.push({
15781504
html: i18n('cut'),
15791505
onClick: function () {
@@ -1624,16 +1550,14 @@ async function UIItem (options) {
16241550
// -------------------------------------------
16251551
if ( !is_trashed && window.feature_flags.create_shortcut ) {
16261552
menu_items.push({
1627-
html: is_shared_with_me ? i18n('create_desktop_shortcut') : i18n('create_shortcut'),
1553+
html: i18n('create_shortcut'),
16281554
onClick: async function () {
16291555
let base_dir = path.dirname($(el_item).attr('data-path'));
16301556
// Trash on Desktop is a special case
16311557
if ( $(el_item).attr('data-path') && $(el_item).closest('.item-container').attr('data-path') === window.desktop_path ) {
16321558
base_dir = window.desktop_path;
16331559
}
16341560

1635-
if ( is_shared_with_me ) base_dir = window.desktop_path;
1636-
16371561
window.create_shortcut(
16381562
path.basename($(el_item).attr('data-path')),
16391563
options.is_dir,
@@ -1648,7 +1572,7 @@ async function UIItem (options) {
16481572
// -------------------------------------------
16491573
// Delete
16501574
// -------------------------------------------
1651-
if ( $(el_item).attr('data-immutable') === '0' && !is_trashed && !is_shared_with_me ) {
1575+
if ( $(el_item).attr('data-immutable') === '0' && !is_trashed ) {
16521576
menu_items.push({
16531577
html: i18n('delete'),
16541578
onClick: async function () {

0 commit comments

Comments
 (0)