@plusscommunities/pluss-circles-web-groups 1.5.7-beta.0 → 1.5.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +164 -51
- package/dist/index.esm.js +164 -51
- package/dist/index.umd.js +164 -51
- package/package.json +1 -1
- package/src/apis/circleActions.js +10 -0
- package/src/screens/Circle.js +9 -0
- package/src/screens/Circles.js +47 -0
package/dist/index.esm.js
CHANGED
|
@@ -21,30 +21,30 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
21
21
|
import { faUserGroup, faMessage, faUserTie, faUsers, faUsersRectangle, faPeopleArrows } from '@fortawesome/free-solid-svg-icons';
|
|
22
22
|
|
|
23
23
|
var values = {
|
|
24
|
-
featureKey: '
|
|
25
|
-
entityKey: '
|
|
26
|
-
entityName: '
|
|
27
|
-
serviceKey: '
|
|
28
|
-
permission: '
|
|
29
|
-
menuIcon: '
|
|
24
|
+
featureKey: 'groups',
|
|
25
|
+
entityKey: 'group',
|
|
26
|
+
entityName: 'group',
|
|
27
|
+
serviceKey: 'groups',
|
|
28
|
+
permission: 'groups',
|
|
29
|
+
menuIcon: 'comments',
|
|
30
30
|
isFontAwesome: true,
|
|
31
|
-
reducerKey: '
|
|
32
|
-
actionCircleKey: '
|
|
33
|
-
textFeatureTitle: '
|
|
34
|
-
textAddMenuTitle: '
|
|
35
|
-
textEmptyGroups: "You aren't in any
|
|
31
|
+
reducerKey: 'groups',
|
|
32
|
+
actionCircleKey: 'GROUP',
|
|
33
|
+
textFeatureTitle: 'Groups',
|
|
34
|
+
textAddMenuTitle: 'Group',
|
|
35
|
+
textEmptyGroups: "You aren't in any Groups",
|
|
36
36
|
textEmptyPeople: 'Contacts will show here',
|
|
37
|
-
componentCircles: '
|
|
38
|
-
componentAddCircle: '
|
|
39
|
-
componentCircle: '
|
|
40
|
-
inviteKey: '
|
|
41
|
-
messageKey: '
|
|
42
|
-
chatRoute: '
|
|
43
|
-
updateKeyUserCircles: '
|
|
44
|
-
allowPublicKey: '
|
|
45
|
-
allowPublicKeyDefault:
|
|
37
|
+
componentCircles: 'Groups',
|
|
38
|
+
componentAddCircle: 'AddGroup',
|
|
39
|
+
componentCircle: 'Group',
|
|
40
|
+
inviteKey: 'groupInvite',
|
|
41
|
+
messageKey: 'groupMessage',
|
|
42
|
+
chatRoute: 'groupChat',
|
|
43
|
+
updateKeyUserCircles: 'userGroups',
|
|
44
|
+
allowPublicKey: 'groupAllowPublicGroups',
|
|
45
|
+
allowPublicKeyDefault: true,
|
|
46
46
|
settings: {
|
|
47
|
-
allowAnyCreate:
|
|
47
|
+
allowAnyCreate: true
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -333,6 +333,35 @@ var circleActions = {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
return deleteMessage;
|
|
336
|
+
}(),
|
|
337
|
+
markAsRead: function () {
|
|
338
|
+
var _markAsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(circleId, userId) {
|
|
339
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
340
|
+
while (1) {
|
|
341
|
+
switch (_context4.prev = _context4.next) {
|
|
342
|
+
case 0:
|
|
343
|
+
return _context4.abrupt("return", Session$4.authedFunction({
|
|
344
|
+
method: 'post',
|
|
345
|
+
url: Helper$3.getUrl('notifications', 'resetunread'),
|
|
346
|
+
data: {
|
|
347
|
+
groupID: circleId,
|
|
348
|
+
userID: userId
|
|
349
|
+
}
|
|
350
|
+
}));
|
|
351
|
+
|
|
352
|
+
case 1:
|
|
353
|
+
case "end":
|
|
354
|
+
return _context4.stop();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, _callee4);
|
|
358
|
+
}));
|
|
359
|
+
|
|
360
|
+
function markAsRead(_x9, _x10) {
|
|
361
|
+
return _markAsRead.apply(this, arguments);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return markAsRead;
|
|
336
365
|
}()
|
|
337
366
|
};
|
|
338
367
|
|
|
@@ -404,6 +433,12 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
404
433
|
})));
|
|
405
434
|
});
|
|
406
435
|
|
|
436
|
+
_defineProperty(_assertThisInitialized(_this), "selectUnreadFilter", function (showUnreadOnly) {
|
|
437
|
+
_this.setState({
|
|
438
|
+
showUnreadOnly: showUnreadOnly
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
|
|
407
442
|
_defineProperty(_assertThisInitialized(_this), "canAddNew", function () {
|
|
408
443
|
var auth = _this.props.auth;
|
|
409
444
|
return Session$3.validateAccess(auth.site, values.permission, auth);
|
|
@@ -516,7 +551,9 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
516
551
|
|
|
517
552
|
_this.state = {
|
|
518
553
|
userSearch: "",
|
|
519
|
-
sortBy: "newest"
|
|
554
|
+
sortBy: "newest",
|
|
555
|
+
showUnreadOnly: false,
|
|
556
|
+
pollingInterval: null
|
|
520
557
|
};
|
|
521
558
|
return _this;
|
|
522
559
|
}
|
|
@@ -524,25 +561,60 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
524
561
|
_createClass(Circles, [{
|
|
525
562
|
key: "componentDidMount",
|
|
526
563
|
value: function componentDidMount() {
|
|
527
|
-
this
|
|
564
|
+
var _this2 = this;
|
|
565
|
+
|
|
566
|
+
this.getData(); // Poll for updates every 10 seconds
|
|
567
|
+
|
|
568
|
+
this.pollingInterval = setInterval(function () {
|
|
569
|
+
_this2.getData();
|
|
570
|
+
}, 10000);
|
|
571
|
+
}
|
|
572
|
+
}, {
|
|
573
|
+
key: "componentWillUnmount",
|
|
574
|
+
value: function componentWillUnmount() {
|
|
575
|
+
if (this.pollingInterval) {
|
|
576
|
+
clearInterval(this.pollingInterval);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "isCircleUnread",
|
|
581
|
+
value: function isCircleUnread(circle) {
|
|
582
|
+
var userId = this.props.user.Id;
|
|
583
|
+
|
|
584
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return circle.Unread[userId] > 0;
|
|
589
|
+
}
|
|
590
|
+
}, {
|
|
591
|
+
key: "getUnreadCount",
|
|
592
|
+
value: function getUnreadCount(circle) {
|
|
593
|
+
var userId = this.props.user.Id;
|
|
594
|
+
|
|
595
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
596
|
+
return 0;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return circle.Unread[userId];
|
|
528
600
|
}
|
|
529
601
|
}, {
|
|
530
602
|
key: "getCircles",
|
|
531
603
|
value: function getCircles() {
|
|
532
|
-
var
|
|
604
|
+
var _this3 = this;
|
|
533
605
|
|
|
534
606
|
var result = this.props.circles;
|
|
535
607
|
|
|
536
608
|
if (this.state.selectedTypeFilter) {
|
|
537
609
|
result = _.filter(result, function (circle) {
|
|
538
|
-
return
|
|
610
|
+
return _this3.state.selectedTypeFilter === "circle" ? !circle.IsPrivate : circle.IsPrivate;
|
|
539
611
|
});
|
|
540
612
|
}
|
|
541
613
|
|
|
542
614
|
if (this.state.selectedUserFilter) {
|
|
543
615
|
result = _.filter(result, function (circle) {
|
|
544
616
|
return _.some(circle.Audience, function (user) {
|
|
545
|
-
return user.userId ===
|
|
617
|
+
return user.userId === _this3.state.selectedUserFilter.userId;
|
|
546
618
|
});
|
|
547
619
|
});
|
|
548
620
|
} // Apply sorting
|
|
@@ -554,6 +626,12 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
554
626
|
|
|
555
627
|
if (this.state.sortBy === "newest") {
|
|
556
628
|
result.reverse();
|
|
629
|
+
|
|
630
|
+
if (this.state.showUnreadOnly) {
|
|
631
|
+
result = _.filter(result, function (circle) {
|
|
632
|
+
return _this3.isCircleUnread(circle);
|
|
633
|
+
});
|
|
634
|
+
}
|
|
557
635
|
}
|
|
558
636
|
|
|
559
637
|
return result;
|
|
@@ -561,7 +639,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
561
639
|
}, {
|
|
562
640
|
key: "getUsers",
|
|
563
641
|
value: function getUsers() {
|
|
564
|
-
var
|
|
642
|
+
var _this4 = this;
|
|
565
643
|
|
|
566
644
|
var users = [];
|
|
567
645
|
this.props.circles.forEach(function (circle) {
|
|
@@ -573,8 +651,8 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
573
651
|
return user.userId;
|
|
574
652
|
}), "displayName");
|
|
575
653
|
return _.filter(users, function (u) {
|
|
576
|
-
if (!_.isEmpty(
|
|
577
|
-
return (u.displayName || "").toLowerCase().indexOf(
|
|
654
|
+
if (!_.isEmpty(_this4.state.userSearch)) {
|
|
655
|
+
return (u.displayName || "").toLowerCase().indexOf(_this4.state.userSearch.toLowerCase()) > -1;
|
|
578
656
|
}
|
|
579
657
|
|
|
580
658
|
return true;
|
|
@@ -583,7 +661,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
583
661
|
}, {
|
|
584
662
|
key: "validateCircleAdmin",
|
|
585
663
|
value: function validateCircleAdmin(circle, onlyCreator) {
|
|
586
|
-
var
|
|
664
|
+
var _this5 = this;
|
|
587
665
|
|
|
588
666
|
if (Session$3.validateAccess(this.props.auth.site, values.permission, this.props.auth)) {
|
|
589
667
|
return true;
|
|
@@ -594,13 +672,13 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
594
672
|
}
|
|
595
673
|
|
|
596
674
|
return _.some(circle.Audience, function (user) {
|
|
597
|
-
return user.userId ===
|
|
675
|
+
return user.userId === _this5.props.user.Id && user.isAdmin;
|
|
598
676
|
});
|
|
599
677
|
}
|
|
600
678
|
}, {
|
|
601
679
|
key: "renderRow",
|
|
602
680
|
value: function renderRow(circle) {
|
|
603
|
-
var
|
|
681
|
+
var _this6 = this;
|
|
604
682
|
|
|
605
683
|
return /*#__PURE__*/React.createElement("tr", {
|
|
606
684
|
key: circle.Id
|
|
@@ -634,7 +712,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
634
712
|
name: "pencil"
|
|
635
713
|
})), this.validateCircleAdmin(circle, true) && !circle.IsPrivate && /*#__PURE__*/React.createElement("a", {
|
|
636
714
|
onClick: function onClick() {
|
|
637
|
-
|
|
715
|
+
_this6.removeCircle(circle);
|
|
638
716
|
}
|
|
639
717
|
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
640
718
|
style: {
|
|
@@ -649,13 +727,21 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
649
727
|
}, {
|
|
650
728
|
key: "renderFilters",
|
|
651
729
|
value: function renderFilters() {
|
|
652
|
-
var
|
|
730
|
+
var _this7 = this;
|
|
653
731
|
|
|
654
732
|
var userFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
655
733
|
className: "marginRight-10",
|
|
656
734
|
onClick: this.openUserFilter,
|
|
657
735
|
text: "User"
|
|
658
736
|
});
|
|
737
|
+
var unreadFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
738
|
+
className: "marginRight-10",
|
|
739
|
+
onClick: function onClick() {
|
|
740
|
+
return _this7.selectUnreadFilter(!_this7.state.showUnreadOnly);
|
|
741
|
+
},
|
|
742
|
+
leftIcon: this.state.showUnreadOnly ? "check" : null,
|
|
743
|
+
text: "Unread Only"
|
|
744
|
+
});
|
|
659
745
|
var typeFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
660
746
|
className: "marginRight-10",
|
|
661
747
|
onClick: this.openTypeFilter,
|
|
@@ -690,19 +776,19 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
690
776
|
}, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
691
777
|
type: "h5",
|
|
692
778
|
className: "marginRight-20"
|
|
693
|
-
}, "Filter by"), userFilter, typeFilter, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
779
|
+
}, "Filter by"), userFilter, unreadFilter, typeFilter, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
694
780
|
type: "h5",
|
|
695
781
|
className: "marginRight-20 marginLeft-20"
|
|
696
782
|
}, "Sort by:"), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
697
783
|
className: "marginRight-10",
|
|
698
784
|
onClick: function onClick() {
|
|
699
|
-
return
|
|
785
|
+
return _this7.selectSort("newest");
|
|
700
786
|
},
|
|
701
787
|
leftIcon: this.state.sortBy === "newest" ? "check" : null,
|
|
702
788
|
text: "Newest first"
|
|
703
789
|
}), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
704
790
|
onClick: function onClick() {
|
|
705
|
-
return
|
|
791
|
+
return _this7.selectSort("oldest");
|
|
706
792
|
},
|
|
707
793
|
leftIcon: this.state.sortBy === "oldest" ? "check" : null,
|
|
708
794
|
text: "Oldest first"
|
|
@@ -711,7 +797,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
711
797
|
}, {
|
|
712
798
|
key: "renderUserFilterPopup",
|
|
713
799
|
value: function renderUserFilterPopup() {
|
|
714
|
-
var
|
|
800
|
+
var _this8 = this;
|
|
715
801
|
|
|
716
802
|
if (!this.state.userFilterOpen) {
|
|
717
803
|
return null;
|
|
@@ -731,7 +817,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
731
817
|
placeholder: "Enter name",
|
|
732
818
|
value: this.state.userSearch,
|
|
733
819
|
onChange: function onChange(e) {
|
|
734
|
-
return
|
|
820
|
+
return _this8.onHandleChange(e);
|
|
735
821
|
},
|
|
736
822
|
alwaysShowLabel: true
|
|
737
823
|
}), this.getUsers().map(function (user) {
|
|
@@ -739,7 +825,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
739
825
|
key: user.userId,
|
|
740
826
|
user: user,
|
|
741
827
|
onClick: function onClick() {
|
|
742
|
-
|
|
828
|
+
_this8.selectUserFilter(user);
|
|
743
829
|
}
|
|
744
830
|
});
|
|
745
831
|
}));
|
|
@@ -747,7 +833,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
747
833
|
}, {
|
|
748
834
|
key: "renderTypeFilterPopup",
|
|
749
835
|
value: function renderTypeFilterPopup() {
|
|
750
|
-
var
|
|
836
|
+
var _this9 = this;
|
|
751
837
|
|
|
752
838
|
if (!this.state.typeFilterOpen) {
|
|
753
839
|
return null;
|
|
@@ -761,13 +847,13 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
761
847
|
onClose: this.closeTypeFilter
|
|
762
848
|
}, /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
763
849
|
onClick: function onClick() {
|
|
764
|
-
|
|
850
|
+
_this9.selectTypeFilter("circle");
|
|
765
851
|
},
|
|
766
852
|
text: _.capitalize(values.entityName),
|
|
767
853
|
className: "marginRight-10"
|
|
768
854
|
}), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
769
855
|
onClick: function onClick() {
|
|
770
|
-
|
|
856
|
+
_this9.selectTypeFilter("private");
|
|
771
857
|
},
|
|
772
858
|
text: "Private Message"
|
|
773
859
|
}));
|
|
@@ -775,7 +861,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
775
861
|
}, {
|
|
776
862
|
key: "render",
|
|
777
863
|
value: function render() {
|
|
778
|
-
var
|
|
864
|
+
var _this10 = this;
|
|
779
865
|
|
|
780
866
|
return /*#__PURE__*/React.createElement("div", null, this.renderTypeFilterPopup(), this.renderUserFilterPopup(), /*#__PURE__*/React.createElement(Components$4.Header, null, this.canAddNew() && /*#__PURE__*/React.createElement(Components$4.AddButton, {
|
|
781
867
|
onClick: this.onAddNew,
|
|
@@ -799,7 +885,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
799
885
|
width: 50
|
|
800
886
|
}
|
|
801
887
|
}))), /*#__PURE__*/React.createElement("tbody", null, this.getCircles().map(function (circle) {
|
|
802
|
-
return
|
|
888
|
+
return _this10.renderRow(circle);
|
|
803
889
|
})))));
|
|
804
890
|
}
|
|
805
891
|
}]);
|
|
@@ -1763,6 +1849,32 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1763
1849
|
});
|
|
1764
1850
|
});
|
|
1765
1851
|
|
|
1852
|
+
_defineProperty(_assertThisInitialized(_this), "markCircleAsRead", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1853
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1854
|
+
while (1) {
|
|
1855
|
+
switch (_context5.prev = _context5.next) {
|
|
1856
|
+
case 0:
|
|
1857
|
+
_context5.prev = 0;
|
|
1858
|
+
_context5.next = 3;
|
|
1859
|
+
return circleActions.markAsRead(_this.state.circleId, _this.props.user.Id);
|
|
1860
|
+
|
|
1861
|
+
case 3:
|
|
1862
|
+
_context5.next = 8;
|
|
1863
|
+
break;
|
|
1864
|
+
|
|
1865
|
+
case 5:
|
|
1866
|
+
_context5.prev = 5;
|
|
1867
|
+
_context5.t0 = _context5["catch"](0);
|
|
1868
|
+
console.error("Failed to mark circle as read:", _context5.t0);
|
|
1869
|
+
|
|
1870
|
+
case 8:
|
|
1871
|
+
case "end":
|
|
1872
|
+
return _context5.stop();
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}, _callee5, null, [[0, 5]]);
|
|
1876
|
+
})));
|
|
1877
|
+
|
|
1766
1878
|
_defineProperty(_assertThisInitialized(_this), "sendMessage", function () {
|
|
1767
1879
|
var message = {
|
|
1768
1880
|
_id: Helper.randomString(),
|
|
@@ -1847,6 +1959,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1847
1959
|
_createClass(Circle, [{
|
|
1848
1960
|
key: "componentDidMount",
|
|
1849
1961
|
value: function componentDidMount() {
|
|
1962
|
+
this.markCircleAsRead();
|
|
1850
1963
|
this.checkGetData();
|
|
1851
1964
|
this.connect();
|
|
1852
1965
|
this.props.setNavData({
|
|
@@ -1983,8 +2096,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1983
2096
|
display: this.state.imageInputShowing ? "block" : "none"
|
|
1984
2097
|
}
|
|
1985
2098
|
}, /*#__PURE__*/React.createElement(Components$2.ImageInput, {
|
|
1986
|
-
ref: function ref(
|
|
1987
|
-
_this5.imageInput =
|
|
2099
|
+
ref: function ref(_ref6) {
|
|
2100
|
+
_this5.imageInput = _ref6;
|
|
1988
2101
|
},
|
|
1989
2102
|
multiple: true,
|
|
1990
2103
|
limit: 10,
|
|
@@ -1998,8 +2111,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1998
2111
|
display: this.state.fileInputShowing ? "block" : "none"
|
|
1999
2112
|
}
|
|
2000
2113
|
}, /*#__PURE__*/React.createElement(Components$2.FileInput, {
|
|
2001
|
-
ref: function ref(
|
|
2002
|
-
_this5.fileInput =
|
|
2114
|
+
ref: function ref(_ref7) {
|
|
2115
|
+
_this5.fileInput = _ref7;
|
|
2003
2116
|
},
|
|
2004
2117
|
multiple: true,
|
|
2005
2118
|
limit: 10,
|
|
@@ -2293,8 +2406,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2293
2406
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2294
2407
|
className: "chat_newMessage"
|
|
2295
2408
|
}, this.renderChatInput()), this.renderReplyTo(), /*#__PURE__*/React.createElement("div", {
|
|
2296
|
-
ref: function ref(
|
|
2297
|
-
return _this8.chat =
|
|
2409
|
+
ref: function ref(_ref8) {
|
|
2410
|
+
return _this8.chat = _ref8;
|
|
2298
2411
|
},
|
|
2299
2412
|
className: "chat_messages"
|
|
2300
2413
|
}, _.isEmpty(this.state.messages) && !_.isEmpty(this.state.messageDate) && this.renderEmptyDate(), this.state.messages.map(function (m) {
|