Skip to content

Commit

Permalink
Fix #3639 - Reorder timeline item menu options
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Dec 19, 2024
1 parent e7cc807 commit 21a1593
Show file tree
Hide file tree
Showing 45 changed files with 101 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ struct TimelineItemMenuActionProvider {
if timelineKind == .pinned || timelineKind == .media(.mediaFilesScreen) {
actions.append(.viewInRoomTimeline)
}

if canRedactItem(item), let poll = item.pollIfAvailable, !poll.hasEnded, let eventID = item.id.eventID {
actions.append(.endPoll(pollStartID: eventID))
}

if item.canBeRepliedTo {
if let messageItem = item as? EventBasedMessageTimelineItemProtocol {
Expand All @@ -55,14 +59,6 @@ struct TimelineItemMenuActionProvider {
actions.append(.forward(itemID: item.id))
}

if canCurrentUserPin, let eventID = item.id.eventID {
actions.append(pinnedEventIDs.contains(eventID) ? .unpin : .pin)
}

if item.isRemoteMessage {
actions.append(.copyPermalink)
}

if item.isEditable {
if item.supportsMediaCaption {
if item.hasMediaCaption {
Expand All @@ -76,6 +72,14 @@ struct TimelineItemMenuActionProvider {
actions.append(.edit)
}
}

if item.isRemoteMessage {
actions.append(.copyPermalink)
}

if canCurrentUserPin, let eventID = item.id.eventID {
actions.append(pinnedEventIDs.contains(eventID) ? .unpin : .pin)
}

if item.isCopyable {
actions.append(.copy)
Expand All @@ -87,10 +91,6 @@ struct TimelineItemMenuActionProvider {
actions.append(.removeCaption)
}

if canRedactItem(item), let poll = item.pollIfAvailable, !poll.hasEnded, let eventID = item.id.eventID {
actions.append(.endPoll(pollStartID: eventID))
}

if isViewSourceEnabled {
actions.append(.viewSource)
}
Expand Down Expand Up @@ -131,15 +131,14 @@ struct TimelineItemMenuActionProvider {

private func makeEncryptedItemActions(_ encryptedItem: EncryptedRoomTimelineItem) -> TimelineItemMenuActions? {
var actions: [TimelineItemMenuAction] = [.copyPermalink]
var secondaryActions: [TimelineItemMenuAction] = []


if isViewSourceEnabled {
actions.append(.viewSource)
}

return .init(isReactable: false,
actions: actions,
secondaryActions: secondaryActions,
secondaryActions: [],
emojiProvider: emojiProvider)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 21a1593

Please sign in to comment.