Skip to content

[FEATURE REQUEST] Add a member to a space: Set permissions and expiration date#4764

Open
joragua wants to merge 7 commits intomasterfrom
feature/add_a_member_to_a_space
Open

[FEATURE REQUEST] Add a member to a space: Set permissions and expiration date#4764
joragua wants to merge 7 commits intomasterfrom
feature/add_a_member_to_a_space

Conversation

@joragua
Copy link
Collaborator

@joragua joragua commented Feb 3, 2026

Related Issues

App: #4740

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)

QA

@joragua joragua self-assigned this Feb 3, 2026
@joragua joragua linked an issue Feb 3, 2026 that may be closed by this pull request
10 tasks
@joragua joragua force-pushed the feature/add_a_member_to_a_space branch from 4a42584 to b4a9d4e Compare February 4, 2026 10:45
@joragua joragua marked this pull request as ready for review February 4, 2026 11:54
@joragua joragua requested a review from jesmrec February 4, 2026 11:54
Enhancement: Add a member to a space

A new option to add members has been added to the space members
list, visible only to users with the appropriate permissions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My proposal:

A new option to add members to a space has been added. It will be only visible for users with proper permissions.

calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
).apply {
datePicker.minDate = calendar.timeInMillis
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: here, you get the current date to prevent selecting a date in the past. But, is it today allowed? It'd be a good idea to give at least one day (not expiring before tomorrow)

calendar.set(Calendar.MILLISECOND, 999)
val formatter = SimpleDateFormat(DisplayUtils.DATE_FORMAT_ISO, Locale.ROOT)
formatter.timeZone = TimeZone.getTimeZone("UTC")
val isoExpirationDate = formatter.format(calendar.time)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the date include Z to avoid problems with date/time changes?


return ((oldItem.id == newItem.id) && (oldItem.displayName == newItem.displayName) && (oldItem.surname == newItem.surname))
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is pretty similar to the SpaceMembersDiffUtils developed in the previous PR. Just a difference in the areContentsTheSame fun. Any way to refactor and prevent duplicated code?

Comment on lines +77 to +82
val listOfMembersFiltered = spaceMembers.members.sortedWith(compareByDescending<SpaceMember> {
member -> roles.indexOfFirst { it.id in member.roles } }.thenBy { member -> member.displayName })
val diffCallback = SpaceMembersDiffUtil(this.members, listOfMembersFiltered)
val diffResult = DiffUtil.calculateDiff(diffCallback)
this.members = listOfMembersFiltered
diffResult.dispatchUpdatesTo(this)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't catch this new block replacing the "sorting by role and displayname". Why that?

android:background="@android:color/darker_gray"
android:alpha="0.5"/>

</LinearLayout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I miss accessibility properties here

android:layout_height="wrap_content"
android:layout_marginStart="@dimen/standard_half_margin"
android:focusable="true"
android:clickable="true"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that needed? i mean, could be a RadioButton not clickable?

android:background="@android:color/darker_gray"
android:alpha="0.5"/>

</LinearLayout>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same about accessibility?

override fun addMember(
spaceId: String,
memberId: String,
memberType: String,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that memberType user or group? in that case, it might be better to set as an Enum than a string, since the number of possibilities is scoped (2 in that case)

private const val MEMBER_ID_BODY_PARAM = "objectId"
private const val ROLES_BODY_PARAM = "roles"
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Add a member to a space: Set permissions and expiration date

3 participants