113113</template >
114114
115115<script setup lang="ts">
116- import { maxGroupNameLength , maxNameLength } from ' @deeplib/misc' ;
116+ import { maxGroupNameLength , maxNameLength , rolesMap } from ' @deeplib/misc' ;
117117import { BREAKPOINT_MD_MIN } from ' @stdlib/misc' ;
118118import type { movePage } from ' src/code/api-interface/pages/move' ;
119119import { groupNames } from ' src/code/pages/computed/group-names' ;
@@ -130,6 +130,7 @@ const dialogRef = ref() as Ref<InstanceType<typeof CustomDialog>>;
130130const horizontal = computed (() => uiStore ().width >= BREAKPOINT_MD_MIN );
131131
132132const groupIds = ref <string []>([]);
133+ const groupMemberRoles = ref <string []>([]);
133134const destGroupId = ref <string >();
134135
135136const setAsMainPage = ref (false );
@@ -151,13 +152,20 @@ const realtimeCtx = useRealtimeContext();
151152const 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
170178onMounted (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
189208async function _movePage() {
0 commit comments