Skip to content

Commit

Permalink
Revert "Disable mention_all permission til users upgraded (#4423)"
Browse files Browse the repository at this point in the history
This reverts commit 715057f.

# Conflicts:
#	frontend/openchat-agent/src/services/user/candid/idl.d.ts
  • Loading branch information
megrogan committed Sep 28, 2023
1 parent b45294e commit fa8d4cd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{roles}
label={$_("permissions.replyInThread")}
bind:rolePermission={permissions.replyInThread} />
<!-- <SelectPermissionRole
<SelectPermissionRole
{roles}
label={$_("permissions.mentionAllMembers", { values: { mention: "@everyone" } })}
bind:rolePermission={permissions.mentionAllMembers} /> -->
bind:rolePermission={permissions.mentionAllMembers} />
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$: partitioned = partitionPermissions(permissions);
function filterPermissions([key, _]: PermissionsEntry): boolean {
if ((isPublic && key === "inviteUsers") || key === "mentionAllMembers") {
if (isPublic && key === "inviteUsers") {
return false;
}
return true;
Expand Down
17 changes: 0 additions & 17 deletions frontend/openchat-agent/src/services/common/chatMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import type {
ApiTotalPollVotes,
ApiPollConfig,
ApiGroupPermissions,
ApiGroupPermissionsReduced,
ApiPermissionRole,
ApiGiphyContent,
ApiGiphyImageVariant,
Expand Down Expand Up @@ -854,22 +853,6 @@ export function groupPermissions(candid: ApiGroupPermissions): ChatPermissions {
};
}

export function groupPermissionsReduced(candid: ApiGroupPermissionsReduced): ChatPermissions {
return {
changeRoles: permissionRole(candid.change_roles),
updateGroup: permissionRole(candid.update_group),
inviteUsers: permissionRole(candid.invite_users),
removeMembers: permissionRole(candid.remove_members),
deleteMessages: permissionRole(candid.delete_messages),
pinMessages: permissionRole(candid.pin_messages),
createPolls: permissionRole(candid.create_polls),
sendMessages: permissionRole(candid.send_messages),
reactToMessages: permissionRole(candid.react_to_messages),
replyInThread: permissionRole(candid.reply_in_thread),
mentionAllMembers: "admin",
};
}

export function communityPermissions(candid: ApiCommunityPermissions): CommunityPermissions {
return {
changeRoles: communityPermissionRole(candid.change_roles),
Expand Down
2 changes: 0 additions & 2 deletions frontend/openchat-agent/src/services/user/candid/idl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ import {
DeleteCommunityResponse,
ArchiveUnarchiveChatsResponse,
SetCommunityIndexesResponse,
GroupPermissionsReduced,
TipMessageResponse
} from "./types";
export {
Expand Down Expand Up @@ -272,7 +271,6 @@ export {
DeleteCommunityResponse as ApiDeleteCommunityResponse,
ArchiveUnarchiveChatsResponse as ApiArchiveUnarchiveChatsResponse,
SetCommunityIndexesResponse as ApiSetCommunityIndexesResponse,
GroupPermissionsReduced as ApiGroupPermissionsReduced,
TipMessageResponse as ApiTipMessageResponse
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/openchat-agent/src/services/user/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ import {
chatMetrics,
completedCryptoTransfer,
accessGate,
groupPermissions,
message,
messageContent,
groupPermissionsReduced,
} from "../common/chatMappers";
import { ensureReplicaIsUpToDate } from "../common/replicaUpToDateChecker";
import { ReplicaNotUpToDateError } from "../error";
Expand Down Expand Up @@ -797,7 +797,7 @@ function groupChatSummary(candid: ApiGroupChatSummary): GroupChatSummary {
canisterId: candid.chat_id.toString(),
})),
memberCount: candid.participant_count,
permissions: groupPermissionsReduced(candid.permissions),
permissions: groupPermissions(candid.permissions),
metrics: chatMetrics(candid.metrics),
subtype: optional(candid.subtype, apiGroupSubtype),
previewed: false,
Expand Down

0 comments on commit fa8d4cd

Please sign in to comment.