@@ -47,11 +47,19 @@ void MetaGroupWrapper::Init(Napi::Env env, Napi::Object exports) {
47
47
InstanceMethod (
48
48
" membersMarkPendingRemoval" ,
49
49
&MetaGroupWrapper::membersMarkPendingRemoval),
50
- InstanceMethod (" memberSetName" , &MetaGroupWrapper::memberSetName),
50
+ InstanceMethod (
51
+ " memberSetNameTruncated" , &MetaGroupWrapper::memberSetNameTruncated),
51
52
InstanceMethod (" memberSetInvited" , &MetaGroupWrapper::memberSetInvited),
52
53
InstanceMethod (" memberSetAccepted" , &MetaGroupWrapper::memberSetAccepted),
53
54
InstanceMethod (" memberSetPromoted" , &MetaGroupWrapper::memberSetPromoted),
54
- InstanceMethod (" memberSetAdmin" , &MetaGroupWrapper::memberSetAdmin),
55
+ InstanceMethod (
56
+ " memberSetPromotionSent" , &MetaGroupWrapper::memberSetPromotionSent),
57
+ InstanceMethod (
58
+ " memberSetPromotionFailed" ,
59
+ &MetaGroupWrapper::memberSetPromotionFailed),
60
+ InstanceMethod (
61
+ " memberSetPromotionAccepted" ,
62
+ &MetaGroupWrapper::memberSetPromotionAccepted),
55
63
InstanceMethod (
56
64
" memberSetProfilePicture" , &MetaGroupWrapper::memberSetProfilePicture),
57
65
InstanceMethod (" memberEraseAndRekey" , &MetaGroupWrapper::memberEraseAndRekey),
@@ -73,6 +81,7 @@ void MetaGroupWrapper::Init(Napi::Env env, Napi::Object exports) {
73
81
InstanceMethod (
74
82
" swarmVerifySubAccount" , &MetaGroupWrapper::swarmVerifySubAccount),
75
83
InstanceMethod (" loadAdminKeys" , &MetaGroupWrapper::loadAdminKeys),
84
+ InstanceMethod (" keysAdmin" , &MetaGroupWrapper::keysAdmin),
76
85
77
86
InstanceMethod (" swarmSubaccountSign" , &MetaGroupWrapper::swarmSubaccountSign),
78
87
InstanceMethod (
@@ -431,7 +440,7 @@ void MetaGroupWrapper::memberConstructAndSet(const Napi::CallbackInfo& info) {
431
440
});
432
441
}
433
442
434
- void MetaGroupWrapper::memberSetName (const Napi::CallbackInfo& info) {
443
+ void MetaGroupWrapper::memberSetNameTruncated (const Napi::CallbackInfo& info) {
435
444
wrapExceptions (info, [&] {
436
445
assertIsString (info[0 ]);
437
446
assertIsString (info[1 ]);
@@ -477,29 +486,51 @@ void MetaGroupWrapper::memberSetAccepted(const Napi::CallbackInfo& info) {
477
486
478
487
void MetaGroupWrapper::memberSetPromoted (const Napi::CallbackInfo& info) {
479
488
wrapExceptions (info, [&] {
480
- assertInfoLength (info, 2 );
489
+ assertInfoLength (info, 1 );
481
490
assertIsString (info[0 ]);
482
- assertIsBoolean (info[1 ]);
483
491
auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
484
- auto failed = toCppBoolean (info[1 ], __PRETTY_FUNCTION__);
485
492
auto m = this ->meta_group ->members ->get (pubkeyHex);
486
493
if (m) {
487
- m->set_promoted (failed );
494
+ m->set_promoted ();
488
495
this ->meta_group ->members ->set (*m);
489
496
}
490
497
});
491
498
}
492
499
493
- void MetaGroupWrapper::memberSetAdmin (const Napi::CallbackInfo& info) {
500
+ void MetaGroupWrapper::memberSetPromotionSent (const Napi::CallbackInfo& info) {
494
501
wrapExceptions (info, [&] {
495
502
assertInfoLength (info, 1 );
496
503
assertIsString (info[0 ]);
497
504
auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
498
- // Note: this step might add an admin which was removed back once he accepts the promotion,
499
- // but there is not much we can do about it
500
505
auto m = this ->meta_group ->members ->get (pubkeyHex);
501
506
if (m) {
502
- m->admin = true ;
507
+ m->set_promotion_sent ();
508
+ this ->meta_group ->members ->set (*m);
509
+ }
510
+ });
511
+ }
512
+
513
+ void MetaGroupWrapper::memberSetPromotionFailed (const Napi::CallbackInfo& info) {
514
+ wrapExceptions (info, [&] {
515
+ assertInfoLength (info, 1 );
516
+ assertIsString (info[0 ]);
517
+ auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
518
+ auto m = this ->meta_group ->members ->get (pubkeyHex);
519
+ if (m) {
520
+ m->set_promotion_failed ();
521
+ this ->meta_group ->members ->set (*m);
522
+ }
523
+ });
524
+ }
525
+
526
+ void MetaGroupWrapper::memberSetPromotionAccepted (const Napi::CallbackInfo& info) {
527
+ wrapExceptions (info, [&] {
528
+ assertInfoLength (info, 1 );
529
+ assertIsString (info[0 ]);
530
+ auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
531
+ auto m = this ->meta_group ->members ->get (pubkeyHex);
532
+ if (m) {
533
+ m->set_promotion_accepted ();
503
534
this ->meta_group ->members ->set (*m);
504
535
}
505
536
});
@@ -703,7 +734,6 @@ Napi::Value MetaGroupWrapper::loadAdminKeys(const Napi::CallbackInfo& info) {
703
734
});
704
735
}
705
736
706
-
707
737
Napi::Value MetaGroupWrapper::keysAdmin (const Napi::CallbackInfo& info) {
708
738
return wrapResult (info, [&] {
709
739
assertInfoLength (info, 0 );
0 commit comments