New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@brightspace-hmc/siren-sdk

Package Overview
Dependencies
Maintainers
2
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightspace-hmc/siren-sdk - npm Package Compare versions

Comparing version 2.65.0 to 2.66.0

src/activities/discussions/NamedEntity.js

2

package.json
{
"name": "@brightspace-hmc/siren-sdk",
"version": "2.65.0",
"version": "2.66.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "",

@@ -1,4 +0,5 @@

import { Actions } from '../../hypermedia-constants.js';
import { Actions, Classes } from '../../hypermedia-constants.js';
import { Entity } from '../../es6/Entity.js';
import { performSirenAction } from '../../es6/SirenAction.js';
import { RestrictedTopicCollectionEntity } from './RestrictedTopicCollectionEntity.js';

@@ -44,2 +45,61 @@ export class GroupSectionRestrictionActionsEntity extends Entity {

}
restrictedTopicCollection() {
if (!this._entity) return null;
const subEntity = this._entity.getSubEntityByClass(Classes.discussions.restrictedTopic);
if (!subEntity) {
return null;
}
return new RestrictedTopicCollectionEntity(subEntity);
}
canToggleGroupsRestrictedTopic() {
if (!this._entity) return null;
const subEntity = this._entity.getSubEntityByClass(Classes.discussions.restrictedTopic);
return subEntity && subEntity.hasActionByName(Actions.discussions.groupSectionRestrictions.toggleGroupsRestrictedTopic);
}
_formatToggleGroupsRestrictedTopicAction(toggleGroupIds) {
if (!toggleGroupIds) return;
if (!this.canToggleGroupsRestrictedTopic()) return;
const subEntity = this._entity.getSubEntityByClass(Classes.discussions.restrictedTopic);
const action = subEntity.getActionByName(Actions.discussions.groupSectionRestrictions.toggleGroupsRestrictedTopic);
const fields = toggleGroupIds.map(id => {
return { name: 'toggleGroupIds', value: id };
});
return { action, fields };
}
_restrictedTopicToggle(selectedIds) {
const outputToggle = [];
const oldRestrictedTopicCollection = this.restrictedTopicCollection().getRestrictedTopics();
if (!oldRestrictedTopicCollection) return;
const newRestrictedTopicMap = {};
selectedIds.forEach(ids => {
newRestrictedTopicMap[ids] = ids;
});
oldRestrictedTopicCollection.forEach(oldTopic => {
const oldTopicId = oldTopic.id();
const newIsSelected = newRestrictedTopicMap[oldTopicId] !== undefined;
if (oldTopic.isSelected() !== newIsSelected) {
outputToggle.push(oldTopicId);
}
});
return outputToggle;
}
async toggleGroupsRestrictedTopic(selectedIds) {
if (!selectedIds) return;
if (!this.canToggleGroupsRestrictedTopic()) return;
const toggleGroupIds = this._restrictedTopicToggle(selectedIds);
const sirenAction = this._formatToggleGroupsRestrictedTopicAction(toggleGroupIds);
if (!sirenAction) return;
const { action, fields } = sirenAction;
performSirenAction(this._token, action, fields);
}
}

@@ -394,2 +394,3 @@ export const Rels = {

section: 'section',
selected: 'selected',
allGroups: 'all-groups',

@@ -737,3 +738,4 @@ allSections: 'all-sections'

setToRestrictedTopic: 'set-to-restricted-topic',
setToRestrictedThreads: 'set-to-restricted-threads'
setToRestrictedThreads: 'set-to-restricted-threads',
toggleGroupsRestrictedTopic: 'toggle-groups-restricted-topic'
}

@@ -740,0 +742,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc