Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
107e5f7c
Commit
107e5f7c
authored
Jul 16, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide chat menu items on broadcast channels when user has no post privileges
parent
f41aa467
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-1
Menu.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
+24
-22
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
107e5f7c
...
...
@@ -148,6 +148,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
lateinit
var
actionSnackbar
:
ActionSnackbar
internal
var
citation
:
String
?
=
null
private
var
editingMessageId
:
String
?
=
null
internal
var
disableMenu
:
Boolean
=
false
private
val
compositeDisposable
=
CompositeDisposable
()
private
var
playComposeMessageButtonsAnimation
=
true
...
...
@@ -355,7 +356,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
ui
{
setupMessageComposer
(
userCanPost
)
isBroadcastChannel
=
channelIsBroadcast
if
(
isBroadcastChannel
&&
!
userCanMod
)
activity
?.
invalidateOptionsMenu
()
if
(
isBroadcastChannel
&&
!
userCanMod
)
{
disableMenu
=
true
activity
?.
invalidateOptionsMenu
()
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
View file @
107e5f7c
...
...
@@ -14,42 +14,44 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
setupSearchMessageMenuItem
(
menu
,
requireContext
())
setupFavoriteMenuItem
(
menu
)
if
(
chatRoomType
!=
RoomType
.
DIRECT_MESSAGE
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MEMBER
,
MENU_ACTION_PINNED_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_members_list
R
.
string
.
title_pinned_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MENTION
S
,
MENU_ACTION_FAVORITE_MESSAGE
S
,
Menu
.
NONE
,
R
.
string
.
msg_mention
s
R
.
string
.
title_favorite_message
s
)
}
if
(
chatRoomType
!=
RoomType
.
DIRECT_MESSAGE
&&
!
disableMenu
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_PINNED_MESSAGES
,
MENU_ACTION_MEMBER
,
Menu
.
NONE
,
R
.
string
.
title_pinned_messages
R
.
string
.
title_members_list
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_MESSAGE
S
,
MENU_ACTION_MENTION
S
,
Menu
.
NONE
,
R
.
string
.
title_favorite_message
s
R
.
string
.
msg_mention
s
)
}
if
(!
disableMenu
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FILES
,
Menu
.
NONE
,
R
.
string
.
title_files
)
}
}
internal
fun
ChatRoomFragment
.
setOnMenuItemClickListener
(
item
:
MenuItem
)
{
...
...
@@ -101,7 +103,7 @@ private fun ChatRoomFragment.setupSearchViewTextListener(searchView: SearchView)
// TODO: We use isSearchTermQueried to avoid querying when the search view is expanded but the user doesn't start typing. Check for a native solution.
if
(
it
.
isEmpty
()
&&
isSearchTermQueried
)
{
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
clearDataSet
=
true
)
}
else
if
(
it
.
isNotEmpty
()){
}
else
if
(
it
.
isNotEmpty
())
{
presenter
.
searchMessages
(
chatRoomId
,
it
)
isSearchTermQueried
=
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment