Browse Source

chore: bump app version to v6.1.1 and refactor admin check logic

- Incremented application version to v6.1.1 in settings.go.
- Refactored isAdmin function in GroupList.js to check both group owner and participant admin status.
main v6.1.1
Aldino Kemal 9 months ago
parent
commit
2f438c799c
  1. 2
      src/config/settings.go
  2. 16
      src/views/components/GroupList.js

2
src/config/settings.go

@ -5,7 +5,7 @@ import (
)
var (
AppVersion = "v6.1.0"
AppVersion = "v6.1.1"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"

16
src/views/components/GroupList.js

@ -80,9 +80,17 @@ export default {
if (!value) return ''
return moment(value).format('LLL');
},
isAdmin(ownerJID) {
const owner = ownerJID.split('@')[0];
return owner === this.currentUserId;
isAdmin(group) {
// Check if current user is the owner
const owner = group.OwnerJID.split('@')[0];
if (owner === this.currentUserId) {
return true;
}
// Check if current user is an admin in participants
const currentUserJID = `${this.currentUserId}@s.whatsapp.net`;
const participant = group.Participants.find(p => p.JID === currentUserJID);
return participant && participant.IsAdmin;
},
async handleSeeRequestedMember(group_id) {
this.selectedGroupId = group_id;
@ -180,7 +188,7 @@ export default {
<td>{{ formatDate(g.GroupCreated) }}</td>
<td>
<div style="display: flex; gap: 8px; align-items: center;">
<button v-if="isAdmin(g.OwnerJID)" class="ui green tiny button" @click="handleSeeRequestedMember(g.JID)">Requested Members</button>
<button v-if="isAdmin(g)" class="ui green tiny button" @click="handleSeeRequestedMember(g.JID)">Requested Members</button>
<button class="ui red tiny button" @click="handleLeaveGroup(g.JID)">Leave</button>
</div>
</td>

Loading…
Cancel
Save