mirror of
https://github.com/muesli/telephant
synced 2024-11-22 11:23:05 +00:00
Always open the actual post the message is pointing to when clicking the timestamp
This commit is contained in:
parent
51716e723b
commit
3136b936db
5 changed files with 13 additions and 1 deletions
|
@ -19,6 +19,7 @@ type Post struct {
|
|||
ReplyToID string
|
||||
ReplyToAuthor string
|
||||
Avatar string
|
||||
PostID string
|
||||
URL string
|
||||
CreatedAt time.Time
|
||||
Liked bool
|
||||
|
|
|
@ -502,6 +502,7 @@ func (mod *Account) handleNotification(n *mastodon.Notification, notify bool) {
|
|||
case "reblog":
|
||||
ev.Forward = true
|
||||
ev.Post.MessageID = n.Account.Acct + "-share-" + ev.Post.MessageID
|
||||
ev.Post.PostID = string(n.Status.ID)
|
||||
ev.Post.Author = n.Status.Account.Acct
|
||||
ev.Post.AuthorName = n.Status.Account.DisplayName
|
||||
ev.Post.AuthorURL = n.Status.Account.URL
|
||||
|
@ -523,6 +524,7 @@ func (mod *Account) handleNotification(n *mastodon.Notification, notify bool) {
|
|||
case "favourite":
|
||||
ev.Like = true
|
||||
ev.Post.MessageID = n.Account.Acct + "-like-" + ev.Post.MessageID
|
||||
ev.Post.PostID = string(n.Status.ID)
|
||||
ev.Post.Author = n.Status.Account.Acct
|
||||
ev.Post.AuthorName = n.Status.Account.DisplayName
|
||||
ev.Post.AuthorURL = n.Status.Account.URL
|
||||
|
@ -621,6 +623,7 @@ func (mod *Account) handleStatus(s *mastodon.Status) accounts.MessageEvent {
|
|||
})
|
||||
}
|
||||
|
||||
ev.Post.PostID = string(s.Reblog.ID)
|
||||
ev.Post.URL = s.Reblog.URL
|
||||
ev.Post.Author = s.Reblog.Account.Acct
|
||||
ev.Post.AuthorName = s.Reblog.Account.DisplayName
|
||||
|
|
|
@ -17,6 +17,7 @@ const (
|
|||
const (
|
||||
Name = int(core.Qt__UserRole) + 1<<iota
|
||||
MessageID
|
||||
PostID
|
||||
PostURL
|
||||
Author
|
||||
AuthorURL
|
||||
|
@ -68,6 +69,7 @@ func (m *MessageModel) init() {
|
|||
m.SetRoles(map[int]*core.QByteArray{
|
||||
Name: core.NewQByteArray2("name", -1),
|
||||
MessageID: core.NewQByteArray2("messageid", -1),
|
||||
PostID: core.NewQByteArray2("postid", -1),
|
||||
PostURL: core.NewQByteArray2("posturl", -1),
|
||||
Author: core.NewQByteArray2("author", -1),
|
||||
AuthorURL: core.NewQByteArray2("authorurl", -1),
|
||||
|
@ -153,6 +155,10 @@ func (m *MessageModel) data(index *core.QModelIndex, role int) *core.QVariant {
|
|||
{
|
||||
return core.NewQVariant1(p.MessageID)
|
||||
}
|
||||
case PostID:
|
||||
{
|
||||
return core.NewQVariant1(p.PostID)
|
||||
}
|
||||
case PostURL:
|
||||
{
|
||||
return core.NewQVariant1(p.PostURL)
|
||||
|
|
|
@ -18,6 +18,7 @@ type Message struct {
|
|||
|
||||
Name string
|
||||
MessageID string
|
||||
PostID string
|
||||
PostURL string
|
||||
Author string
|
||||
AuthorURL string
|
||||
|
@ -137,6 +138,7 @@ func messageFromEvent(event accounts.MessageEvent) *Message {
|
|||
|
||||
if event.Post.MessageID != "" {
|
||||
p.MessageID = event.Post.MessageID
|
||||
p.PostID = event.Post.PostID
|
||||
p.PostURL = event.Post.URL
|
||||
p.Name = event.Post.AuthorName
|
||||
p.Author = event.Post.Author
|
||||
|
|
|
@ -203,7 +203,7 @@ ColumnLayout {
|
|||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
uiBridge.loadConversation(message.messageid)
|
||||
uiBridge.loadConversation(message.postid)
|
||||
ComponentCreator.createConversationPopup(this).open();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue