Skip to content

Commit 51cc595

Browse files
committed
Merge branch 'dev' into main
2 parents f057dcd + f879daa commit 51cc595

13 files changed

Lines changed: 108 additions & 52 deletions

File tree

apps/app-server/src/websocket/groups/join-invitations/reject.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export async function rejectStep1({
4848
typeof baseProcedureStep1
4949
>): Promise<NotificationsResponse> {
5050
return await ctx.dataAbstraction.transaction(async (dtrx) => {
51-
// Assert that user is subscribed
52-
53-
await ctx.assertUserSubscribed({ userId: ctx.userId });
54-
5551
// Check pending invitation
5652

5753
if (

apps/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@deepnotes/client",
33
"description": "DeepNotes",
44
"homepage": "https://deepnotes.app",
5-
"version": "1.0.8",
5+
"version": "1.0.10",
66
"author": "Gustavo Toyota <gustavottoyota@gmail.com>",
77
"dependencies": {
88
"@_ueberdosis/prosemirror-tables": "1.1.3",

apps/client/quasar.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ module.exports = configure(function (ctx) {
348348
target: 'AppImage',
349349
},
350350

351-
...(false // true for NSIS, false for AppX
351+
...(env.NSIS === 'true'
352352
? {
353353
win: {
354354
target: 'nsis',
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Mon Aug 21 14:15:23 AMT 2023
2-
VERSION_CODE=52
1+
#Sun Oct 29 10:56:18 AMT 2023
2+
VERSION_CODE=61

apps/client/src/code/api-interface/pages/move.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export async function movePage(input: {
178178
return {
179179
pageId: input.pageId,
180180

181-
destGroupId: input.destGroupId,
181+
destGroupId: destGroupId,
182182
setAsMainPage: input.setAsMainPage,
183183

184184
groupCreation,

apps/client/src/code/pages/serialization.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ export class Serialization {
368368
noteCollab.editedAt = null;
369369
noteCollab.movedAt = null;
370370

371+
noteCollab.movable = true;
372+
371373
const noteId = nanoid();
372374

373375
noteMap.set(noteIndex, noteId);

apps/client/src/layouts/PagesLayout/RightSidebar/NoteProperties/NewPageDialog.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import {
133133
maxGroupNameLength,
134134
maxNameLength,
135135
maxPageTitleLength,
136+
rolesMap,
136137
} from '@deeplib/misc';
137138
import { BREAKPOINT_MD_MIN, sleep } from '@stdlib/misc';
138139
import { createPage } from 'src/code/api-interface/pages/create';
@@ -158,17 +159,25 @@ const pageRelativeTitleElem = ref<ComponentPublicInstance>();
158159
const realtimeCtx = useRealtimeContext();
159160
160161
const groupIds = ref<string[]>([]);
162+
const groupMemberRoles = ref<string[]>([]);
161163
162164
const groupOptions = computed(() => [
163165
{ id: 'new', name: '(New group)' },
164166
...groupIds.value
165-
.map((groupId) => {
167+
.map((groupId, groupIndex) => {
166168
if (
167169
realtimeCtx.hget('group', groupId, 'permanent-deletion-date') != null
168170
) {
169171
return;
170172
}
171173
174+
if (
175+
!rolesMap()[groupMemberRoles.value[groupIndex]]?.permissions
176+
.editGroupPages
177+
) {
178+
return;
179+
}
180+
172181
const groupName = groupNames()(groupId).get();
173182
174183
if (groupName.status === 'success') {
@@ -196,7 +205,6 @@ onMounted(async () => {
196205
// Initialize group IDs
197206
198207
groupIds.value = [page.value.react.groupId];
199-
destGroupId.value = page.value.react.groupId;
200208
201209
// Focus page title
202210
@@ -213,6 +221,16 @@ onMounted(async () => {
213221
authStore().userId,
214222
'recent-group-ids',
215223
)) ?? [page.value.react.groupId];
224+
225+
groupMemberRoles.value = await Promise.all(
226+
groupIds.value.map((groupId) =>
227+
internals.realtime.hget(
228+
'group-member',
229+
`${groupId}:${authStore().userId}`,
230+
'role',
231+
),
232+
),
233+
);
216234
})(),
217235
218236
(async () => {
@@ -223,6 +241,8 @@ onMounted(async () => {
223241
).text;
224242
})(),
225243
]);
244+
245+
destGroupId.value = page.value.react.groupId;
226246
});
227247
228248
async function _createPage() {

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/GroupSettingsDialog/PagesTab/PagesTab.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ const realtimeCtx = inject<RealtimeContext>('realtimeCtx')!;
130130
const basePageIds = inject<Ref<string[]>>('pageIds')!;
131131
const finalPageIds = computed(() =>
132132
basePageIds.value.filter(
133-
(pageId) => realtimeCtx.hget('page', pageId, 'group-id') === groupId,
133+
(pageId) =>
134+
realtimeCtx.hget('page', pageId, 'group-id') === groupId &&
135+
realtimeCtx.hget('page', pageId, 'permanent-deletion-date') == null,
134136
),
135137
);
136138

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/MovePageDialog.vue

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
</template>
114114

115115
<script setup lang="ts">
116-
import { maxGroupNameLength, maxNameLength } from '@deeplib/misc';
116+
import { maxGroupNameLength, maxNameLength, rolesMap } from '@deeplib/misc';
117117
import { BREAKPOINT_MD_MIN } from '@stdlib/misc';
118118
import type { movePage } from 'src/code/api-interface/pages/move';
119119
import { groupNames } from 'src/code/pages/computed/group-names';
@@ -130,6 +130,7 @@ const dialogRef = ref() as Ref<InstanceType<typeof CustomDialog>>;
130130
const horizontal = computed(() => uiStore().width >= BREAKPOINT_MD_MIN);
131131
132132
const groupIds = ref<string[]>([]);
133+
const groupMemberRoles = ref<string[]>([]);
133134
const destGroupId = ref<string>();
134135
135136
const setAsMainPage = ref(false);
@@ -151,13 +152,20 @@ const realtimeCtx = useRealtimeContext();
151152
const groupOptions = computed(() => [
152153
{ id: 'new', name: '(New group)' },
153154
...groupIds.value
154-
.map((groupId) => {
155+
.map((groupId, groupIndex) => {
155156
if (
156157
realtimeCtx.hget('group', groupId, 'permanent-deletion-date') != null
157158
) {
158159
return;
159160
}
160161
162+
if (
163+
!rolesMap()[groupMemberRoles.value[groupIndex]]?.permissions
164+
.editGroupPages
165+
) {
166+
return;
167+
}
168+
161169
const groupName = groupNames()(groupId).get();
162170
163171
if (groupName.status === 'success') {
@@ -169,7 +177,6 @@ const groupOptions = computed(() => [
169177
170178
onMounted(async () => {
171179
groupIds.value = [props.groupId];
172-
destGroupId.value = props.groupId;
173180
174181
await Promise.all([
175182
(async () => {
@@ -178,12 +185,24 @@ onMounted(async () => {
178185
authStore().userId,
179186
'recent-group-ids',
180187
)) ?? [props.groupId];
188+
189+
groupMemberRoles.value = await Promise.all(
190+
groupIds.value.map((groupId) =>
191+
internals.realtime.hget(
192+
'group-member',
193+
`${groupId}:${authStore().userId}`,
194+
'role',
195+
),
196+
),
197+
);
181198
})(),
182199
183200
(async () => {
184201
groupMemberName.value = await selfUserName().getAsync();
185202
})(),
186203
]);
204+
205+
destGroupId.value = props.groupId;
187206
});
188207
189208
async function _movePage() {

apps/manager/src/index.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,50 @@
11
import './env';
22

3+
import readline from 'readline';
4+
5+
import { dataAbstraction } from './data/data-abstraction';
36
import { initKnex } from './data/knex';
47

58
initKnex();
69

7-
// Write code here
10+
const readlineInterface = readline.createInterface({
11+
input: process.stdin,
12+
output: process.stdout,
13+
});
14+
15+
async function handleCommand(command: string) {
16+
const [commandName, ...args] = command.split(' ');
17+
18+
switch (commandName) {
19+
case 'help':
20+
console.log('Commands:');
21+
console.log('- hget <prefix> <suffix> <field>');
22+
console.log('- hset <prefix> <suffix> <field> <value>');
23+
break;
24+
case 'hget':
25+
console.log(
26+
await dataAbstraction().hget(args[0] as any, args[1], args[2]),
27+
);
28+
break;
29+
case 'hset':
30+
await dataAbstraction().hmset(args[0] as any, args[1], {
31+
[args[2]]: args[3],
32+
});
33+
break;
34+
}
35+
}
36+
37+
function requestCommand() {
38+
readlineInterface.question('', async (command) => {
39+
if (command === 'exit') {
40+
readlineInterface.close();
41+
return;
42+
}
43+
44+
await handleCommand(command);
45+
46+
requestCommand();
47+
});
48+
}
49+
50+
requestCommand();

0 commit comments

Comments
 (0)