|
|
@@ -78,6 +78,7 @@ const ( |
|
|
|
ActionCreateGrampusMETAXDebugTask //49 |
|
|
|
ActionCreateGrampusGPUInferenceTask //50 |
|
|
|
ActionCreateGrampusILUVATARInferenceTask //51 |
|
|
|
ActionInviteFriendRegister //52 |
|
|
|
) |
|
|
|
|
|
|
|
// Action represents user operation type and other information to |
|
|
@@ -112,6 +113,15 @@ type ActionShow struct { |
|
|
|
IssueInfos []string |
|
|
|
CommentLink string |
|
|
|
Cloudbrain *CloudbrainShow4Action |
|
|
|
Data map[string]interface{} |
|
|
|
} |
|
|
|
|
|
|
|
func (a *ActionShow) AddData(key string, val interface{}) { |
|
|
|
if a.Data == nil { |
|
|
|
a.Data = map[string]interface{}{key: val} |
|
|
|
} else { |
|
|
|
a.Data[key] = val |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// GetOpType gets the ActionType of this action. |
|
|
@@ -293,7 +303,28 @@ func (a *Action) ToShow() *ActionShow { |
|
|
|
if strings.Contains(a.Content, "|") && a.IsIssueAction() { |
|
|
|
actionShow.IssueInfos = a.GetIssueInfos() |
|
|
|
} |
|
|
|
|
|
|
|
if strings.Contains(a.Content, "|") && a.IsInviteAction() { |
|
|
|
ids := strings.Split(a.Content, "|") |
|
|
|
if len(ids) >= 2 { |
|
|
|
var invitedId int64 |
|
|
|
var invitedName string |
|
|
|
if len(ids) >= 4 { |
|
|
|
invitedName = ids[3] |
|
|
|
} |
|
|
|
invitedId, _ = strconv.ParseInt(ids[1], 10, 64) |
|
|
|
if invitedId > 0 { |
|
|
|
invitedUser, _ := GetUserByID(invitedId) |
|
|
|
if invitedUser != nil { |
|
|
|
actionShow.AddData("InvitedUserName", invitedUser.Name) |
|
|
|
actionShow.AddData("InvitedUserNotExists", false) |
|
|
|
} else { |
|
|
|
actionShow.AddData("InvitedUserName", invitedName) |
|
|
|
actionShow.AddData("InvitedUserNotExists", true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
actionShow.IssueInfos = a.GetIssueInfos() |
|
|
|
} |
|
|
|
if a.Repo != nil { |
|
|
|
actionShow.RepoLink = a.GetRepoLink() |
|
|
|
actionShow.ShortRepoFullDisplayName = a.ShortRepoFullDisplayName() |
|
|
@@ -459,6 +490,14 @@ func (a *Action) IsIssueAction() bool { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
func (a *Action) IsInviteAction() bool { |
|
|
|
switch a.OpType { |
|
|
|
case ActionInviteFriendRegister: |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// GetFeedsOptions options for retrieving feeds |
|
|
|
type GetFeedsOptions struct { |
|
|
|
RequestedUser *User // the user we want activity for |
|
|
|