status-mobile
status-mobile copied to clipboard
Differences at admin options between desktop and mobile clients (Pin message, Leave community)
Bug Report
Problem
After changing in recent status-go on status mobile there is no option for the community admin to pin messages and "Leave community" is available for them (it was not previously)
Expected behavior
- admin can't "Leave community"
- admin can pin message
Actual behavior
- "Leave community" is available for community admin (on mobile only)
- no pin message is available for community admin
Reproduction
On Desktop (master 22/06/23):
- create user, create a community ("Any member can pin a message" is off) On mobile (nightly 23/06/23):
- sign in, using QR from Desktop
- long tap > check options for community
- send any message and try to pin it
Additional Information
- Status version: nightly 23/06/23
- Operating System: Android, iOS
Encountered while working on another issue
mobile leave and pin use :admin key in community to check for admin https://github.com/status-im/status-mobile/blob/c8fb0f7274b2de20388f1e84ee7a67932a2302fe/src/status_im2/contexts/communities/actions/community_options/view.cljs#L146
(defn get-context-drawers
[{:keys [id]}]
(let [{:keys [token-permissions admin joined
muted banList]} (rf/sub [:communities/community id])
request-id (rf/sub [:communities/my-pending-request-to-join id])]
(cond
admin (owner-options id token-permissions muted)
joined (joined-options id token-permissions muted)
request-id (join-request-sent-options id token-permissions request-id)
banList (banned-options id token-permissions)
:else (not-joined-options id token-permissions))))
but there's no :admin key in community https://github.com/status-im/status-go/blob/4adbacdfe8ed0ed8d5377a7fb04b811ff339fdb4/protocol/communities/community.go#L190
func (o *Community) MarshalJSON() ([]byte, error) {
if o.config.MemberIdentity == nil {
return nil, errors.New("member identity not set")
}
communityItem := struct {
ID types.HexBytes `json:"id"`
MemberRole protobuf.CommunityMember_Roles `json:"memberRole"`
Verified bool `json:"verified"`
Joined bool `json:"joined"`
Spectated bool `json:"spectated"`
RequestedAccessAt int `json:"requestedAccessAt"`
Name string `json:"name"`
Description string `json:"description"`
IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"`
Tags []CommunityTag `json:"tags"`
Chats map[string]CommunityChat `json:"chats"`
Categories map[string]CommunityCategory `json:"categories"`
Images map[string]images.IdentityImage `json:"images"`
Permissions *protobuf.CommunityPermissions `json:"permissions"`
Members map[string]*protobuf.CommunityMember `json:"members"`
CanRequestAccess bool `json:"canRequestAccess"`
CanManageUsers bool `json:"canManageUsers"` //TODO: we can remove this
CanDeleteMessageForEveryone bool `json:"canDeleteMessageForEveryone"` //TODO: we can remove this
CanJoin bool `json:"canJoin"`
Color string `json:"color"`
RequestedToJoinAt uint64 `json:"requestedToJoinAt,omitempty"`
IsMember bool `json:"isMember"`
Muted bool `json:"muted"`
MuteTill time.Time `json:"muteTill,omitempty"`
CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"`
Encrypted bool `json:"encrypted"`
BanList []string `json:"banList"`
TokenPermissions map[string]*protobuf.CommunityTokenPermission `json:"tokenPermissions"`
CommunityTokensMetadata []*protobuf.CommunityTokenMetadata `json:"communityTokensMetadata"`
ActiveMembersCount uint64 `json:"activeMembersCount"`
}{
NOTE FOR QA:
Recheck, please the pinned messages styling in the community https://www.figma.com/file/PPWkgOYlZZDxZv5SDGsZVV/Posts-%26-Attachments-for-Mobile?type=design&mode=design&t=oirUpi5yfdydJGYl-0 implemented here https://github.com/status-im/status-mobile/pull/16498
Descoping for now cc @cammellos